nixpkgs/pkgs/stdenv/darwin/portable-libsystem.sh
Matthew Bauer 0b8574540b stdenv/darwin: fix portable libsystem hook
Some packages don’t have /bin directories. We should only run
install_name_tool if that directory exists.
2018-12-05 12:56:12 -06:00

12 lines
407 B
Bash

# Make /nix/store/...-libSystem “portable” for static built binaries.
# This just rewrites everything in $1/bin to use the
# /usr/lib/libSystem.B.dylib that is provided on every macOS system.
fixupOutputHooks+=('fixLibsystemRefs $prefix')
fixLibsystemRefs() {
if [ -d "$1/bin" ]; then
find "$1/bin" -exec \
install_name_tool -change @libsystem@ /usr/lib/libSystem.B.dylib {} \;
fi
}