3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #93011 from jtojnar/meson-0.55.0

This commit is contained in:
Jan Tojnar 2020-08-04 04:04:50 +02:00 committed by GitHub
commit 5b543ef214
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 72 deletions

View file

@ -1,32 +1,20 @@
{ lib
, python3Packages
, python3
, stdenv
, writeTextDir
, substituteAll
, pkgsHostHost
}:
python3Packages.buildPythonApplication rec {
python3.pkgs.buildPythonApplication rec {
pname = "meson";
version = "0.54.2";
version = "0.55.0";
src = python3Packages.fetchPypi {
src = python3.pkgs.fetchPypi {
inherit pname version;
sha256 = "0m84zb0q67vnxmd6ldz477w6yjdnk9c44xhlwh1g1pzqx3m6wwd7";
sha256 = "Chriv+KuFKxHWTU3+TKQ+3npt3XFW0xTwoK8PKN0WzU=";
};
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 = [
# Upstream insists on not allowing bindir and other dir options
# outside of prefix for some reason:
@ -63,11 +51,27 @@ python3Packages.buildPythonApplication rec {
# workaround until https://github.com/mesonbuild/meson/pull/6512 lands.
depsHostHostPropagated = [ pkgsHostHost.stdenv.cc ];
pythonPath = [
python3.pkgs.setuptools # for pkg_resources
];
# 0.45 update enabled tests but they are failing
doCheck = false;
# 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";

View file

@ -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
@@ -453,6 +453,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')
for arg in args:
if arg.startswith('-Wl,-rpath='):
for dir in arg.replace('-Wl,-rpath=','').split(':'):

View file

@ -4693,7 +4693,7 @@ in {
mesa = callPackage ../development/python-modules/mesa { };
meson = disabledIf (pythonOlder "3.5") (toPythonModule ((pkgs.meson.override {
python3Packages = self;
python3 = python;
}).overrideAttrs(oldAttrs: {
# We do not want the setup hook in Python packages
# because the build is performed differently.