meson.eclass

Name

meson.eclass -- common ebuild functions for meson-based packages

Description

This eclass contains the default phase functions for packages which use the meson build system.

Supported EAPIs

7 8

Example

Typical ebuild using meson.eclass:

EAPI=8

inherit meson

...

src_configure() {
      local emesonargs=(
              $(meson_use qt5)
              $(meson_feature threads)
              $(meson_use bindist official_branding)
      )
      meson_src_configure
}

...

Exported Phases

  • src_compile

  • src_test

  • src_install

  • src_configure

Functions

meson_add_machine_file <name> < <data>

Appends --native-file or --cross-file to emesonargs with the data given via standard input. Assumes emesonargs has already been defined as an array.

meson_add_native_file <name> < <data>

Appends --native-file (never --cross-file) to emesonargs with the data given via standard input. Assumes emesonargs has already been defined as an array.

meson_use <USE flag> [option name]

Given a USE flag and meson project option, outputs a string like:

-Doption=true
-Doption=false

If the project option is unspecified, it defaults to the USE flag.

meson_feature <USE flag> [option name]

Given a USE flag and meson project option, outputs a string like:

-Doption=enabled
-Doption=disabled

If the project option is unspecified, it defaults to the USE flag.

setup_meson_src_configure

Calculate the command line which meson should use, and other relevant variables. Invoke via "${MESONARGS[@]}" in the calling environment. This function is called from meson_src_configure.

meson_src_configure [extra meson arguments]

This is the meson_src_configure function.

meson_src_compile [extra ninja arguments]

This is the meson_src_compile function.

meson_src_test [extra meson test arguments]

This is the meson_src_test function.

meson_install [extra meson install arguments]

Calls meson install with suitable arguments

meson_src_install [extra meson install arguments]

This is the meson_src_install function.

Variables

BUILD_DIR

Build directory, location where all generated files should be placed. If this isn't set, it defaults to ${WORKDIR}/${P}-build.

MESON_VERBOSE (USER VARIABLE)

Set to OFF to disable verbose messages during compilation

EMESON_BUILDTYPE = plain}"

The buildtype value to pass to meson setup.

EMESON_SOURCE

The location of the source files for the project; this is the source directory to pass to meson. If this isn't set, it defaults to ${S}

Function Variables

emesonargs

Optional meson arguments as Bash array; this should be defined before calling meson_src_configure, meson_add_machine_file, or meson_add_native_file.

MYMESONARGS

User-controlled environment variable containing arguments to be passed to meson in meson_src_configure.

Reporting Bugs

Please report bugs via https://bugs.gentoo.org/