diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix index 395e71049b5b..d0306dd33a49 100644 --- a/pkgs/development/tools/build-managers/meson/default.nix +++ b/pkgs/development/tools/build-managers/meson/default.nix @@ -1,4 +1,5 @@ { lib +, stdenv , fetchpatch , installShellFiles , ninja @@ -7,6 +8,10 @@ , zlib , coreutils , substituteAll +, Foundation +, OpenGL +, AppKit +, Cocoa }: python3.pkgs.buildPythonApplication rec { @@ -70,12 +75,19 @@ python3.pkgs.buildPythonApplication rec { url = "https://github.com/mesonbuild/meson/commit/a38ad3039d0680f3ac34a6dc487776c79c48acf3.patch"; hash = "sha256-9YaXwc+F3Pw4BjuOXqva4MD6DAxX1k5WLbn0xzwuEmw="; }) - ]; + ] + # Nixpkgs cctools does not have bitcode support. + ++ lib.optional stdenv.isDarwin ./disable-bitcode.patch; + + postPatch = if stdenv.isDarwin then '' + rm -r 'test cases/osx/7 bitcode' + '' else null; setupHook = ./setup-hook.sh; nativeCheckInputs = [ ninja pkg-config ]; - checkInputs = [ zlib ]; + checkInputs = [ zlib ] + ++ lib.optionals stdenv.isDarwin [ Foundation OpenGL AppKit Cocoa ]; checkPhase = '' patchShebangs "test cases" substituteInPlace "test cases/native/8 external program shebang parsing/script.int.in" \ diff --git a/pkgs/development/tools/build-managers/meson/disable-bitcode.patch b/pkgs/development/tools/build-managers/meson/disable-bitcode.patch new file mode 100644 index 000000000000..a72997c10439 --- /dev/null +++ b/pkgs/development/tools/build-managers/meson/disable-bitcode.patch @@ -0,0 +1,24 @@ +--- a/mesonbuild/compilers/mixins/clang.py ++++ b/mesonbuild/compilers/mixins/clang.py +@@ -56,10 +56,6 @@ class ClangCompiler(GnuLikeCompiler): + {OptionKey('b_colorout'), OptionKey('b_lto_threads'), OptionKey('b_lto_mode'), OptionKey('b_thinlto_cache'), + OptionKey('b_thinlto_cache_dir')}) + +- # TODO: this really should be part of the linker base_options, but +- # linkers don't have base_options. +- if isinstance(self.linker, AppleDynamicLinker): +- self.base_options.add(OptionKey('b_bitcode')) + # All Clang backends can also do LLVM IR + self.can_compile_suffixes.add('ll') + +--- a/mesonbuild/linkers/linkers.py ++++ b/mesonbuild/linkers/linkers.py +@@ -785,7 +785,7 @@ class AppleDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): + return self._apply_prefix('-headerpad_max_install_names') + + def bitcode_args(self) -> T.List[str]: +- return self._apply_prefix('-bitcode_bundle') ++ raise MesonException('Nixpkgs cctools does not support bitcode bundles') + + def fatal_warnings(self) -> T.List[str]: + return self._apply_prefix('-fatal_warnings') diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9e52fc20371b..85501531761a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5121,7 +5121,9 @@ with pkgs; merriweather-sans = callPackage ../data/fonts/merriweather-sans { }; - meson = callPackage ../development/tools/build-managers/meson { }; + meson = callPackage ../development/tools/build-managers/meson { + inherit (darwin.apple_sdk.frameworks) Foundation OpenGL AppKit Cocoa; + }; # while building documentation meson may want to run binaries for host # which needs an emulator