Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 33e6ef179028
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: de7594095362
Choose a head ref
  • 5 commits
  • 6 files changed
  • 1 contributor

Commits on Mar 22, 2018

  1. meson: fix rpath fixup

    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. [1]
    
    Previously we have just kept the RPATH produced by the linker, patching
    meson not to remove it. This deprived us of potentially replacing it
    with install_rpath provided by project so we had to re-add it manually,
    and also introduced a vulnerability of keeping build paths in RPATH.
    
    This commit restores the clean-up but modifies it so the items starting
    with /nix/store are retained.
    
    This should be relatively safe since the store is immutable, however,
    there might be some unwanted retainment of build_rpath [2] if it contains
    paths from Nix store.
    
    [1]: #31222 (comment)
    [2]: http://mesonbuild.com/Release-notes-for-0-42-0.html#added-build_rpath-keyword-argument
    jtojnar committed Mar 22, 2018
    Copy the full SHA
    de910a0 View commit details
  2. Copy the full SHA
    9e2639e View commit details
  3. Copy the full SHA
    45d0d90 View commit details
  4. Copy the full SHA
    1c6f150 View commit details
  5. Copy the full SHA
    de75940 View commit details
5 changes: 0 additions & 5 deletions pkgs/applications/backup/deja-dup/default.nix
Original file line number Diff line number Diff line change
@@ -47,11 +47,6 @@ stdenv.mkDerivation rec {
postFixup = ''
# Unwrap accidentally wrapped library
mv $out/libexec/deja-dup/tools/.libduplicity.so-wrapped $out/libexec/deja-dup/tools/libduplicity.so
# Patched meson does not add internal libraries to rpath
for elf in "$out/bin/.deja-dup-wrapped" "$out/libexec/deja-dup/.deja-dup-monitor-wrapped" "$out/libexec/deja-dup/tools/libduplicity.so"; do
patchelf --set-rpath "$(patchelf --print-rpath "$elf"):$out/lib/deja-dup" "$elf"
done
'';

meta = with stdenv.lib; {
7 changes: 0 additions & 7 deletions pkgs/desktops/gnome-3/core/epiphany/default.nix
Original file line number Diff line number Diff line change
@@ -38,13 +38,6 @@ stdenv.mkDerivation rec {
patchShebangs post_install.py
'';

postFixup = ''
# Patched meson does not add internal libraries to rpath
for f in $out/bin/.*-wrapped $out/libexec/.*-wrapped $out/libexec/epiphany/.*-wrapped $out/lib/epiphany/*.so $out/lib/epiphany/web-extensions/*.so; do
patchelf --set-rpath "$out/lib/epiphany:$(patchelf --print-rpath $f)" "$f"
done
'';

meta = with stdenv.lib; {
homepage = https://wiki.gnome.org/Apps/Epiphany;
description = "WebKit based web browser for GNOME";
5 changes: 0 additions & 5 deletions pkgs/desktops/gnome-3/core/gnome-shell/default.nix
Original file line number Diff line number Diff line change
@@ -67,11 +67,6 @@ in stdenv.mkDerivation rec {
glib-compile-schemas $out/share/glib-2.0/schemas
'';

postFixup = ''
# Patched meson does not add internal libraries to rpath
patchelf --set-rpath "$out/lib/gnome-shell:$(patchelf --print-rpath $out/bin/.gnome-shell-wrapped)" $out/bin/.gnome-shell-wrapped
'';

enableParallelBuilding = true;

passthru = {
16 changes: 11 additions & 5 deletions pkgs/development/tools/build-managers/meson/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, python3Packages, stdenv, targetPlatform, writeTextDir, m4 }: let
{ lib, python3Packages, stdenv, targetPlatform, writeTextDir, substituteAll }: let
targetPrefix = lib.optionalString stdenv.isCross
(targetPlatform.config + "-");
in python3Packages.buildPythonApplication rec {
@@ -27,11 +27,17 @@ in python3Packages.buildPythonApplication rec {
# We patch Meson to add a --fallback-library-path argument with
# library install_dir to g-ir-scanner.
./gir-fallback-path.patch
];

postPatch = ''
sed -i -e 's|e.fix_rpath(install_rpath)||' mesonbuild/scripts/meson_install.py
'';
# 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;
})
];

setupHook = ./setup-hook.sh;

32 changes: 32 additions & 0 deletions pkgs/development/tools/build-managers/meson/fix-rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -846,8 +848,10 @@
if paths != '':
paths += ':'
paths += build_rpath
- if len(paths) < len(install_rpath):
- padding = 'X' * (len(install_rpath) - len(paths))
+ store_paths = ':'.join(filter(lambda path: path.startswith('@storeDir@'), paths.split(':')))
+ 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
@@ -300,6 +300,14 @@
return
self.bf.seek(rp_off)
old_rpath = self.read_str()
+
+ if new_rpath:
+ new_rpath += b':'
+ else:
+ new_rpath = b''
+
+ 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
12 changes: 0 additions & 12 deletions pkgs/os-specific/linux/systemd/default.nix
Original file line number Diff line number Diff line change
@@ -201,18 +201,6 @@ in stdenv.mkDerivation rec {

enableParallelBuilding = true;

# The rpath to the shared systemd library is not added by meson. The
# functionality was removed by a nixpkgs patch because it would overwrite
# the existing rpath.
postFixup = ''
sharedLib=libsystemd-shared-${version}.so
for prog in `find $out -type f -executable`; do
(patchelf --print-needed $prog | grep $sharedLib > /dev/null) && (
patchelf --set-rpath `patchelf --print-rpath $prog`:"$out/lib/systemd" $prog
) || true
done
'';

# The interface version prevents NixOS from switching to an
# incompatible systemd at runtime. (Switching across reboots is
# fine, of course.) It should be increased whenever systemd changes