Skip to content

Commit

Permalink
mk-aggregated: prepend rpath instead of setting it
Browse files Browse the repository at this point in the history
The original binary may have outstanding RPATH, eg. to libgcc_s, which
must be kept.
  • Loading branch information
oxalica committed Jun 3, 2024
1 parent 711ff40 commit 025e174
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/mk-aggregated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ symlinkJoin {
[[ $file != */*clippy* ]] || cp --remove-destination "$(realpath -e $file)" $file
chmod +w $file
${lib.optionalString stdenv.isLinux ''
patchelf --set-rpath $out/lib "$file" || true
if prev_rpath="$(patchelf --print-rpath "$file")"; then
patchelf --set-rpath "$out/lib''${prev_rpath:+:}$prev_rpath" "$file"
fi
''}
${lib.optionalString stdenv.isDarwin ''
install_name_tool -add_rpath $out/lib "$file" || true
Expand Down

0 comments on commit 025e174

Please sign in to comment.