···28 };
2930 patches = [
31- # Meson is currently inspecting fewer variables than autoconf does, which
32- # makes it harder for us to use setup hooks, etc. Taken from
33- # https://github.com/mesonbuild/meson/pull/6827
34- ./more-env-vars.patch
35-36- # Unlike libtool, vanilla Meson does not pass any information
37- # about the path library will be installed to to g-ir-scanner,
38- # breaking the GIR when path other than ${!outputLib}/lib is used.
39- # We patch Meson to add a --fallback-library-path argument with
40- # library install_dir to g-ir-scanner.
41- ./gir-fallback-path.patch
42-43- # In common distributions, RPATH is only needed for internal libraries so
44 # meson removes everything else. With Nix, the locations of libraries
45 # are not as predictable, therefore we need to keep them in the RPATH.
46 # At the moment we are keeping the paths starting with /nix/store.
47 # https://github.com/NixOS/nixpkgs/issues/31222#issuecomment-365811634
48 (substituteAll {
49- src = ./fix-rpath.patch;
50 inherit (builtins) storeDir;
51 })
52···56 # But this can cause much bigger problem for Nix as it can produce
57 # cut-in-half-by-\0 store path references.
58 # Let’s just clear the whole rpath and hope for the best.
59- ./clear-old-rpath.patch
0000000000006061 # Patch out default boost search paths to avoid impure builds on
62 # unsandboxed non-NixOS builds, see:
63 # https://github.com/NixOS/nixpkgs/issues/86131#issuecomment-711051774
64- ./boost-Do-not-add-system-paths-on-nix.patch
6566 # Nixpkgs cctools does not have bitcode support.
67- ./disable-bitcode.patch
6869 # Fix passing multiple --define-variable arguments to pkg-config.
70 # https://github.com/mesonbuild/meson/pull/10670
71 (fetchpatch {
72 url = "https://github.com/mesonbuild/meson/commit/d5252c5d4cf1c1931fef0c1c98dd66c000891d21.patch";
73- sha256 = "GiUNVul1N5Fl8mfqM7vA/r1FdKqImiDYLXMVDt77gvw=";
74 excludes = [
75 "docs/yaml/objects/dep.yaml"
76 ];
77 })
78 ];
7980- setupHook = ./setup-hook.sh;
008182- nativeCheckInputs = [ ninja pkg-config ];
83- checkInputs = [ zlib ]
84- ++ lib.optionals stdenv.isDarwin [ Foundation OpenGL AppKit Cocoa ];
85- checkPhase = ''
86- runHook preCheck
8788- patchShebangs 'test cases'
89- substituteInPlace 'test cases/native/8 external program shebang parsing/script.int.in' \
90- --replace /usr/bin/env ${coreutils}/bin/env
0000000000000000000000091 # requires git, creating cyclic dependency
92- rm -r 'test cases/common/66 vcstag'
93 # requires glib, creating cyclic dependency
94- rm -r 'test cases/linuxlike/6 subdir include order'
95- rm -r 'test cases/linuxlike/9 compiler checks with dependencies'
96 # requires static zlib, see #66461
97- rm -r 'test cases/linuxlike/14 static dynamic linkage'
98 # Nixpkgs cctools does not have bitcode support.
99- rm -r 'test cases/osx/7 bitcode'
100- HOME="$TMPDIR" python ./run_project_tests.py
0000101102- runHook postCheck
00103 '';
104105 postFixup = ''
···117 --replace "python3 -c " "${python3.interpreter} -c "
118 '';
119120- buildInputs = lib.optionals (python3.pythonOlder "3.9") [
121- libxcrypt
122- ];
123-124- nativeBuildInputs = [ installShellFiles ];
125-126- postInstall = ''
127- installShellCompletion --zsh data/shell-completions/zsh/_meson
128- installShellCompletion --bash data/shell-completions/bash/meson
129- '';
130131- meta = with lib; {
132 homepage = "https://mesonbuild.com";
133 description = "An open source, fast and friendly build system made in Python";
134 longDescription = ''
···140 second spent waiting for the build system to actually start compiling
141 code.
142 '';
143- license = licenses.asl20;
144- maintainers = with maintainers; [ mbe AndersonTorres ];
145 inherit (python3.meta) platforms;
146 };
147}
···28 };
2930 patches = [
31+ # In typical distributions, RPATH is only needed for internal libraries so
00000000000032 # meson removes everything else. With Nix, the locations of libraries
33 # are not as predictable, therefore we need to keep them in the RPATH.
34 # At the moment we are keeping the paths starting with /nix/store.
35 # https://github.com/NixOS/nixpkgs/issues/31222#issuecomment-365811634
36 (substituteAll {
37+ src = ./001-fix-rpath.patch;
38 inherit (builtins) storeDir;
39 })
40···44 # But this can cause much bigger problem for Nix as it can produce
45 # cut-in-half-by-\0 store path references.
46 # Let’s just clear the whole rpath and hope for the best.
47+ ./002-clear-old-rpath.patch
48+49+ # Meson is currently inspecting fewer variables than autoconf does, which
50+ # makes it harder for us to use setup hooks, etc.
51+ # https://github.com/mesonbuild/meson/pull/6827
52+ ./003-more-env-vars.patch
53+54+ # Unlike libtool, vanilla Meson does not pass any information about the path
55+ # library will be installed to to g-ir-scanner, breaking the GIR when path
56+ # other than ${!outputLib}/lib is used.
57+ # We patch Meson to add a --fallback-library-path argument with library
58+ # install_dir to g-ir-scanner.
59+ ./004-gir-fallback-path.patch
6061 # Patch out default boost search paths to avoid impure builds on
62 # unsandboxed non-NixOS builds, see:
63 # https://github.com/NixOS/nixpkgs/issues/86131#issuecomment-711051774
64+ ./005-boost-Do-not-add-system-paths-on-nix.patch
6566 # Nixpkgs cctools does not have bitcode support.
67+ ./006-disable-bitcode.patch
6869 # Fix passing multiple --define-variable arguments to pkg-config.
70 # https://github.com/mesonbuild/meson/pull/10670
71 (fetchpatch {
72 url = "https://github.com/mesonbuild/meson/commit/d5252c5d4cf1c1931fef0c1c98dd66c000891d21.patch";
73+ hash = "sha256-GiUNVul1N5Fl8mfqM7vA/r1FdKqImiDYLXMVDt77gvw=";
74 excludes = [
75 "docs/yaml/objects/dep.yaml"
76 ];
77 })
78 ];
7980+ buildInputs = lib.optionals (python3.pythonOlder "3.9") [
81+ libxcrypt
82+ ];
8384+ nativeBuildInputs = [ installShellFiles ];
00008586+ nativeCheckInputs = [
87+ ninja
88+ pkg-config
89+ ];
90+91+ checkInputs = [
92+ zlib
93+ ]
94+ ++ lib.optionals stdenv.isDarwin [
95+ AppKit
96+ Cocoa
97+ Foundation
98+ OpenGL
99+ ];
100+101+ checkPhase = lib.concatStringsSep "\n" ([
102+ "runHook preCheck"
103+ ''
104+ patchShebangs 'test cases'
105+ substituteInPlace \
106+ 'test cases/native/8 external program shebang parsing/script.int.in' \
107+ --replace /usr/bin/env ${coreutils}/bin/env
108+ ''
109+ ]
110+ # Remove problematic tests
111+ ++ (builtins.map (f: ''rm -vr "${f}";'') [
112 # requires git, creating cyclic dependency
113+ ''test cases/common/66 vcstag''
114 # requires glib, creating cyclic dependency
115+ ''test cases/linuxlike/6 subdir include order''
116+ ''test cases/linuxlike/9 compiler checks with dependencies''
117 # requires static zlib, see #66461
118+ ''test cases/linuxlike/14 static dynamic linkage''
119 # Nixpkgs cctools does not have bitcode support.
120+ ''test cases/osx/7 bitcode''
121+ ])
122+ ++ [
123+ ''HOME="$TMPDIR" python ./run_project_tests.py''
124+ "runHook postCheck"
125+ ]);
126127+ postInstall = ''
128+ installShellCompletion --zsh data/shell-completions/zsh/_meson
129+ installShellCompletion --bash data/shell-completions/bash/meson
130 '';
131132 postFixup = ''
···144 --replace "python3 -c " "${python3.interpreter} -c "
145 '';
146147+ setupHook = ./setup-hook.sh;
000000000148149+ meta = {
150 homepage = "https://mesonbuild.com";
151 description = "An open source, fast and friendly build system made in Python";
152 longDescription = ''
···158 second spent waiting for the build system to actually start compiling
159 code.
160 '';
161+ license = lib.licenses.asl20;
162+ maintainers = with lib.maintainers; [ AndersonTorres ];
163 inherit (python3.meta) platforms;
164 };
165}