File tree Expand file tree Collapse file tree
development/tools/build-managers/meson Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33, stdenv
44, writeTextDir
55, substituteAll
6- , targetPackages
76} :
87
9- let
10- # See https://mesonbuild.com/Reference-tables.html#cpu-families
11- cpuFamilies = {
12- aarch64 = "aarch64" ;
13- armv5tel = "arm" ;
14- armv6l = "arm" ;
15- armv7l = "arm" ;
16- i686 = "x86" ;
17- x86_64 = "x86_64" ;
18- } ;
19- in
208python3Packages . buildPythonApplication rec {
219 pname = "meson" ;
2210 version = "0.54.0" ;
@@ -70,27 +58,11 @@ python3Packages.buildPythonApplication rec {
7058
7159 setupHook = ./setup-hook.sh ;
7260
73- crossFile = writeTextDir "cross-file.conf" ''
74- [binaries]
75- pkgconfig = 'pkg-config'
76-
77- [properties]
78- needs_exe_wrapper = true
79-
80- [host_machine]
81- system = '${ targetPackages . stdenv . targetPlatform . parsed . kernel . name } '
82- cpu_family = '${ cpuFamilies . ${ targetPackages . stdenv . targetPlatform . parsed . cpu . name } } '
83- cpu = '${ targetPackages . stdenv . targetPlatform . parsed . cpu . name } '
84- endian = ${ if targetPackages . stdenv . targetPlatform . isLittleEndian then "'little'" else "'big'" }
85- '' ;
86-
8761 # 0.45 update enabled tests but they are failing
8862 doCheck = false ;
8963 # checkInputs = [ ninja pkgconfig ];
9064 # checkPhase = "python ./run_project_tests.py";
9165
92- isCross = stdenv . targetPlatform != stdenv . hostPlatform ;
93-
9466 meta = with lib ; {
9567 homepage = "https://mesonbuild.com" ;
9668 description = "SCons-like build system that use python as a front-end language and Ninja as a building backend" ;
Original file line number Diff line number Diff line change @@ -5,11 +5,6 @@ mesonConfigurePhase() {
55 mesonFlags=" --prefix=$prefix $mesonFlags "
66 fi
77
8- # Build release by default.
9- if [ -n " @isCross@" ]; then
10- crossMesonFlags=" --cross-file=@crossFile@/cross-file.conf"
11- fi
12-
138 # See multiple-outputs.sh and meson’s coredata.py
149 mesonFlags=" \
1510 --libdir=${! outputLib} /lib --libexecdir=${! outputLib} /libexec \
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ in rec {
4949 # Configure Phase
5050 , configureFlags ? [ ]
5151 , cmakeFlags ? [ ]
52+ , mesonFlags ? [ ]
5253 , # Target is not included by default because most programs don't care.
5354 # Including it then would cause needless mass rebuilds.
5455 #
@@ -252,6 +253,34 @@ in rec {
252253 ++ lib . optional ( stdenv . buildPlatform . uname . system != null ) "-DCMAKE_HOST_SYSTEM_NAME=${ stdenv . buildPlatform . uname . system } "
253254 ++ lib . optional ( stdenv . buildPlatform . uname . processor != null ) "-DCMAKE_HOST_SYSTEM_PROCESSOR=${ stdenv . buildPlatform . uname . processor } "
254255 ++ lib . optional ( stdenv . buildPlatform . uname . release != null ) "-DCMAKE_HOST_SYSTEM_VERSION=${ stdenv . buildPlatform . uname . release } " ;
256+
257+ mesonFlags = if mesonFlags == null then null else let
258+ # See https://mesonbuild.com/Reference-tables.html#cpu-families
259+ cpuFamilies = {
260+ aarch64 = "aarch64" ;
261+ armv5tel = "arm" ;
262+ armv6l = "arm" ;
263+ armv7l = "arm" ;
264+ i686 = "x86" ;
265+ x86_64 = "x86_64" ;
266+ } ;
267+ crossFile = builtins . toFile "cross-file.conf" ( ''
268+ [properties]
269+ needs_exe_wrapper = true
270+
271+ [host_machine]
272+ system = '${ stdenv . targetPlatform . parsed . kernel . name } '
273+ cpu_family = '${ cpuFamilies . ${ stdenv . targetPlatform . parsed . cpu . name } } '
274+ cpu = '${ stdenv . targetPlatform . parsed . cpu . name } '
275+ endian = ${ if stdenv . targetPlatform . isLittleEndian then "'little'" else "'big'" }
276+ ''
277+ # TODO should have target prefix too, issue #86077
278+ + ''
279+
280+ [binaries]
281+ pkgconfig = 'pkg-config'
282+ '' ) ;
283+ in [ "--cross-file=${ crossFile } " ] ++ mesonFlags ;
255284 } // lib . optionalAttrs ( attrs . enableParallelBuilding or false ) {
256285 enableParallelChecking = attrs . enableParallelChecking or true ;
257286 } // lib . optionalAttrs ( hardeningDisable != [ ] || hardeningEnable != [ ] ) {
You can’t perform that action at this time.
0 commit comments