about summary refs log tree commit diff
path: root/nixpkgs/pkgs/stdenv/darwin/portable-libsystem.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/stdenv/darwin/portable-libsystem.sh')
-rw-r--r--nixpkgs/pkgs/stdenv/darwin/portable-libsystem.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/stdenv/darwin/portable-libsystem.sh b/nixpkgs/pkgs/stdenv/darwin/portable-libsystem.sh
new file mode 100644
index 000000000000..f50ccc8d32ee
--- /dev/null
+++ b/nixpkgs/pkgs/stdenv/darwin/portable-libsystem.sh
@@ -0,0 +1,12 @@
+# 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
+}