11 name = "test-bootstrap-tools";
12 inherit (stdenv.hostPlatform) system; # We cannot "cross test"
18 "eval \"$buildCommand\""
23 export PATH=${bootstrapTools}/bin
38 + lib.optionalString (stdenv.hostPlatform.libc == "glibc") ''
39 rtld=$(echo ${bootstrapTools}/lib/${builtins.unsafeDiscardStringContext # only basename
40 (builtins.baseNameOf binutils.dynamicLinker)})
41 libc_includes=${bootstrapTools}/include-glibc
43 + lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
44 rtld=$(echo ${bootstrapTools}/lib/ld-musl*.so.?)
45 libc_includes=${bootstrapTools}/include-libc
48 # path to version-specific libraries, like libstdc++.so
49 cxx_libs=$(echo ${bootstrapTools}/lib/gcc/*/*)
50 export CPP="cpp -idirafter $libc_includes -B${bootstrapTools}"
51 export CC="gcc -idirafter $libc_includes -B${bootstrapTools} -Wl,-dynamic-linker,$rtld -Wl,-rpath,${bootstrapTools}/lib -Wl,-rpath,$cxx_libs"
52 export CXX="g++ -idirafter $libc_includes -B${bootstrapTools} -Wl,-dynamic-linker,$rtld -Wl,-rpath,${bootstrapTools}/lib -Wl,-rpath,$cxx_libs"
54 echo '#include <stdio.h>' >> foo.c
55 echo '#include <limits.h>' >> foo.c
56 echo 'int main() { printf("Hello World\\n"); return 0; }' >> foo.c
57 $CC -o $out/bin/foo foo.c
60 echo '#include <iostream>' >> bar.cc
61 echo 'int main() { std::cout << "Hello World\\n"; }' >> bar.cc
62 $CXX -v -o $out/bin/bar bar.cc
67 ./configure --prefix=$out