summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorAndrew Childs <lorne@cons.org.nz>2020-09-09 09:50:35 +0900
committerAndrew Childs <lorne@cons.org.nz>2020-11-12 16:57:19 +0900
commit47c770e0e603f5db7dc3daafcb2dba14fd2300bc (patch)
tree7fd9124839de6cbdcf8b0ab80fc8c79927b23c89 /pkgs/stdenv
parent16075a712c867d2ecc74d0ccfdcf831b2c7dd9b5 (diff)
downloadnixpkgs-47c770e0e603f5db7dc3daafcb2dba14fd2300bc.tar
nixpkgs-47c770e0e603f5db7dc3daafcb2dba14fd2300bc.tar.gz
nixpkgs-47c770e0e603f5db7dc3daafcb2dba14fd2300bc.tar.bz2
nixpkgs-47c770e0e603f5db7dc3daafcb2dba14fd2300bc.tar.lz
nixpkgs-47c770e0e603f5db7dc3daafcb2dba14fd2300bc.tar.xz
nixpkgs-47c770e0e603f5db7dc3daafcb2dba14fd2300bc.tar.zst
nixpkgs-47c770e0e603f5db7dc3daafcb2dba14fd2300bc.zip
darwin/make-bootstrap-tools: remove references to old libSystem
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/darwin/make-bootstrap-tools.nix53
1 files changed, 15 insertions, 38 deletions
diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix
index 31e12963937..1243b96e505 100644
--- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix
@@ -28,11 +28,8 @@ in rec {
     buildCommand = ''
       mkdir -p $out/bin $out/lib $out/lib/system
 
-      # We're not going to bundle the actual libSystem.dylib; instead we reconstruct it on
-      # the other side. See the notes in stdenv/darwin/default.nix for more information.
-      # We also need the .o files for various low-level boot stuff.
+      # Copy libSystem's .o files for various low-level boot stuff.
       cp -d ${darwin.Libsystem}/lib/*.o $out/lib
-      cp -d ${darwin.Libsystem}/lib/system/*.dylib $out/lib/system
 
       # Resolv is actually a link to another package, so let's copy it properly
       cp -L ${darwin.Libsystem}/lib/libresolv.9.dylib $out/lib
@@ -208,39 +205,6 @@ in rec {
         fi
       done
 
-      install_name_tool \
-        -id $out/lib/system/libsystem_c.dylib \
-        $out/lib/system/libsystem_c.dylib
-
-      install_name_tool \
-        -id $out/lib/system/libsystem_kernel.dylib \
-        $out/lib/system/libsystem_kernel.dylib
-
-      # TODO: this logic basically duplicates similar logic in the Libsystem expression. Deduplicate them!
-      libs=$(cat $reexportedLibrariesFile | grep -v '^#')
-
-      for i in $libs; do
-        if [ "$i" != "/usr/lib/system/libsystem_kernel.dylib" ] && [ "$i" != "/usr/lib/system/libsystem_c.dylib" ]; then
-          args="$args -reexport_library $i"
-        fi
-      done
-
-      ld -macosx_version_min 10.7 \
-         -arch x86_64 \
-         -dylib \
-         -o $out/lib/libSystem.B.dylib \
-         -compatibility_version 1.0 \
-         -current_version 1226.10.1 \
-         -reexport_library $out/lib/system/libsystem_c.dylib \
-         -reexport_library $out/lib/system/libsystem_kernel.dylib \
-         $args
-
-      ln -s libSystem.B.dylib $out/lib/libSystem.dylib
-
-      for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.10.4 gcc_s.10.5; do
-        ln -s libSystem.dylib $out/lib/lib$name.dylib
-      done
-
       ln -s libresolv.9.dylib $out/lib/libresolv.dylib
 
       for i in $out/lib/*.dylib $out/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation; do
@@ -309,7 +273,20 @@ in rec {
 
       ${build}/on-server/sh -c 'echo Hello World'
 
-      export flags="-idirafter ${unpack}/include-Libsystem --sysroot=${unpack} -L${unpack}/lib"
+      # This approximates a bootstrap version of libSystem can that be
+      # assembled via fetchurl. Adapted from main libSystem expression.
+      mkdir libSystem-boot
+      cp -vr \
+        ${darwin.darwin-stubs}/usr/lib/libSystem.B.tbd \
+        ${darwin.darwin-stubs}/usr/lib/system \
+        libSystem-boot
+
+      substituteInPlace libSystem-boot/libSystem.B.tbd \
+        --replace "/usr/lib/system/" "$PWD/libSystem-boot/system/"
+      ln -s libSystem.B.tbd libSystem-boot/libSystem.tbd
+      # End of bootstrap libSystem
+
+      export flags="-idirafter ${unpack}/include-Libsystem --sysroot=${unpack} -L${unpack}/lib -L$PWD/libSystem-boot"
 
       export CPP="clang -E $flags"
       export CC="clang $flags -Wl,-rpath,${unpack}/lib -Wl,-v -Wl,-sdk_version,10.10"