@@ -24,6 +24,8 @@ assert crossSystem == localSystem;
24
24
let
25
25
inherit ( localSystem ) system platform ;
26
26
27
+ bootstrapClangVersion = "7.1.0" ;
28
+
27
29
commonImpureHostDeps = [
28
30
"/bin/sh"
29
31
"/usr/lib/libSystem.B.dylib"
@@ -90,7 +92,18 @@ in rec {
90
92
inherit shell ;
91
93
inherit ( last ) stdenvNoCC ;
92
94
93
- extraPackages = [ ] ;
95
+ extraPackages = [
96
+ # last.pkgs.llvmPackages_7.libcxxabi # TODO: is this required? if not, why not?
97
+ last . pkgs . llvmPackages_7 . compiler-rt
98
+ ] ;
99
+
100
+ extraBuildCommands = ''
101
+ rsrc="$out/resource-root"
102
+ mkdir "$rsrc"
103
+ ln -s "${ bootstrapTools } /lib/clang/${ bootstrapClangVersion } /include" "$rsrc"
104
+ ln -s "${ last . pkgs . llvmPackages_7 . compiler-rt . out } /lib" "$rsrc/lib"
105
+ echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
106
+ '' ;
94
107
95
108
nativeTools = false ;
96
109
nativeLibc = false ;
@@ -180,6 +193,15 @@ in rec {
180
193
ln -s ${ bootstrapTools } /lib/libc++abi.dylib $out/lib/libc++abi.dylib
181
194
'' ;
182
195
} ;
196
+
197
+ compiler-rt = stdenv . mkDerivation {
198
+ name = "bootstrap-stage0-compiler-rt" ;
199
+ buildCommand = ''
200
+ mkdir -p $out/lib
201
+ ln -s ${ bootstrapTools } /lib/libclang_rt* $out/lib
202
+ ln -s ${ bootstrapTools } /lib/darwin $out/lib/darwin
203
+ '' ;
204
+ } ;
183
205
} ;
184
206
} ;
185
207
@@ -198,6 +220,12 @@ in rec {
198
220
python3 = super . python3Minimal ;
199
221
200
222
ninja = super . ninja . override { buildDocs = false ; } ;
223
+
224
+ llvmPackages_7 = super . llvmPackages_7 // ( let
225
+ libraries = super . llvmPackages_7 . libraries . extend ( _ : _ : {
226
+ inherit ( llvmPackages_7 ) compiler-rt ;
227
+ } ) ;
228
+ in { inherit libraries ; } // libraries ) ;
201
229
} ;
202
230
in with prevStage ; stageFun 1 prevStage {
203
231
extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${ bootstrapTools } /Library/Frameworks\" " ;
@@ -206,7 +234,9 @@ in rec {
206
234
libcxx = pkgs . libcxx ;
207
235
208
236
allowedRequisites =
209
- [ bootstrapTools ] ++ ( with pkgs ; [ libcxx libcxxabi ] ) ++ [ pkgs . darwin . Libsystem ] ;
237
+ [ bootstrapTools ] ++
238
+ ( with pkgs ; [ libcxx libcxxabi llvmPackages_7 . compiler-rt ] ) ++
239
+ ( with pkgs . darwin ; [ Libsystem ] ) ;
210
240
211
241
overrides = persistent ;
212
242
} ;
@@ -220,6 +250,12 @@ in rec {
220
250
findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils
221
251
libssh2 nghttp2 libkrb5 ninja ;
222
252
253
+ llvmPackages_7 = super . llvmPackages_7 // ( let
254
+ libraries = super . llvmPackages_7 . libraries . extend ( _ : _ : {
255
+ inherit ( llvmPackages_7 ) compiler-rt ;
256
+ } ) ;
257
+ in { inherit libraries ; } // libraries ) ;
258
+
223
259
darwin = super . darwin // {
224
260
inherit ( darwin )
225
261
dyld Libsystem xnu configd ICU libdispatch libclosure launchd CF ;
@@ -237,8 +273,8 @@ in rec {
237
273
allowedRequisites =
238
274
[ bootstrapTools ] ++
239
275
( with pkgs ; [
240
- xz . bin xz . out libcxx libcxxabi zlib libxml2 . out curl . out openssl . out libssh2 . out
241
- nghttp2 . lib libkrb5
276
+ xz . bin xz . out libcxx libcxxabi llvmPackages_7 . compiler-rt zlib
277
+ libxml2 . out curl . out openssl . out libssh2 . out nghttp2 . lib libkrb5
242
278
] ) ++
243
279
( with pkgs . darwin ; [ dyld Libsystem CF ICU locale ] ) ;
244
280
@@ -287,8 +323,8 @@ in rec {
287
323
allowedRequisites =
288
324
[ bootstrapTools ] ++
289
325
( with pkgs ; [
290
- xz . bin xz . out bash libcxx libcxxabi zlib libxml2 . out curl . out openssl . out libssh2 . out
291
- nghttp2 . lib libkrb5
326
+ xz . bin xz . out bash libcxx libcxxabi llvmPackages_7 . compiler-rt zlib
327
+ libxml2 . out curl . out openssl . out libssh2 . out nghttp2 . lib libkrb5
292
328
] ) ++
293
329
( with pkgs . darwin ; [ dyld ICU Libsystem locale ] ) ;
294
330
0 commit comments