Waf package

Added in version 2.8.

A Waf package provides support to easily invoke Waf commands at various stages of a package.

LIBFOO_TYPE = 'waf'

During the configuration stage of a Waf package, waf configure will be invoked to prepare a build. For the build stage, waf build will invoke the build event. For the installation stage (if enabled), waf install will be used. Each stage can be configured to manipulate environment variables and options used by Waf.

The following shows the default arguments used in stages and outlines configuration options that are available for a Waf package to set. See also the Waf package examples. All stages are invoked with a PKG_BUILD_DIR working directory.

The configuration stage invokes waf with the arguments:

waf configure \
    --bindir=bin \
    --libdir=lib \
    --out=<BUILD_OUTPUT_DIR> \
    --prefix=<PREFIX>

The prefix arguments are configured to LIBFOO_PREFIX.

The build output directory is configured to PKG_BUILD_OUTPUT_DIR.

The build stage invokes waf with the arguments:

waf build --jobs <NJOBS>

The number of jobs is populated by either the --jobs argument, LIBFOO_FIXED_JOBS or LIBFOO_MAX_JOBS. Although, if the configuration results in a single job, the argument will not be used.

The install stage invokes waf with an install target:

waf install --destdir <TARGET_DIR>

With the following environment variables set:

DESTDIR=<TARGET_DIR>

The --destdir argument and DESTDIR environment path will be set to the target sysroot the package should install into (see also LIBFOO_INSTALL_TYPE). waf install may be invoked multiple times for each target it needs to install into.

The installation stage can be skipped by configuring LIBFOO_WAF_NOINSTALL.

LIBFOO_BUILD_DEFS

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass definitions into the build process. This option can is defined as a dictionary of string pairs. This field is optional.

LIBFOO_BUILD_DEFS = {
    # adds "--option=value" to the command
    '--option': 'value',
}

LIBFOO_BUILD_ENV

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass environment variables into the build process. This option is defined as a dictionary with key-value pairs where the key is the environment name and the value is the environment variable’s value. This field is optional.

LIBFOO_BUILD_ENV = {
    'OPTION': 'VALUE',
}

LIBFOO_BUILD_OPTS

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass command line options into the build process. This option can be defined as a dictionary of string pairs or a list with strings – either way defined will generate argument values to include in the build event. This field is optional.

LIBFOO_BUILD_OPTS = {
    # adds "--option value" to the command
    '--option': 'value',
    # adds "--flag" to the command
    '--flag': '',
}

# (or)

LIBFOO_BUILD_OPTS = [
    # adds "--some-option" to the command
    '--some-option',
]

LIBFOO_CONF_DEFS

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass definitions into the configuration process. This option can is defined as a dictionary of string pairs. This field is optional.

LIBFOO_CONF_DEFS = {
    # adds "--option=value" to the command
    '--option': 'value',
}

LIBFOO_CONF_ENV

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass environment variables into the configuration process. This option is defined as a dictionary with key-value pairs where the key is the environment name and the value is the environment variable’s value. This field is optional.

LIBFOO_CONF_ENV = {
    'OPTION': 'VALUE',
}

LIBFOO_CONF_OPTS

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass command line options into the configuration process. This option can be defined as a dictionary of string pairs or a list with strings – either way defined will generate argument values to include in the configuration event. This field is optional.

LIBFOO_CONF_OPTS = {
    # adds "--option value" to the command
    '--option': 'value',
    # adds "--flag" to the command
    '--flag': '',
}

# (or)

LIBFOO_CONF_OPTS = [
    # adds "--some-option" to the command
    '--some-option',
]

LIBFOO_ENV

Added in version 0.17.

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass environment variables into all stages for a package. This option is defined as a dictionary with key-value pairs where the key is the environment name and the value is the environment variable’s value. This field is optional.

LIBFOO_ENV = {
    'OPTION': 'VALUE',
}

LIBFOO_INSTALL_DEFS

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass definitions into the installation process. This option can is defined as a dictionary of string pairs. This field is optional.

LIBFOO_INSTALL_DEFS = {
    # adds "--option=value" to the command
    '--option': 'value',
}

LIBFOO_INSTALL_ENV

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass environment variables into the installation process. This option is defined as a dictionary with key-value pairs where the key is the environment name and the value is the environment variable’s value. This field is optional.

LIBFOO_INSTALL_ENV = {
    'OPTION': 'VALUE',
}

LIBFOO_INSTALL_OPTS

Distinto en la versión 2.2: Support added for path-like values.

Provides a means to pass command line options into the installation process. This option can be defined as a dictionary of string pairs or a list with strings – either way defined will generate argument values to include in the installation event. This field is optional.

LIBFOO_INSTALL_OPTS = {
    # include the "install" target to the command
    'install': '',
    # adds "--option value" to the command
    '--option': 'value',
}

# (or)

LIBFOO_INSTALL_OPTS = [
    # include the "install" target to the command
    'install',
    # adds "--some-option" to the command
    '--some-option',
]

Defining custom install options will prevent the default install target from being added. Users looking to utilize the install target for the install stage with custom arguments should explicitly include the install target in their options.

LIBFOO_WAF_NOINSTALL

Specifies whether the Waf package should skip an attempt to invoke the install command. Ideally, projects can support an install invoke to help install files into a target (or staging) environment. Not all Waf projects may support an install stage, or there can be cases where installation stage for a package to fail due to issues with some host environments. A developer can specify this no-install flag to skip a Waf-driven install request and manage installation actions through other means (such as post-processing). By default, the installation stage is invoked with a value of False.

LIBFOO_WAF_NOINSTALL = True