about summary refs log tree commit diff
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-07-16 01:06:43 +0200
committeraszlig <aszlig@nix.build>2018-07-16 01:52:28 +0200
commitf1fbf818c4a94c67fcdb171ba00f1fef4a0aef2a (patch)
tree91c308929962f59bfe6d8d1e1db52151d4c5044a
parentf4e510302f9282ea66afe55ae6167fd6adf37e73 (diff)
downloadnixlib-f1fbf818c4a94c67fcdb171ba00f1fef4a0aef2a.tar
nixlib-f1fbf818c4a94c67fcdb171ba00f1fef4a0aef2a.tar.gz
nixlib-f1fbf818c4a94c67fcdb171ba00f1fef4a0aef2a.tar.bz2
nixlib-f1fbf818c4a94c67fcdb171ba00f1fef4a0aef2a.tar.lz
nixlib-f1fbf818c4a94c67fcdb171ba00f1fef4a0aef2a.tar.xz
nixlib-f1fbf818c4a94c67fcdb171ba00f1fef4a0aef2a.tar.zst
nixlib-f1fbf818c4a94c67fcdb171ba00f1fef4a0aef2a.zip
autoPatchelfHook: Run after patchelf's setup hook
So far the runtimeDependencies variable has been rather useless unless
you also set dontPatchelf, because the patchelf setup hook ran *after*
the autoPatchelfHook and thus stripped off the additional RPATHs added
using runtimeDependencies.

I did this by moving the autoPatchelfHook to be run in postFixup instead
of fixupOutput, however I needed to replicate the for loop that runs the
hook on all outputs.

Until we have a way to influence order of execution for hooks I've
marked this with an XXX so that we can use fixupOutput again.

Tested this against all packages that use autoPatchelfHook using the
following and checking whether the output contains any errors concerning
shared libraries:

nix-build -E 'with import ./. { config.allowUnfree = true; };
  runCommand "test-executables" {
    drvs = [
      masterpdfeditor franz zoom-us anydesk teamviewer maxx
      oracle-instantclient cups-kyodialog3 virtlyst powershell
    ];
  } "for i in $drvs; do for b in $i/bin/*; do \"$b\" || :; done; done"
'

Signed-off-by: aszlig <aszlig@nix.build>
Fixes: https://github.com/NixOS/nixpkgs/issues/43082
Cc: @Ericson2314
-rw-r--r--pkgs/build-support/setup-hooks/auto-patchelf.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.sh b/pkgs/build-support/setup-hooks/auto-patchelf.sh
index f40cdcf4cadf..32fdb1000e27 100644
--- a/pkgs/build-support/setup-hooks/auto-patchelf.sh
+++ b/pkgs/build-support/setup-hooks/auto-patchelf.sh
@@ -172,4 +172,14 @@ autoPatchelf() {
     done
 }
 
-fixupOutputHooks+=(autoPatchelf)
+# XXX: This should ultimately use fixupOutputHooks but we currently don't have
+# a way to enforce the order. If we have $runtimeDependencies set, the setup
+# hook of patchelf is going to ruin everything and strip out those additional
+# RPATHs.
+#
+# So what we do here is basically run in postFixup and emulate the same
+# behaviour as fixupOutputHooks because the setup hook for patchelf is run in
+# fixupOutput and the postFixup hook runs later.
+postFixupHooks+=(
+    'for output in $outputs; do prefix="${!output}" autoPatchelf; done'
+)