parent
23f24c95d7
commit
41d9dfb619
@ -1,40 +0,0 @@ |
||||
From 536108b10271f2f42d41c7d9ddb4ce2ea1851f4f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= <mail@nh2.me>
|
||||
Date: Sat, 17 Oct 2020 19:27:08 +0200
|
||||
Subject: [PATCH] boost: Do not add system paths on nix
|
||||
|
||||
---
|
||||
mesonbuild/dependencies/boost.py | 17 +----------------
|
||||
1 file changed, 1 insertion(+), 16 deletions(-)
|
||||
|
||||
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py
|
||||
index 907c0c275..ecaf11b18 100644
|
||||
--- a/mesonbuild/dependencies/boost.py
|
||||
+++ b/mesonbuild/dependencies/boost.py
|
||||
@@ -643,22 +643,7 @@ class BoostDependency(ExternalDependency):
|
||||
roots += [x for x in candidates if x.name.lower().startswith('boost') and x.is_dir()]
|
||||
else:
|
||||
tmp = [] # type: T.List[Path]
|
||||
-
|
||||
- # Homebrew
|
||||
- brew_boost = Path('/usr/local/Cellar/boost')
|
||||
- if brew_boost.is_dir():
|
||||
- tmp += [x for x in brew_boost.iterdir()]
|
||||
-
|
||||
- # Add some default system paths
|
||||
- tmp += [Path('/opt/local')]
|
||||
- tmp += [Path('/usr/local/opt/boost')]
|
||||
- tmp += [Path('/usr/local')]
|
||||
- tmp += [Path('/usr')]
|
||||
-
|
||||
- # Cleanup paths
|
||||
- tmp = [x for x in tmp if x.is_dir()]
|
||||
- tmp = [x.resolve() for x in tmp]
|
||||
- roots += tmp
|
||||
+ # Do not add any non-explicit paths on nix
|
||||
|
||||
return roots
|
||||
|
||||
--
|
||||
2.25.4
|
||||
|
@ -1,94 +0,0 @@ |
||||
{ lib |
||||
, python3 |
||||
, writeTextDir |
||||
, substituteAll |
||||
, fetchpatch |
||||
, installShellFiles |
||||
}: |
||||
|
||||
python3.pkgs.buildPythonApplication rec { |
||||
pname = "meson"; |
||||
version = "0.57.1"; |
||||
|
||||
src = python3.pkgs.fetchPypi { |
||||
inherit pname version; |
||||
sha256 = "19n8alcpzv6npgp27iqljkmvdmr7s2c7zm8y997j1nlvpa1cgqbj"; |
||||
}; |
||||
|
||||
patches = [ |
||||
# Upstream insists on not allowing bindir and other dir options |
||||
# outside of prefix for some reason: |
||||
# https://github.com/mesonbuild/meson/issues/2561 |
||||
# We remove the check so multiple outputs can work sanely. |
||||
./allow-dirs-outside-of-prefix.patch |
||||
|
||||
# Meson is currently inspecting fewer variables than autoconf does, which |
||||
# makes it harder for us to use setup hooks, etc. Taken from |
||||
# https://github.com/mesonbuild/meson/pull/6827 |
||||
./more-env-vars.patch |
||||
|
||||
# Unlike libtool, vanilla Meson does not pass any information |
||||
# about the path library will be installed to to g-ir-scanner, |
||||
# breaking the GIR when path other than ${!outputLib}/lib is used. |
||||
# We patch Meson to add a --fallback-library-path argument with |
||||
# library install_dir to g-ir-scanner. |
||||
./gir-fallback-path.patch |
||||
|
||||
# In common distributions, RPATH is only needed for internal libraries so |
||||
# meson removes everything else. With Nix, the locations of libraries |
||||
# are not as predictable, therefore we need to keep them in the RPATH. |
||||
# At the moment we are keeping the paths starting with /nix/store. |
||||
# https://github.com/NixOS/nixpkgs/issues/31222#issuecomment-365811634 |
||||
(substituteAll { |
||||
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 |
||||
|
||||
# Patch out default boost search paths to avoid impure builds on |
||||
# unsandboxed non-NixOS builds, see: |
||||
# https://github.com/NixOS/nixpkgs/issues/86131#issuecomment-711051774 |
||||
./boost-Do-not-add-system-paths-on-nix.patch |
||||
]; |
||||
|
||||
setupHook = ./setup-hook.sh; |
||||
|
||||
# 0.45 update enabled tests but they are failing |
||||
doCheck = false; |
||||
# checkInputs = [ ninja pkg-config ]; |
||||
# 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 |
||||
''; |
||||
|
||||
nativeBuildInputs = [ installShellFiles ]; |
||||
|
||||
postInstall = '' |
||||
installShellCompletion --zsh data/shell-completions/zsh/_meson |
||||
installShellCompletion --bash data/shell-completions/bash/meson |
||||
''; |
||||
|
||||
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"; |
||||
license = licenses.asl20; |
||||
maintainers = with maintainers; [ jtojnar mbe ]; |
||||
platforms = platforms.all; |
||||
}; |
||||
} |
@ -1,16 +0,0 @@ |
||||
--- a/mesonbuild/modules/gnome.py
|
||||
+++ b/mesonbuild/modules/gnome.py
|
||||
@@ -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])))
|
||||
+
|
||||
+ fallback_libpath = girtargets[0].get_custom_install_dir()[0]
|
||||
+ if fallback_libpath is not None and isinstance(fallback_libpath, str) and len(fallback_libpath) > 0 and fallback_libpath[0] == "/":
|
||||
+ scan_command += ['--fallback-library-path=' + fallback_libpath]
|
||||
+
|
||||
scan_target = self._make_gir_target(state, girfile, scan_command, depends, kwargs)
|
||||
|
||||
typelib_output = '%s-%s.typelib' % (ns, nsversion)
|
@ -1,13 +0,0 @@ |
||||
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
|
||||
index 756dd8193..a5cc6ef8b 100644
|
||||
--- a/mesonbuild/environment.py
|
||||
+++ b/mesonbuild/environment.py
|
||||
@@ -151,7 +151,7 @@ def _get_env_var(for_machine: MachineChoice, is_cross: bool, var_name: str) -> T
|
||||
# compiling we fall back on the unprefixed host version. This
|
||||
# allows native builds to never need to worry about the 'BUILD_*'
|
||||
# ones.
|
||||
- ([var_name + '_FOR_BUILD'] if is_cross else [var_name]),
|
||||
+ [var_name + '_FOR_BUILD'] + ([] if is_cross else [var_name]),
|
||||
# Always just the unprefixed host verions
|
||||
[var_name]
|
||||
)[for_machine]
|
@ -1,19 +0,0 @@ |
||||
--- a/mesonbuild/coredata.py
|
||||
+++ b/mesonbuild/coredata.py
|
||||
@@ -506,7 +506,6 @@ class CoreData:
|
||||
return value
|
||||
if option.name.endswith('dir') and value.is_absolute() and \
|
||||
option not in BULITIN_DIR_NOPREFIX_OPTIONS:
|
||||
- # Value must be a subdir of the prefix
|
||||
# commonpath will always return a path in the native format, so we
|
||||
# must use pathlib.PurePath to do the same conversion before
|
||||
# comparing.
|
||||
@@ -518,7 +517,7 @@ class CoreData:
|
||||
try:
|
||||
value = value.relative_to(prefix)
|
||||
except ValueError:
|
||||
- raise MesonException(msg.format(option, value, prefix))
|
||||
+ pass
|
||||
if '..' in str(value):
|
||||
raise MesonException(msg.format(option, value, prefix))
|
||||
return value.as_posix()
|
@ -1,20 +0,0 @@ |
||||
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')
|
@ -1,24 +0,0 @@ |
||||
--- 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
|
||||
+
|
||||
+ 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
|
||||
+
|
||||
# Match rpath formats:
|
||||
# -Wl,-rpath=
|
||||
# -Wl,-rpath,
|
@ -1,37 +0,0 @@ |
||||
mesonConfigurePhase() { |
||||
runHook preConfigure |
||||
|
||||
if [ -z "${dontAddPrefix-}" ]; then |
||||
mesonFlags="--prefix=$prefix $mesonFlags" |
||||
fi |
||||
|
||||
# See multiple-outputs.sh and meson’s coredata.py |
||||
mesonFlags="\ |
||||
--libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec \ |
||||
--bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin \ |
||||
--includedir=${!outputInclude}/include \ |
||||
--mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info \ |
||||
--localedir=${!outputLib}/share/locale \ |
||||
-Dauto_features=${mesonAutoFeatures:-enabled} \ |
||||
-Dwrap_mode=${mesonWrapMode:-nodownload} \ |
||||
$mesonFlags" |
||||
|
||||
mesonFlags="${crossMesonFlags+$crossMesonFlags }--buildtype=${mesonBuildType:-plain} $mesonFlags" |
||||
|
||||
echo "meson flags: $mesonFlags ${mesonFlagsArray[@]}" |
||||
|
||||
meson build $mesonFlags "${mesonFlagsArray[@]}" |
||||
cd build |
||||
|
||||
if ! [[ -v enableParallelBuilding ]]; then |
||||
enableParallelBuilding=1 |
||||
echo "meson: enabled parallel building" |
||||
fi |
||||
|
||||
runHook postConfigure |
||||
} |
||||
|
||||
if [ -z "${dontUseMesonConfigure-}" -a -z "${configurePhase-}" ]; then |
||||
setOutputFlags= |
||||
configurePhase=mesonConfigurePhase |
||||
fi |
Loading…
Reference in new issue