darwin.stdenv: fix portable libsystem hook with sandboxing

When sandboxing is enabled, the hook tries to run `install_name_tool`
and fails because the system one is inaccessible. Having it use
`targetPrefix` allows it to find and use the cross-install_name_tool.
This commit is contained in:
Randy Eckenrode 2023-07-08 18:57:24 -06:00
parent 94c52940c4
commit feb89eed00
No known key found for this signature in database
GPG key ID: 64C1CD4EC2A600D9
2 changed files with 2 additions and 1 deletions

View file

@ -105,6 +105,7 @@ rec {
name = "darwin-portable-libSystem-hook";
substitutions = {
libsystem = "${stdenv.cc.libc}/lib/libSystem.B.dylib";
targetPrefix = stdenv.cc.bintools.targetPrefix;
};
} ./darwin/portable-libsystem.sh)
];

View file

@ -7,6 +7,6 @@ fixupOutputHooks+=('fixLibsystemRefs $prefix')
fixLibsystemRefs() {
if [ -d "$1/bin" ]; then
find "$1/bin" -exec \
install_name_tool -change @libsystem@ /usr/lib/libSystem.B.dylib {} \;
@targetPrefix@install_name_tool -change @libsystem@ /usr/lib/libSystem.B.dylib {} \;
fi
}