Meson package

Dodane w wersji 0.16.

A Meson package provides support for processing a Meson supported module.

LIBFOO_TYPE = 'meson'

During the configuration stage of a Meson package, meson setup will be invoked to generate build files for the module. For the build stage, meson compile will invoke the generated build files. For the installation stage (if enabled), meson install will be used. Each stage can be configured to manipulate environment variables and options used by Meson.

The default configuration built for projects is debugoptimized. A developer can override this option by explicitly adjusting the configuration option LIBFOO_MESON_BUILD_TYPE to, for example, debug:

LIBFOO_MESON_BUILD_TYPE = 'debug'

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

The configuration stage invokes meson with the arguments:

meson setup \
    --buildtype debugoptimized \
    -Dcmake_prefix_path=<SYSROOT_PATHS> \
    -Dlibdir=lib \
    -Dpkg_config_path=<SYSROOT_PKGCFG_PATHS> \
    -Dprefix=<PREFIX> \
    -Dwrap_mode=nodownload \
    <BUILD_OUTPUT_DIR>

The build type is configured by LIBFOO_MESON_BUILD_TYPE.

The build output directory is configured to PKG_BUILD_OUTPUT_DIR.

Paths may vary based on how the package’s LIBFOO_INSTALL_TYPE is configured. System root paths provided will only include the staging directory if staging is configured. Both the staging and target directories are provided is the target is configured. Likewise with the host directory if host is configured. pkg-config paths are defined to <sysroot>/lib/pkgconfig.

If LIBFOO_PREFIX resolves to an empty prefix, the -Dprefix define is not provided.

In the event that a package is reconfigured (e.g. <pkg>-reconfigure), the --reconfigure argument will also be included.

The build stage invokes meson with the arguments:

meson compile -C <BUILD_OUTPUT_DIR> --jobs <NJOBS>

The -C directory is configured to PKG_BUILD_OUTPUT_DIR.

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 meson with the arguments:

meson install -C <BUILD_OUTPUT_DIR> --destdir <TARGET_DIR> --no-rebuild

With the following environment variables set:

DESTDIR=<TARGET_DIR>

The -C directory is configured to PKG_BUILD_OUTPUT_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). meson install may be invoked multiple times for each target it needs to install into.

The installation stage can be skipped by configuring LIBFOO_MESON_NOINSTALL.

LIBFOO_BUILD_DEFS

Zmienione w wersji 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 "-Doption=value" to the command
    'option': 'value',
}

LIBFOO_BUILD_ENV

Zmienione w wersji 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

Zmienione w wersji 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

Zmienione w wersji 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 "-Doption=value" to the command
    'option': 'value',
}

LIBFOO_CONF_ENV

Zmienione w wersji 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

Zmienione w wersji 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

Dodane w wersji 0.17.

Zmienione w wersji 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

Zmienione w wersji 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 "-Doption=value" to the command
    'option': 'value',
}

LIBFOO_INSTALL_ENV

Zmienione w wersji 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

Zmienione w wersji 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_MESON_BUILD_TYPE

Dodane w wersji 2.7.

Specifies the build type used for the Meson package. A package may use a Meson-supported build type (plain, debug, debugoptimized, release or minsize). A developer needing to use a specific build type can configure this option with the name of the configuration. By default, the debugoptimized build type is used for all Meson packages.

LIBFOO_MESON_BUILD_TYPE = 'debugoptimized'

LIBFOO_MESON_NOINSTALL

Specifies whether the Meson package should skip an attempt to invoke the install command. Ideally, projects will have an install options configured to define how a project will install files into a target (or staging) environment. Not all Meson projects have installation options configured, 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 Meson-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_MESON_NOINSTALL = True