SCons package

Added in version 0.13.

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

LIBFOO_TYPE = 'scons'

SCons-based projects by default will invoke the default target during the build stage, and invoke the install alias for the installation stage.

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

Default configurations for SCons packages will not run a configuration stage. However, if a user wants to run a specific target during this stage, a target can be added into the configuration options. For example, if the package has a target prework that should be invoked during the configuration stage, the following can be used:

LIBFOO_CONF_OPTS = [
    'prework',
]

Which will invoke scons with the arguments:

scons -Q prework

Alternatively, if no configuration options are specified, a <package>-configure script can be invoked if available.

The build stage invokes scons with the arguments:

scons -Q --jobs=<NJOBS>

This will trigger the default target for the SCons configuration. Developers can configure a specific target to invoke during the build stage by specifying a LIBFOO_BUILD_OPTS configuration. For example, if a package uses the target release for standard release builds, the following can be used:

LIBFOO_BUILD_OPTS = [
    'release',
]

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

The install stage invokes scons with an install target:

scons -Q install

With the following variables set:

DESTDIR=<TARGET_DIR>
PREFIX=<PREFIX>

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

The prefix argument is configured to LIBFOO_PREFIX.

If a package defines install options, the install target is not provided by default. Developers can override what target to invoke by adding it into the install options:

LIBFOO_INSTALL_OPTS = [
    'install-minimal',
]

The installation stage can be skipped by configuring LIBFOO_SCONS_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',
}

# (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',
}

# (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 = {
    # adds "--option value" to the command
    '--option': 'value',
}

# (or)

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

LIBFOO_SCONS_NOINSTALL

Specifies whether a SCons package should skip an attempt to invoke the install alias. Ideally, projects will have an install alias defined to specify how a project will install files into a target (or staging) environment. Not all SCons projects may have this target defined, which can cause the installation stage for a package to fail. A developer can specify this no-install flag to skip a SCons install target 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_SCONS_NOINSTALL = True