autogen: fix patchelf invocation to remove generic build path from rpath

Co-authored-by: Ryan Burns <rtburns@protonmail.com>
This commit is contained in:
Simone Mosciatti 2020-12-12 17:31:50 +01:00 committed by Ryan Burns
parent 0fe6e98a78
commit efbeb4ee5b

View File

@ -79,9 +79,9 @@ stdenv.mkDerivation rec {
done
'' + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
# remove /build/** from RPATHs
# remove build directory (/build/**, or /tmp/nix-build-**) from RPATHs
for f in "$bin"/bin/*; do
local nrp="$(patchelf --print-rpath "$f" | sed -E 's@(:|^)/build/[^:]*:@\1@g')"
local nrp="$(patchelf --print-rpath "$f" | sed -E 's@(:|^)'$NIX_BUILD_TOP'[^:]*:@\1@g')"
patchelf --set-rpath "$nrp" "$f"
done
'';