Merge pull request #214046 from stephank/fix/meson

[staging-next] meson: fix checks on darwin
This commit is contained in:
Nick Cao 2023-02-03 09:18:11 +08:00 committed by GitHub
commit e2c729d56d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 3 deletions

View File

@ -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" \

View File

@ -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')

View File

@ -5124,7 +5124,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