diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/build-managers/meson')
6 files changed, 82 insertions, 78 deletions
diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch b/nixpkgs/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch index bd81efd52085..e5ac95d0b9dc 100644 --- a/nixpkgs/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch +++ b/nixpkgs/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch @@ -1,6 +1,6 @@ --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py -@@ -483,7 +483,6 @@ class CoreData: +@@ -491,7 +491,6 @@ class CoreData: return value if option.endswith('dir') and value.is_absolute() and \ option not in builtin_dir_noprefix_options: @@ -8,7 +8,7 @@ # commonpath will always return a path in the native format, so we # must use pathlib.PurePath to do the same conversion before # comparing. -@@ -495,7 +494,7 @@ class CoreData: +@@ -503,7 +502,7 @@ class CoreData: try: value = value.relative_to(prefix) except ValueError: diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch b/nixpkgs/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch new file mode 100644 index 000000000000..f1e3c76e8b53 --- /dev/null +++ b/nixpkgs/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch @@ -0,0 +1,20 @@ +diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py +index 4176b9a03..faaabf616 100644 +--- a/mesonbuild/scripts/depfixer.py ++++ b/mesonbuild/scripts/depfixer.py +@@ -336,6 +336,15 @@ class Elf(DataSizes): + if not new_rpath: + self.remove_rpath_entry(entrynum) + else: ++ # Clear old rpath to avoid stale references, ++ # not heeding the warning above about de-duplication ++ # since it does not seem to cause issues for us ++ # and not doing so trips up Nix’s reference checker. ++ # See https://github.com/NixOS/nixpkgs/pull/46020 ++ # and https://github.com/NixOS/nixpkgs/issues/95163 ++ self.bf.seek(rp_off) ++ self.bf.write(b'\0'*len(old_rpath)) ++ + self.bf.seek(rp_off) + self.bf.write(new_rpath) + self.bf.write(b'\0') diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/default.nix b/nixpkgs/pkgs/development/tools/build-managers/meson/default.nix index 5b1266da3823..aa11ba7638bb 100644 --- a/nixpkgs/pkgs/development/tools/build-managers/meson/default.nix +++ b/nixpkgs/pkgs/development/tools/build-managers/meson/default.nix @@ -1,33 +1,29 @@ { lib -, python3Packages +, python3 , stdenv , writeTextDir , substituteAll , pkgsHostHost +, fetchpatch }: -python3Packages.buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "meson"; - version = "0.54.2"; + version = "0.55.1"; - src = python3Packages.fetchPypi { + src = python3.pkgs.fetchPypi { inherit pname version; - sha256 = "0m84zb0q67vnxmd6ldz477w6yjdnk9c44xhlwh1g1pzqx3m6wwd7"; + sha256 = "O1dB+ITgSSi9+hlHRn/wavpsmOYjwlzvda33HKOc4IA="; }; - postFixup = '' - pushd $out/bin - # undo shell wrapper as meson tools are called with python - for i in *; do - mv ".$i-wrapped" "$i" - done - popd - - # Do not propagate Python - rm $out/nix-support/propagated-build-inputs - ''; - patches = [ + # Meson 0.55.0 incorrectly considers skipped tests as failures, + # which makes some packages like gjs fail to build. + (fetchpatch { + url = "https://github.com/mesonbuild/meson/commit/7db49db67d4aa7582cf46feb7157235e66aa95b1.diff"; + sha256 = "1chq52sgk24afdlswssr8n8p6fa2wz8rjlxvkjhpqg1kg3qnqc9p"; + }) + # Upstream insists on not allowing bindir and other dir options # outside of prefix for some reason: # https://github.com/mesonbuild/meson/issues/2561 @@ -55,6 +51,14 @@ python3Packages.buildPythonApplication rec { src = ./fix-rpath.patch; inherit (builtins) storeDir; }) + + # When Meson removes build_rpath from DT_RUNPATH entry, it just writes + # the shorter NUL-terminated new rpath over the old one to reduce + # the risk of potentially breaking the ELF files. + # But this can cause much bigger problem for Nix as it can produce + # cut-in-half-by-\0 store path references. + # Let’s just clear the whole rpath and hope for the best. + ./clear-old-rpath.patch ]; setupHook = ./setup-hook.sh; @@ -68,6 +72,18 @@ python3Packages.buildPythonApplication rec { # checkInputs = [ ninja pkgconfig ]; # checkPhase = "python ./run_project_tests.py"; + postFixup = '' + pushd $out/bin + # undo shell wrapper as meson tools are called with python + for i in *; do + mv ".$i-wrapped" "$i" + done + popd + + # Do not propagate Python + rm $out/nix-support/propagated-build-inputs + ''; + meta = with lib; { homepage = "https://mesonbuild.com"; description = "SCons-like build system that use python as a front-end language and Ninja as a building backend"; diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch b/nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch index 6cf7afc2bdf3..d34b6c4c4345 100644 --- a/nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch +++ b/nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch @@ -1,56 +1,24 @@ ---- a/mesonbuild/linkers.py -+++ b/mesonbuild/linkers.py -@@ -527,8 +527,10 @@ class GnuLikeDynamicLinkerMixin: - # In order to avoid relinking for RPATH removal, the binary needs to contain just - # enough space in the ELF header to hold the final installation RPATH. - paths = ':'.join(all_paths) -- if len(paths) < len(install_rpath): -- padding = 'X' * (len(install_rpath) - len(paths)) -+ store_paths = ':'.join(filter(lambda path: path.startswith('@storeDir@'), all_paths)) -+ extra_space_needed = len(install_rpath + (':' if install_rpath and store_paths else '') + store_paths) - len(paths) -+ if extra_space_needed > 0: -+ padding = 'X' * extra_space_needed - if not paths: - paths = padding - else: -@@ -902,8 +904,10 @@ class SolarisDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): - # In order to avoid relinking for RPATH removal, the binary needs to contain just - # enough space in the ELF header to hold the final installation RPATH. - paths = ':'.join(all_paths) -- if len(paths) < len(install_rpath): -- padding = 'X' * (len(install_rpath) - len(paths)) -+ store_paths = ':'.join(filter(lambda path: path.startswith('@storeDir@'), all_paths)) -+ extra_space_needed = len(install_rpath + (':' if install_rpath and store_paths else '') + store_paths) - len(paths) -+ if extra_space_needed > 0: -+ padding = 'X' * extra_space_needed - if not paths: - paths = padding - else: ---- a/mesonbuild/scripts/depfixer.py -+++ b/mesonbuild/scripts/depfixer.py -@@ -303,6 +303,14 @@ class Elf(DataSizes): - return - self.bf.seek(rp_off) - old_rpath = self.read_str() +--- a/mesonbuild/backend/backends.py ++++ b/mesonbuild/backend/backends.py +@@ -456,6 +456,21 @@ class Backend: + args.extend(self.environment.coredata.get_external_link_args(target.for_machine, lang)) + except Exception: + pass + -+ if new_rpath: -+ new_rpath += b':' -+ else: -+ new_rpath = b'' ++ nix_ldflags = os.environ.get('NIX_LDFLAGS', '').split() ++ next_is_path = False ++ # Try to add rpaths set by user or ld-wrapper so that they are not removed. ++ # Based on https://github.com/NixOS/nixpkgs/blob/69711a2f5ffe8cda208163be5258266172ff527f/pkgs/build-support/bintools-wrapper/ld-wrapper.sh#L148-L177 ++ for flag in nix_ldflags: ++ if flag == '-rpath' or flag == '-L': ++ next_is_path = True ++ elif next_is_path or flag.startswith('-L/'): ++ if flag.startswith('-L/'): ++ flag = flag[2:] ++ if flag.startswith('@storeDir@'): ++ dirs.add(flag) ++ next_is_path = False + -+ new_rpath += b':'.join(filter(lambda path: path.startswith(b'@storeDir@'), old_rpath.split(b':'))) -+ - if len(old_rpath) < len(new_rpath): - sys.exit("New rpath must not be longer than the old one.") - # The linker does read-only string deduplication. If there is a -@@ -316,6 +324,10 @@ class Elf(DataSizes): - if not new_rpath: - self.remove_rpath_entry(entrynum) - else: -+ # clean old rpath to avoid stale references -+ # (see https://github.com/NixOS/nixpkgs/pull/46020) -+ self.bf.seek(rp_off) -+ self.bf.write(b'\0'*len(old_rpath)) - self.bf.seek(rp_off) - self.bf.write(new_rpath) - self.bf.write(b'\0') + # Match rpath formats: + # -Wl,-rpath= + # -Wl,-rpath, diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch b/nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch index e59795486aa8..0c924bacf73f 100644 --- a/nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch +++ b/nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch @@ -1,8 +1,8 @@ --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py -@@ -801,6 +801,13 @@ class GnomeModule(ExtensionModule): - scan_command += ['--sources-top-dirs', os.path.join(state.environment.get_source_dir(), self.interpreter.subproject_dir, state.subproject)] - scan_command += ['--sources-top-dirs', os.path.join(state.environment.get_build_dir(), self.interpreter.subproject_dir, state.subproject)] +@@ -807,6 +807,13 @@ class GnomeModule(ExtensionModule): + if fatal_warnings: + scan_command.append('--warn-error') + if len(set([girtarget.get_custom_install_dir()[0] for girtarget in girtargets])) > 1: + raise MesonException('generate_gir tries to build multiple libraries with different install_dir at once: {}'.format(','.join([str(girtarget) for girtarget in girtargets]))) diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/more-env-vars.patch b/nixpkgs/pkgs/development/tools/build-managers/meson/more-env-vars.patch index 6326f5ec3cfb..ada58fff6d41 100644 --- a/nixpkgs/pkgs/development/tools/build-managers/meson/more-env-vars.patch +++ b/nixpkgs/pkgs/development/tools/build-managers/meson/more-env-vars.patch @@ -1,8 +1,8 @@ diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py -index 17058df6b..7a68b7f15 100644 +index 219b62ec8..e3ceaddbd 100644 --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py -@@ -120,7 +120,7 @@ def get_env_var_pair(for_machine: MachineChoice, +@@ -94,7 +94,7 @@ def get_env_var_pair(for_machine: MachineChoice, # compiling we fall back on the unprefixed host version. This # allows native builds to never need to worry about the 'BUILD_*' # ones. |