meson/setup-hook.sh: make build directory configurable

Changed files
+14 -2
doc
pkgs
by-name
me
+10
doc/hooks/meson.section.md
···
Controls the flags passed to `meson setup` during configure phase.
+
#### `mesonBuildDir` {#meson-build-dir}
+
+
Directory where Meson will put intermediate files.
+
+
Setting this can be useful for debugging multiple Meson builds while in the same source directory, for example, when building for different platforms.
+
Different values for each build will prevent build artefacts from interefering with each other.
+
This setting has no tangible effect when running the build in a sandboxed derivation.
+
+
The default value is `build`.
+
#### `mesonWrapMode` {#meson-wrap-mode}
Which value is passed as
+4 -2
pkgs/by-name/me/meson/setup-hook.sh
···
mesonConfigurePhase() {
runHook preConfigure
+
: ${mesonBuildDir:=build}
+
local flagsArray=()
if [ -z "${dontAddPrefix-}" ]; then
···
echoCmd 'mesonConfigurePhase flags' "${flagsArray[@]}"
-
meson setup build "${flagsArray[@]}"
-
cd build || { echoCmd 'mesonConfigurePhase' "could not cd to build"; exit 1; }
+
meson setup "$mesonBuildDir" "${flagsArray[@]}"
+
cd "$mesonBuildDir" || { echoCmd 'mesonConfigurePhase' "could not cd to $mesonBuildDir"; exit 1; }
if ! [[ -v enableParallelBuilding ]]; then
enableParallelBuilding=1