# 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
