Waf
Encyclopedia
Waf is a Build automation
Build Automation
Build automation is the act of scripting or automating a wide variety of tasks that software developers do in their day-to-day activities including things like:* compiling computer source code into binary code* packaging binary code* running tests...

 tool - a program that assists in the automatic compilation and installation of other programs or libraries.

General

  • Portable to Unix and non-Unix systems
  • Lightweight
  • Offers a Turing-complete programming language (similar to SCons
    SCons
    SCons is a computer software construction tool that automatically analyzes source code file dependencies and operating system adaptation requirements from a software project description and generates final binary executables for installation on the target operating system platform...

    )
  • Support for standard targets: configure, build, clean, distclean, install, and uninstall

Language Support

  • A C
    C (programming language)
    C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

    /C++
    C++
    C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

     preprocessor for computing dependencies
  • Fortran
    Fortran
    Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...

     is supported with automated detection of Module dependencies
  • Support for OCaml and hybrid programs, support for GNOME
    GNOME
    GNOME is a desktop environment and graphical user interface that runs on top of a computer operating system. It is composed entirely of free and open source software...

     programs
  • Support for the D programming language (both gdc and dmd are supported)
  • Support for C#, Java, Python
    Python (programming language)
    Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

     project
  • Provides various tools for processing DocBook
    DocBook
    DocBook is a semantic markup language for technical documentation. It was originally intended for writing technical documents related to computer hardware and software but it can be used for any other sort of documentation....

    , man pages, intltool/msgfmt

Other

  • Colored output and progress bar display
  • Scripts are Python modules
  • XML script front-end and a dedicated, easy-to-parse "IDE output" mode to ease the interaction with integrated development environments
  • Modular configuration scheme with customizable command-line parsing
  • Daemon mode for background recompilation
  • Find source files intelligently (glob
    Glob
    In computer programming, the verb glob or globbing is used to refer to an instance of pattern matching behavior. The noun "glob" is used to refer to a particular pattern, e.g...

    -like) to ease script maintenance
  • Support for global object cache to avoid unnecessary recompilations
  • Support for unit tests run on programs at the end of builds

Requirements

  • No installation required: the waf script (only 95 KB
    Kilobyte
    The kilobyte is a multiple of the unit byte for digital information. Although the prefix kilo- means 1000, the term kilobyte and symbol KB have historically been used to refer to either 1024 bytes or 1000 bytes, dependent upon context, in the fields of computer science and information...

    ) can be distributed and used directly
  • Python
    Python (programming language)
    Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

     is an external dependency

History

Thomas Nagy created a build automation tool called BKsys which was designed to sit on top of SCons
SCons
SCons is a computer software construction tool that automatically analyzes source code file dependencies and operating system adaptation requirements from a software project description and generates final binary executables for installation on the target operating system platform...

, providing higher-level functionality similar to that of Autotools. When Thomas Nagy decided that SCons' fundamental issues (most notably the poor scalability) were too complex and time-consuming to fix, he started a complete rewrite
Rewrite (programming)
A rewrite in computer programming is the act or result of re-implementing a large portion of existing functionality without re-use of its source code. When the rewrite is not using existing code at all, it is common to speak of a rewrite from scratch...

 which he named Waf.

In 2005 the KDE
KDE
KDE is an international free software community producing an integrated set of cross-platform applications designed to run on Linux, FreeBSD, Microsoft Windows, Solaris and Mac OS X systems...

 project considered moving from Autotools to SCons and BKsys in its builds, but a year later the decision was made to instead use CMake
CMake
CMake is a cross-platform, open-source system for managing the build process of software using a compiler-independent method. It is designed to support directory hierarchies and applications that depend on multiple libraries, and for use in conjunction with native build environments such as Make,...

. Waf was still in a very early pre-alpha stage at that point.

Example Waf file

Below is a very simple wscript that would compile a source called "hello-world.c" using the platform default c-compiler:

top = '.'
out = 'build'

def options(opt):
opt.load('compiler_c')

def configure(conf):
conf.load('compiler_c')

def build(bld):
bld.program(source = 'hello-world.c', target = 'hello-world', features = 'c cprogram')


The project is built with the following command line:
waf configure build

Notable applications

Waf is used to build software by a number of different free and open source projects.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK