Merge pull request #124228 from thefloweringash/bootstrap-rpath

darwin/make-bootstrap-tools: move "lib" from install name to rpath
This commit is contained in:
Jonathan Ringer 2021-05-26 00:31:54 -07:00 committed by GitHub
commit 0115297f24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,9 +136,7 @@ in rec {
local libs=$(${stdenv.cc.targetPrefix}otool -L "$1" | tail -n +2 | grep -o "$NIX_STORE.*-\S*") || true
local newlib
for lib in $libs; do
newlib=''${lib:${toString (storePrefixLen + 1)}}
newlib=''${newlib#*/}
${stdenv.cc.targetPrefix}install_name_tool -change $lib "@rpath/$newlib" "$1"
${stdenv.cc.targetPrefix}install_name_tool -change $lib "@rpath/$(basename "$lib")" "$1"
done
}
@ -160,7 +158,7 @@ in rec {
for i in $out/bin/*; do
if test -x "$i" -a ! -L "$i" -a "$(basename $i)" != codesign; then
echo "Adding @executable_path to rpath in $i"
${stdenv.cc.targetPrefix}install_name_tool -add_rpath '@executable_path/..' $i
${stdenv.cc.targetPrefix}install_name_tool -add_rpath '@executable_path/../lib' $i
fi
done