33let
44
55 useLLVM = stdenv . hostPlatform . useLLVM or false ;
6- isDarwin = stdenv . hostPlatform . isDarwin ;
6+ isNewDarwinBootstrap = stdenv . hostPlatform . isDarwin && stdenv . hostPlatform . isAarch64 ;
77 bareMetal = stdenv . hostPlatform . parsed . kernel . name == "none" ;
88 haveLibc = stdenv . cc . libc != null ;
99 inherit ( stdenv . hostPlatform ) isMusl ;
@@ -25,19 +25,19 @@ stdenv.mkDerivation {
2525 "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
2626 "-DCMAKE_C_COMPILER_TARGET=${ stdenv . hostPlatform . config } "
2727 "-DCMAKE_ASM_COMPILER_TARGET=${ stdenv . hostPlatform . config } "
28- ] ++ lib . optionals ( useLLVM || isDarwin || bareMetal || isMusl ) [
28+ ] ++ lib . optionals ( useLLVM || bareMetal || isMusl || isNewDarwinBootstrap ) [
2929 "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
3030 "-DCOMPILER_RT_BUILD_XRAY=OFF"
3131 "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
3232 "-DCOMPILER_RT_BUILD_PROFILE=OFF"
33- ] ++ lib . optionals ( ( useLLVM || isDarwin || bareMetal ) && ! haveLibc ) [
33+ ] ++ lib . optionals ( ! haveLibc || bareMetal ) [
3434 "-DCMAKE_C_COMPILER_WORKS=ON"
3535 "-DCMAKE_CXX_COMPILER_WORKS=ON"
3636 "-DCOMPILER_RT_BAREMETAL_BUILD=ON"
3737 "-DCMAKE_SIZEOF_VOID_P=${ toString ( stdenv . hostPlatform . parsed . cpu . bits / 8 ) } "
38- ] ++ lib . optionals ( ( useLLVM || isDarwin ) && ! haveLibc ) [
38+ ] ++ lib . optionals ( ! haveLibc ) [
3939 "-DCMAKE_C_FLAGS=-nodefaultlibs"
40- ] ++ lib . optionals ( useLLVM || isDarwin ) [
40+ ] ++ lib . optionals ( useLLVM || isNewDarwinBootstrap ) [
4141 "-DCOMPILER_RT_BUILD_BUILTINS=ON"
4242 #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
4343 "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
@@ -62,7 +62,7 @@ stdenv.mkDerivation {
6262 ++ lib . optional stdenv . hostPlatform . isAarch32 ./armv7l.patch ;
6363
6464
65- preConfigure = lib . optionalString isDarwin ''
65+ preConfigure = lib . optionalString stdenv . hostPlatform . isDarwin ''
6666 cmakeFlagsArray+=("-DCMAKE_LIPO=$(command -v ${ stdenv . cc . targetPrefix } lipo)")
6767 '' ;
6868
0 commit comments