darwin/make-bootstrap-tools: remove references to old libSystem

This commit is contained in:
Andrew Childs 2020-09-09 09:50:35 +09:00
parent 16075a712c
commit 47c770e0e6

View File

@ -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"