git.iko.soy/typeable/nixpkgs
on master help sign in
darwin.make-bootstrap-tools: fix for new stdenv setup
commit5dadc3a30c5f7385f849af62ee6cf63bd5b2a592 authorDan Peebles <pumpkin@me.com> dateThu 13 Oct 2016, 22:32 (10 years ago) parent09e4b78
1 file changed+18−29
pkgs/stdenv/darwin/make-bootstrap-tools.nix+18−29
pkgs/stdenv/darwin/make-bootstrap-tools.nix+18−29
@@ -1,8 +1,10 @@
1−{ system ? builtins.currentSystem }:
1+{ pkgspath ? ../../.., test-pkgspath ? pkgspath }:
22
3−with import ../../.. { inherit system; };
3+with import pkgspath { system = builtins.currentSystem; };
44
5−rec {
5+let
6+ llvmPackages = llvmPackages_37;
7+in rec {
68 coreutils_ = coreutils.override (args: {
79 # We want coreutils without ACL support.
810 aclSupport = false;
@@ -19,17 +21,15 @@ rec {
1921 buildInputs = [nukeReferences cpio];
2022
2123 buildCommand = ''
22− mkdir -p $out/bin $out/lib
24+ mkdir -p $out/bin $out/lib $out/lib/system
2325
24− # Our (fake) loader
25− cp -d ${darwin.dyld}/lib/dyld $out/lib/
26−
27− # C standard library stuff
28− cp -d ${darwin.Libsystem}/lib/*.o $out/lib/
29− cp -d ${darwin.Libsystem}/lib/*.dylib $out/lib/
26+ # We're not going to bundle the actual libSystem.dylib; instead we reconstruct it on
27+ # the other side. See the notes in stdenv/darwin/default.nix for more information.
28+ # We also need the .o files for various low-level boot stuff.
29+ cp -d ${darwin.Libsystem}/lib/*.o $out/lib
30+ cp -d ${darwin.Libsystem}/lib/system/*.dylib $out/lib/system
3031
3132 # Resolv is actually a link to another package, so let's copy it properly
32− rm $out/lib/libresolv.9.dylib
3333 cp -L ${darwin.Libsystem}/lib/libresolv.9.dylib $out/lib
3434
3535 cp -rL ${darwin.Libsystem}/include $out
@@ -78,11 +78,11 @@ rec {
7878
7979 cp -rL ${llvmPackages.clang-unwrapped}/lib/clang $out/lib
8080
81− cp -d ${libcxx}/lib/libc++*.dylib $out/lib
82− cp -d ${libcxxabi}/lib/libc++abi*.dylib $out/lib
81+ cp -d ${llvmPackages.libcxx}/lib/libc++*.dylib $out/lib
82+ cp -d ${llvmPackages.libcxxabi}/lib/libc++abi*.dylib $out/lib
8383
8484 mkdir $out/include
85− cp -rd ${libcxx}/include/c++ $out/include
85+ cp -rd ${llvmPackages.libcxx}/include/c++ $out/include
8686
8787 cp -d ${icu.out}/lib/libicu*.dylib $out/lib
8888 cp -d ${zlib.out}/lib/libz.* $out/lib
@@ -107,33 +107,26 @@ rec {
107107 done
108108 }
109109
110− fix_dyld() {
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"
113− }
114−
115110 # Strip executables even further
116111 for i in $out/bin/*; do
117112 if test -x $i -a ! -L $i; then
118113 chmod +w $i
119−
120− fix_dyld $i
121114 strip $i || true
122115 fi
123116 done
124117
125118 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
127120 echo "Adding rpath to $i"
128121 rpathify $i
129122 fi
130123 done
131124
132125 nuke-refs $out/lib/*
126+ nuke-refs $out/lib/system/*
133127 nuke-refs $out/lib/clang/*/lib/darwin/*
134128 nuke-refs $out/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
135129
136− set -x
137130 mkdir $out/.pack
138131 mv $out/* $out/.pack
139132 mv $out/.pack $out/pack
@@ -148,10 +141,6 @@ rec {
148141 strip $out/on-server/*
149142 nuke-refs $out/on-server/*
150143
151− for i in $out/on-server/*; do
152− fix_dyld $i
153− done
154−
155144 (cd $out/pack && (find | cpio -o -H newc)) | bzip2 > $out/on-server/bootstrap-tools.cpio.bz2
156145 '';
157146
@@ -294,8 +283,8 @@ rec {
294283
295284 # The ultimate test: bootstrap a whole stdenv from the tools specified above and get a package set out of it
296285 test-pkgs = let
297− stdenv = import ./. { inherit system bootstrapFiles; };
298− in import ../../.. {
286+ stdenv = import (test-pkgspath + "/pkgs/stdenv/darwin") { inherit system bootstrapFiles; };
287+ in import test-pkgspath {
299288 inherit system;
300289 bootStdenv = stdenv.stdenvDarwin;
301290 };