1# Meson {#meson} 2 3[Meson](https://mesonbuild.com/) is an open source meta build system meant to be 4fast and user-friendly. 5 6In Nixpkgs, meson comes with a setup hook that overrides the configure, check, 7and install phases. 8 9Being a meta build system, meson needs an accompanying backend. In the context 10of Nixpkgs, the typical companion backend is [Ninja](#ninja), that provides a 11setup hook registering ninja-based build and install phases. 12 13## Variables controlling Meson {#meson-variables-controlling} 14 15### Meson Exclusive Variables {#meson-exclusive-variables} 16 17#### `mesonFlags` {#meson-flags} 18 19Controls the flags passed to `meson setup` during configure phase. 20 21#### `mesonBuildDir` {#meson-build-dir} 22 23Directory where Meson will put intermediate files. 24 25Setting this can be useful for debugging multiple Meson builds while in the same source directory, for example, when building for different platforms. 26Different values for each build will prevent build artefacts from interefering with each other. 27This setting has no tangible effect when running the build in a sandboxed derivation. 28 29The default value is `build`. 30 31#### `mesonWrapMode` {#meson-wrap-mode} 32 33Which value is passed as 34[`-Dwrap_mode=`](https://mesonbuild.com/Builtin-options.html#core-options) 35to. In Nixpkgs the default value is `nodownload`, so that no subproject will be 36downloaded (since network access is already disabled during deployment in 37Nixpkgs). 38 39Note: Meson allows pre-population of subprojects that would otherwise be 40downloaded. 41 42#### `mesonBuildType` {#meson-build-type} 43 44Which value is passed as 45[`--buildtype`](https://mesonbuild.com/Builtin-options.html#core-options) to 46`meson setup` during configure phase. In Nixpkgs the default value is `plain`. 47 48#### `mesonAutoFeatures` {#meson-auto-features} 49 50Which value is passed as 51[`-Dauto_features=`](https://mesonbuild.com/Builtin-options.html#core-options) 52to `meson setup` during configure phase. In Nixpkgs the default value is 53`enabled`, meaning that every feature declared as "auto" by the meson scripts 54will be enabled. 55 56#### `mesonCheckFlags` {#meson-check-flags} 57 58Controls the flags passed to `meson test` during check phase. 59 60#### `mesonInstallFlags` {#meson-install-flags} 61 62Controls the flags passed to `meson install` during install phase. 63 64#### `mesonInstallTags` {#meson-install-tags} 65 66A list of installation tags passed to Meson's commandline option 67[`--tags`](https://mesonbuild.com/Installing.html#installation-tags) during 68install phase. 69 70Note: `mesonInstallTags` should be a list of strings, that will be converted to 71a comma-separated string that is recognized to `--tags`. 72Example: `mesonInstallTags = [ "emulator" "assembler" ];` will be converted to 73`--tags emulator,assembler`. 74 75#### `dontUseMesonConfigure` {#dont-use-meson-configure} 76 77When set to true, don't use the predefined `mesonConfigurePhase`. 78 79#### `dontUseMesonCheck` {#dont-use-meson-check} 80 81When set to true, don't use the predefined `mesonCheckPhase`. 82 83#### `dontUseMesonInstall` {#dont-use-meson-install} 84 85When set to true, don't use the predefined `mesonInstallPhase`. 86 87### Honored variables {#meson-honored-variables} 88 89The following variables commonly used by `stdenv.mkDerivation` are honored by 90Meson setup hook. 91 92- `prefixKey` 93- `enableParallelBuilding`