meson - Meson build elementΒΆ

This is a BuildElement implementation for using Meson build scripts.

You will often want to pass additional arguments to meson. This should be done on a per-element basis by setting the meson-local variable. Here is an example:

variables:
  meson-local: |
    -Dmonkeys=yes

If you want to pass extra options to meson for every element in your project, set the meson-global variable in your project.conf file. Here is an example of that:

elements:
  meson:
    variables:
      meson-global: |
        -Dmonkeys=always

Here is the default configuration for the meson element in full:

# Meson default configuration

variables:

  build-dir: _builddir

  # Project-wide extra arguments to be passed to `meson`
  meson-global: ''

  # Element-specific extra arguments to be passed to `meson`.
  meson-local: ''

  # For backwards compatibility only, do not use.
  meson-extra: ''

  meson-args: |

    --prefix=%{prefix} \
    --bindir=%{bindir} \
    --sbindir=%{sbindir} \
    --sysconfdir=%{sysconfdir} \
    --datadir=%{datadir} \
    --includedir=%{includedir} \
    --libdir=%{libdir} \
    --libexecdir=%{libexecdir} \
    --localstatedir=%{localstatedir} \
    --sharedstatedir=%{sharedstatedir} \
    --mandir=%{mandir} \
    --infodir=%{infodir} %{meson-extra} %{meson-global} %{meson-local}

  meson: meson %{build-dir} %{meson-args}

  ninja: |
    ninja -j ${NINJAJOBS} -C %{build-dir}

  ninja-install: |
    env DESTDIR="%{install-root}" ninja -C %{build-dir} install

  # Set this if the sources cannot handle parallelization.
  #
  # notparallel: True

config:

  # Commands for configuring the software
  #
  configure-commands:
  - |
    %{meson}

  # Commands for building the software
  #
  build-commands:
  - |
    %{ninja}

  # Commands for installing the software into a
  # destination folder
  #
  install-commands:
  - |
    %{ninja-install}

  # Commands for stripping debugging information out of
  # installed binaries
  #
  strip-commands:
  - |
    %{strip-binaries}

# Use max-jobs CPUs for building
environment:
  NINJAJOBS: |
    %{max-jobs}

# And dont consider NINJAJOBS as something which may
# effect build output.
environment-nocache:
- NINJAJOBS