10 name = "test-bootstrap-tools";
12 inherit (stdenv.hostPlatform) system;
14 builder = "${bootstrapTools}/bin/bash";
20 "eval \"$buildCommand\""
23 PATH = lib.makeBinPath [ bootstrapTools ];
25 tools = bootstrapTools;
27 "${stdenv.cc.darwinMinVersionVariable}" = stdenv.cc.darwinMinVersion;
29 # Create a pure environment where we use just what's in the bootstrap tools.
33 for exe in $tools/bin/*; do
34 [[ $exe =~ bunzip2|codesign.*|false|install_name_tool|ld|lipo|pbzx|ranlib|sigtool ]] && continue
35 $exe --version > /dev/null || { echo $exe failed >&2; exit 1; }
38 # run all exes that don't take a --version flag
41 codesign_allocate -i $tools/bin/true -r -o true
43 install_name_tool -id true true
47 # ranlib gets tested bulding hello
51 # The grep will return a nonzero exit code if there is no match, and we want to assert that we have
53 curl --version | grep SSL
55 # The stdenv bootstrap builds the SDK in the bootstrap. Use an existing SDK to test the tools.
56 export SDKROOT='${apple-sdk.sdkroot}'
58 export flags="-idirafter $SDKROOT/usr/include --sysroot=$SDKROOT -L$SDKROOT/usr/lib -L$tools/lib -DTARGET_OS_IPHONE=0"
60 export CPP="clang -E $flags"
61 export CC="clang $flags"
62 export CXX="clang++ $flags --stdlib=libc++ -isystem$tools/include/c++/v1"
64 echo '#include <stdio.h>' >> hello1.c
65 echo '#include <float.h>' >> hello1.c
66 echo '#include <limits.h>' >> hello1.c
67 echo 'int main() { printf("Hello World\n"); return 0; }' >> hello1.c
68 $CC -o $out/bin/hello1 hello1.c
71 echo '#include <iostream>' >> hello3.cc
72 echo 'int main() { std::cout << "Hello World\n"; }' >> hello3.cc
73 $CXX -v -o $out/bin/hello3 hello3.cc
76 # test that libc++.dylib rpaths are correct so it can reference libc++abi.dylib when linked.
77 # using -Wl,-flat_namespace is required to generate an error
79 ln -s $tools/lib/libc++.dylib libtest/
80 clang++ -Wl,-flat_namespace -idirafter $SDKROOT/usr/include -isystem$tools/include/c++/v1 \
81 --sysroot=$SDKROOT -L$SDKROOT/usr/lib -L./libtest -L$PWD/libSystem-boot hello3.cc
85 # hello configure detects -liconv is needed but doesn't add to the link step
86 LDFLAGS=-liconv ./configure --prefix=$out