@@ -1,8 +1,10 @@
1−{ system ? builtins.currentSystem }:
1+{ pkgspath ? ../../.., test-pkgspath ? pkgspath }:
3−with import ../../.. { inherit system; };
3+with import pkgspath { system = builtins.currentSystem; };
6+ llvmPackages = llvmPackages_37;
6 coreutils_ = coreutils.override (args: {
8 coreutils_ = coreutils.override (args: {
7 # We want coreutils without ACL support.
9 # We want coreutils without ACL support.
8 aclSupport = false;
10 aclSupport = false;
@@ -19,17 +21,15 @@ rec {
19 buildInputs = [nukeReferences cpio];
21 buildInputs = [nukeReferences cpio];
21 buildCommand = ''
23 buildCommand = ''
22− mkdir -p $out/bin $out/lib
24+ mkdir -p $out/bin $out/lib $out/lib/system
24− # Our (fake) loader
26+ # We're not going to bundle the actual libSystem.dylib; instead we reconstruct it on
25− cp -d ${darwin.dyld}/lib/dyld $out/lib/
27+ # the other side. See the notes in stdenv/darwin/default.nix for more information.
26−
28+ # We also need the .o files for various low-level boot stuff.
27− # C standard library stuff
28− cp -d ${darwin.Libsystem}/lib/*.o $out/lib/
29+ cp -d ${darwin.Libsystem}/lib/*.o $out/lib
29− cp -d ${darwin.Libsystem}/lib/*.dylib $out/lib/
30+ cp -d ${darwin.Libsystem}/lib/system/*.dylib $out/lib/system
31 # Resolv is actually a link to another package, so let's copy it properly
32 # Resolv is actually a link to another package, so let's copy it properly
32− rm $out/lib/libresolv.9.dylib
33 cp -L ${darwin.Libsystem}/lib/libresolv.9.dylib $out/lib
33 cp -L ${darwin.Libsystem}/lib/libresolv.9.dylib $out/lib
35 cp -rL ${darwin.Libsystem}/include $out
35 cp -rL ${darwin.Libsystem}/include $out
@@ -78,11 +78,11 @@ rec {
79 cp -rL ${llvmPackages.clang-unwrapped}/lib/clang $out/lib
79 cp -rL ${llvmPackages.clang-unwrapped}/lib/clang $out/lib
81− cp -d ${libcxx}/lib/libc++*.dylib $out/lib
81+ cp -d ${llvmPackages.libcxx}/lib/libc++*.dylib $out/lib
82− cp -d ${libcxxabi}/lib/libc++abi*.dylib $out/lib
82+ cp -d ${llvmPackages.libcxxabi}/lib/libc++abi*.dylib $out/lib
84 mkdir $out/include
84 mkdir $out/include
85− cp -rd ${libcxx}/include/c++ $out/include
85+ cp -rd ${llvmPackages.libcxx}/include/c++ $out/include
87 cp -d ${icu.out}/lib/libicu*.dylib $out/lib
87 cp -d ${icu.out}/lib/libicu*.dylib $out/lib
88 cp -d ${zlib.out}/lib/libz.* $out/lib
88 cp -d ${zlib.out}/lib/libz.* $out/lib
@@ -107,33 +107,26 @@ rec {
111− # This is clearly a hack. Once we have an install_name_tool-alike that can patch dyld, this will be nicer.
112− ${perl}/bin/perl -i -0777 -pe 's/\/nix\/store\/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-dyld-239\.4\/lib\/dyld/\/usr\/lib\/dyld\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/sg' "$1"
115 # Strip executables even further
110 # Strip executables even further
116 for i in $out/bin/*; do
111 for i in $out/bin/*; do
117 if test -x $i -a ! -L $i; then
112 if test -x $i -a ! -L $i; then
118 chmod +w $i
113 chmod +w $i
121 strip $i || true
114 strip $i || true
125 for i in $out/bin/* $out/lib/*.dylib $out/lib/clang/*/lib/darwin/*.dylib $out/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation; do
118 for i in $out/bin/* $out/lib/*.dylib $out/lib/clang/*/lib/darwin/*.dylib $out/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation; do
126− if test -x $i -a ! -L $i; then
119+ if test -x "$i" -a ! -L "$i"; then
127 echo "Adding rpath to $i"
120 echo "Adding rpath to $i"
128 rpathify $i
121 rpathify $i
132 nuke-refs $out/lib/*
125 nuke-refs $out/lib/*
126+ nuke-refs $out/lib/system/*
133 nuke-refs $out/lib/clang/*/lib/darwin/*
127 nuke-refs $out/lib/clang/*/lib/darwin/*
134 nuke-refs $out/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
128 nuke-refs $out/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
137 mkdir $out/.pack
130 mkdir $out/.pack
138 mv $out/* $out/.pack
131 mv $out/* $out/.pack
139 mv $out/.pack $out/pack
132 mv $out/.pack $out/pack
@@ -148,10 +141,6 @@ rec {
148 strip $out/on-server/*
141 strip $out/on-server/*
149 nuke-refs $out/on-server/*
142 nuke-refs $out/on-server/*
151− for i in $out/on-server/*; do
155 (cd $out/pack && (find | cpio -o -H newc)) | bzip2 > $out/on-server/bootstrap-tools.cpio.bz2
144 (cd $out/pack && (find | cpio -o -H newc)) | bzip2 > $out/on-server/bootstrap-tools.cpio.bz2
@@ -294,8 +283,8 @@ rec {
295 # The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it
284 # The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it
296 test-pkgs = let
285 test-pkgs = let
297− stdenv = import ./. { inherit system bootstrapFiles; };
286+ stdenv = import (test-pkgspath + "/pkgs/stdenv/darwin") { inherit system bootstrapFiles; };
298− in import ../../.. {
287+ in import test-pkgspath {
299 inherit system;
288 inherit system;
300 bootStdenv = stdenv.stdenvDarwin;
289 bootStdenv = stdenv.stdenvDarwin;