mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-11-06 18:26:45 +01:00
treewide: Try to make a few bootstrapping things more consistent
- Introduce `preLibcCrossHeaders` to bootstrap libgcc and compiler-rt the same way. - Organize LLVM bintools as `bintools{-unwrapped,,NoLibc}` for consistency with GNU Binutils and Apple's cctools. - Do Android changes for all `llvmPackages` for consistency. - Improve the way the default GCC and LLVM versions are selected.
This commit is contained in:
parent
e0d3c9d031
commit
37194a325d
|
@ -4,14 +4,15 @@ let
|
|||
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
|
||||
haveLibc = stdenv.cc.libc != null;
|
||||
inherit (stdenv.hostPlatform) isMusl;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "compiler-rt";
|
||||
stdenv.mkDerivation {
|
||||
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
|
||||
inherit version;
|
||||
src = fetch pname "1yjqjri753w0fzmxcyz687nvd97sbc9rsqrxzpq720na47hwh3fr";
|
||||
src = fetch "compiler-rt" "1yjqjri753w0fzmxcyz687nvd97sbc9rsqrxzpq720na47hwh3fr";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm.dev ];
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
@ -29,14 +30,15 @@ stdenv.mkDerivation rec {
|
|||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
] ++ lib.optionals (useLLVM || bareMetal) [
|
||||
] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||
] ++ lib.optionals (useLLVM && !haveLibc) [
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
] ++ lib.optionals (useLLVM) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
|
@ -58,7 +60,6 @@ stdenv.mkDerivation rec {
|
|||
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
||||
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
||||
|
@ -88,5 +89,4 @@ stdenv.mkDerivation rec {
|
|||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
|
||||
, gccForLibs, preLibcCrossHeaders
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
|
@ -93,7 +94,16 @@ let
|
|||
# doesn’t support like LLVM. Probably we should move to some other
|
||||
# file.
|
||||
|
||||
bintools = callPackage ./bintools.nix {};
|
||||
bintools-unwrapped = callPackage ./bintools {};
|
||||
|
||||
bintoolsNoLibc = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
libc = preLibcCrossHeaders;
|
||||
};
|
||||
|
||||
bintools = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
};
|
||||
|
||||
lldClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
|
@ -112,6 +122,8 @@ let
|
|||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) ''
|
||||
echo "-lunwind" >> $out/nix-support/cc-ldflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
|
@ -120,9 +132,7 @@ let
|
|||
lldClangNoLibcxx = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -136,10 +146,7 @@ let
|
|||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -152,26 +159,43 @@ let
|
|||
lldClangNoCompilerRt = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
libraries = lib.makeExtensible (libraries: let
|
||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
in {
|
||||
|
||||
compiler-rt = callPackage ./compiler-rt ({} //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
|
||||
}));
|
||||
compiler-rt-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
# N.B. condition is safe because without useLLVM both are the same.
|
||||
compiler-rt = if stdenv.hostPlatform.isAndroid
|
||||
then libraries.compiler-rt-libc
|
||||
else libraries.compiler-rt-no-libc;
|
||||
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
||||
|
||||
|
|
|
@ -4,14 +4,15 @@ let
|
|||
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
|
||||
haveLibc = stdenv.cc.libc != null;
|
||||
inherit (stdenv.hostPlatform) isMusl;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "compiler-rt";
|
||||
stdenv.mkDerivation {
|
||||
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
|
||||
inherit version;
|
||||
src = fetch pname "0x1j8ngf1zj63wlnns9vlibafq48qcm72p4jpaxkmkb4qw0grwfy";
|
||||
src = fetch "compiler-rt" "0x1j8ngf1zj63wlnns9vlibafq48qcm72p4jpaxkmkb4qw0grwfy";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm.dev ];
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
@ -29,14 +30,15 @@ stdenv.mkDerivation rec {
|
|||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
] ++ lib.optionals (useLLVM || bareMetal) [
|
||||
] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||
] ++ lib.optionals (useLLVM && !haveLibc) [
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
] ++ lib.optionals (useLLVM) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
|
@ -59,7 +61,6 @@ stdenv.mkDerivation rec {
|
|||
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
||||
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
||||
|
@ -91,5 +92,4 @@ stdenv.mkDerivation rec {
|
|||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
|
||||
, gccForLibs, preLibcCrossHeaders
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
|
@ -94,7 +95,16 @@ let
|
|||
# doesn’t support like LLVM. Probably we should move to some other
|
||||
# file.
|
||||
|
||||
bintools = callPackage ./bintools.nix {};
|
||||
bintools-unwrapped = callPackage ./bintools {};
|
||||
|
||||
bintoolsNoLibc = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
libc = preLibcCrossHeaders;
|
||||
};
|
||||
|
||||
bintools = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
};
|
||||
|
||||
lldClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
|
@ -113,6 +123,8 @@ let
|
|||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) ''
|
||||
echo "-lunwind" >> $out/nix-support/cc-ldflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
|
@ -121,9 +133,7 @@ let
|
|||
lldClangNoLibcxx = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -137,10 +147,7 @@ let
|
|||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -153,26 +160,43 @@ let
|
|||
lldClangNoCompilerRt = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
libraries = lib.makeExtensible (libraries: let
|
||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
in {
|
||||
|
||||
compiler-rt = callPackage ./compiler-rt ({} //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
|
||||
}));
|
||||
compiler-rt-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
# N.B. condition is safe because without useLLVM both are the same.
|
||||
compiler-rt = if stdenv.hostPlatform.isAndroid
|
||||
then libraries.compiler-rt-libc
|
||||
else libraries.compiler-rt-no-libc;
|
||||
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ let
|
|||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation {
|
||||
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
|
||||
inherit version;
|
||||
src = fetch "compiler-rt" "0d444qihq9jhqnfv003cr704v363va72zl6qaw2algj1c85cva45";
|
||||
|
@ -61,7 +61,6 @@ stdenv.mkDerivation rec {
|
|||
]# ++ lib.optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch
|
||||
++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
|
||||
|
||||
|
||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
||||
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
|
||||
, gccForLibs, preLibcCrossHeaders
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
|
@ -112,7 +113,16 @@ let
|
|||
# doesn’t support like LLVM. Probably we should move to some other
|
||||
# file.
|
||||
|
||||
bintools = callPackage ./bintools {};
|
||||
bintools-unwrapped = callPackage ./bintools {};
|
||||
|
||||
bintoolsNoLibc = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
libc = preLibcCrossHeaders;
|
||||
};
|
||||
|
||||
bintools = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
};
|
||||
|
||||
lldClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
|
@ -141,9 +151,7 @@ let
|
|||
lldClangNoLibcxx = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -157,10 +165,7 @@ let
|
|||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -173,10 +178,7 @@ let
|
|||
lldClangNoCompilerRt = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
|
@ -186,9 +188,7 @@ let
|
|||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
@ -199,15 +199,19 @@ let
|
|||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
in {
|
||||
|
||||
compiler-rt-libc = callPackage ./compiler-rt ({ inherit llvm_meta; } //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc;
|
||||
}));
|
||||
compiler-rt-libc = callPackage ./compiler-rt {
|
||||
inherit llvm_meta;
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
compiler-rt-no-libc = callPackage ./compiler-rt ({ inherit llvm_meta; } //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
|
||||
}));
|
||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||
inherit llvm_meta;
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
# N.B. condition is safe because without useLLVM both are the same.
|
||||
compiler-rt = if stdenv.hostPlatform.isAndroid
|
||||
|
|
|
@ -4,12 +4,13 @@ let
|
|||
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
|
||||
haveLibc = stdenv.cc.libc != null;
|
||||
inherit (stdenv.hostPlatform) isMusl;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "compiler-rt";
|
||||
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
|
||||
inherit version;
|
||||
src = fetch "compiler-rt" "1n48p8gjarihkws0i2bay5w9bdwyxyxxbpwyng7ba58jb30dlyq5";
|
||||
|
||||
|
@ -29,14 +30,15 @@ stdenv.mkDerivation {
|
|||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
] ++ lib.optionals (useLLVM || bareMetal) [
|
||||
] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||
] ++ lib.optionals (useLLVM && !haveLibc) [
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
] ++ lib.optionals (useLLVM) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
|
@ -83,10 +85,9 @@ stdenv.mkDerivation {
|
|||
postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
|
||||
ln -s "$out/lib"/*/* "$out/lib"
|
||||
'' + lib.optionalString (useLLVM) ''
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/linux/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
|
||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
|
||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
|
||||
, gccForLibs, preLibcCrossHeaders
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
|
@ -95,7 +96,16 @@ let
|
|||
# doesn’t support like LLVM. Probably we should move to some other
|
||||
# file.
|
||||
|
||||
bintools = callPackage ./bintools.nix {};
|
||||
bintools-unwrapped = callPackage ./bintools {};
|
||||
|
||||
bintoolsNoLibc = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
libc = preLibcCrossHeaders;
|
||||
};
|
||||
|
||||
bintools = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
};
|
||||
|
||||
lldClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
|
@ -114,6 +124,8 @@ let
|
|||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) ''
|
||||
echo "-lunwind" >> $out/nix-support/cc-ldflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
|
@ -122,9 +134,7 @@ let
|
|||
lldClangNoLibcxx = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -138,10 +148,7 @@ let
|
|||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -154,28 +161,44 @@ let
|
|||
lldClangNoCompilerRt = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
libraries = lib.makeExtensible (libraries: let
|
||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
in {
|
||||
|
||||
compiler-rt = callPackage ./compiler-rt {
|
||||
compiler-rt-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
# N.B. condition is safe because without useLLVM both are the same.
|
||||
compiler-rt = if stdenv.hostPlatform.isAndroid
|
||||
then libraries.compiler-rt-libc
|
||||
else libraries.compiler-rt-no-libc;
|
||||
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
||||
|
||||
libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
|
||||
|
|
|
@ -4,12 +4,13 @@ let
|
|||
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
|
||||
haveLibc = stdenv.cc.libc != null;
|
||||
inherit (stdenv.hostPlatform) isMusl;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "compiler-rt";
|
||||
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
|
||||
inherit version;
|
||||
src = fetch "compiler-rt" "0dqqf8f930l8gag4d9qjgn1n0pj0nbv2anviqqhdi1rkhas8z0hi";
|
||||
|
||||
|
@ -29,14 +30,15 @@ stdenv.mkDerivation {
|
|||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
] ++ lib.optionals (useLLVM || bareMetal) [
|
||||
] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||
] ++ lib.optionals (useLLVM && !haveLibc) [
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
] ++ lib.optionals (useLLVM) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
|
@ -88,5 +90,4 @@ stdenv.mkDerivation {
|
|||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
|
||||
, gccForLibs, preLibcCrossHeaders
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
|
@ -96,7 +97,16 @@ let
|
|||
# doesn’t support like LLVM. Probably we should move to some other
|
||||
# file.
|
||||
|
||||
bintools = callPackage ./bintools.nix {};
|
||||
bintools-unwrapped = callPackage ./bintools {};
|
||||
|
||||
bintoolsNoLibc = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
libc = preLibcCrossHeaders;
|
||||
};
|
||||
|
||||
bintools = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
};
|
||||
|
||||
lldClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
|
@ -115,6 +125,8 @@ let
|
|||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) ''
|
||||
echo "-lunwind" >> $out/nix-support/cc-ldflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
|
@ -123,9 +135,7 @@ let
|
|||
lldClangNoLibcxx = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -139,10 +149,7 @@ let
|
|||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -155,26 +162,43 @@ let
|
|||
lldClangNoCompilerRt = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
libraries = lib.makeExtensible (libraries: let
|
||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
in {
|
||||
|
||||
compiler-rt = callPackage ./compiler-rt ({} //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
|
||||
}));
|
||||
compiler-rt-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
# N.B. condition is safe because without useLLVM both are the same.
|
||||
compiler-rt = if stdenv.hostPlatform.isAndroid
|
||||
then libraries.compiler-rt-libc
|
||||
else libraries.compiler-rt-no-libc;
|
||||
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
||||
|
||||
|
|
|
@ -4,14 +4,15 @@ let
|
|||
|
||||
useLLVM = stdenv.hostPlatform.useLLVM or false;
|
||||
bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
|
||||
haveLibc = stdenv.cc.libc != null;
|
||||
inherit (stdenv.hostPlatform) isMusl;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "compiler-rt";
|
||||
stdenv.mkDerivation {
|
||||
pname = "compiler-rt" + lib.optionalString (haveLibc) "-libc";
|
||||
inherit version;
|
||||
src = fetch pname "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2";
|
||||
src = fetch "compiler-rt" "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2";
|
||||
|
||||
nativeBuildInputs = [ cmake python3 llvm.dev ];
|
||||
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||
|
@ -29,14 +30,15 @@ stdenv.mkDerivation rec {
|
|||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
||||
] ++ lib.optionals (useLLVM || bareMetal) [
|
||||
] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
|
||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
||||
] ++ lib.optionals (useLLVM && !haveLibc) [
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
] ++ lib.optionals (useLLVM) [
|
||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
||||
] ++ lib.optionals (bareMetal) [
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs
|
||||
{ lowPrio, newScope, pkgs, lib, stdenv, cmake
|
||||
, gccForLibs, preLibcCrossHeaders
|
||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||
|
@ -96,7 +97,16 @@ let
|
|||
# doesn’t support like LLVM. Probably we should move to some other
|
||||
# file.
|
||||
|
||||
bintools = callPackage ./bintools.nix {};
|
||||
bintools-unwrapped = callPackage ./bintools {};
|
||||
|
||||
bintoolsNoLibc = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
libc = preLibcCrossHeaders;
|
||||
};
|
||||
|
||||
bintools = wrapBintoolsWith {
|
||||
bintools = tools.bintools-unwrapped;
|
||||
};
|
||||
|
||||
lldClang = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
|
@ -115,6 +125,8 @@ let
|
|||
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
|
||||
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
|
||||
'' + lib.optionalString (stdenv.targetPlatform.isAndroid && stdenv.targetPlatform.useLLVM) ''
|
||||
echo "-lunwind" >> $out/nix-support/cc-ldflags
|
||||
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
|
||||
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands cc;
|
||||
|
@ -123,9 +135,7 @@ let
|
|||
lldClangNoLibcxx = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
};
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -139,10 +149,7 @@ let
|
|||
lldClangNoLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [
|
||||
targetLlvmLibraries.compiler-rt
|
||||
];
|
||||
|
@ -155,26 +162,43 @@ let
|
|||
lldClangNoCompilerRt = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
bintools = wrapBintoolsWith {
|
||||
inherit (tools) bintools;
|
||||
libc = null;
|
||||
};
|
||||
bintools = tools.bintoolsNoLibc;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = ''
|
||||
echo "-nostartfiles" >> $out/nix-support/cc-cflags
|
||||
'' + mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
lldClangNoCompilerRtWithLibc = wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
libcxx = null;
|
||||
inherit (tools) bintools;
|
||||
extraPackages = [ ];
|
||||
extraBuildCommands = mkExtraBuildCommands0 cc;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
libraries = lib.makeExtensible (libraries: let
|
||||
callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||
in {
|
||||
|
||||
compiler-rt = callPackage ./compiler-rt ({} //
|
||||
(lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) {
|
||||
stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt;
|
||||
}));
|
||||
compiler-rt-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
compiler-rt-no-libc = callPackage ./compiler-rt {
|
||||
stdenv = if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt
|
||||
else stdenv;
|
||||
};
|
||||
|
||||
# N.B. condition is safe because without useLLVM both are the same.
|
||||
compiler-rt = if stdenv.hostPlatform.isAndroid
|
||||
then libraries.compiler-rt-libc
|
||||
else libraries.compiler-rt-no-libc;
|
||||
|
||||
stdenv = overrideCC stdenv buildLlvmTools.clang;
|
||||
|
||||
|
|
|
@ -10345,14 +10345,17 @@ in
|
|||
gerbil-support = callPackage ../development/compilers/gerbil/gerbil-support.nix { };
|
||||
gerbilPackages-unstable = gerbil-support.gerbilPackages-unstable; # NB: don't recurseIntoAttrs for (unstable!) libraries
|
||||
|
||||
gccFun = callPackage (if (with stdenv.targetPlatform; isVc4 || libc == "relibc")
|
||||
then ../development/compilers/gcc/6
|
||||
else ../development/compilers/gcc/10);
|
||||
gcc = if (with stdenv.targetPlatform; isVc4 || libc == "relibc")
|
||||
then gcc6 else
|
||||
# aarch64-darwin doesn't support earlier gcc
|
||||
if (stdenv.targetPlatform.isAarch64 && stdenv.isDarwin) then gcc11
|
||||
else if stdenv.targetPlatform.isAarch64 then gcc9 else gcc10;
|
||||
inherit (let
|
||||
num =
|
||||
if (with stdenv.targetPlatform; isVc4 || libc == "relibc") then 6
|
||||
else if (stdenv.targetPlatform.isAarch64 && stdenv.isDarwin) then 11
|
||||
else if stdenv.targetPlatform.isAarch64 then 9
|
||||
else 10;
|
||||
numS = toString num;
|
||||
in {
|
||||
gcc = pkgs.${"gcc${numS}"};
|
||||
gccFun = callPackage (../development/compilers/gcc + "/${numS}");
|
||||
}) gcc gccFun;
|
||||
gcc-unwrapped = gcc.cc;
|
||||
|
||||
wrapNonDeterministicGcc = stdenv: ccWrapper:
|
||||
|
@ -10430,7 +10433,7 @@ in
|
|||
|
||||
crossLibcStdenv =
|
||||
if stdenv.hostPlatform.useLLVM or false
|
||||
then overrideCC stdenv buildPackages.llvmPackages_8.lldClangNoLibc
|
||||
then overrideCC stdenv buildPackages.llvmPackages.lldClangNoLibc
|
||||
else gccCrossLibcStdenv;
|
||||
|
||||
# The GCC used to build libc for the target platform. Normal gccs will be
|
||||
|
@ -11175,19 +11178,16 @@ in
|
|||
llvm_6 = llvmPackages_6.llvm;
|
||||
llvm_5 = llvmPackages_5.llvm;
|
||||
|
||||
llvmPackages = with targetPlatform;
|
||||
if isDarwin then
|
||||
llvmPackages_7
|
||||
else if isFreeBSD then
|
||||
llvmPackages_7
|
||||
else if isAndroid then
|
||||
llvmPackages_12
|
||||
else if isLinux then
|
||||
llvmPackages_7
|
||||
else if isWasm then
|
||||
llvmPackages_8
|
||||
else
|
||||
llvmPackages_latest;
|
||||
llvmPackages = let
|
||||
choose = platform:
|
||||
/**/ if platform.isDarwin then "7"
|
||||
else if platform.isFreeBSD then "7"
|
||||
else if platform.isAndroid then "12"
|
||||
else if platform.isLinux then "7"
|
||||
else if platform.isWasm then "8"
|
||||
else "latest";
|
||||
minSupported = lib.min (choose stdenv.hostPlatform) (choose stdenv.targetPlatform);
|
||||
in pkgs.${"llvmPackages_${minSupported}"};
|
||||
|
||||
llvmPackages_5 = recurseIntoAttrs (callPackage ../development/compilers/llvm/5 {
|
||||
inherit (stdenvAdapters) overrideCC;
|
||||
|
@ -12602,11 +12602,7 @@ in
|
|||
});
|
||||
binutilsNoLibc = wrapBintoolsWith {
|
||||
bintools = binutils-unwrapped;
|
||||
libc =
|
||||
/**/ if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers
|
||||
else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode
|
||||
else if stdenv.targetPlatform.libc == "nblibc" then targetPackages.netbsdCross.headers
|
||||
else null;
|
||||
libc = preLibcCrossHeaders;
|
||||
};
|
||||
|
||||
bison = callPackage ../development/tools/parsing/bison { };
|
||||
|
@ -14741,6 +14737,13 @@ in
|
|||
stdenv = crossLibcStdenv;
|
||||
};
|
||||
|
||||
# These are used when buiding compiler-rt / libgcc, prior to building libc.
|
||||
preLibcCrossHeaders = let
|
||||
inherit (stdenv.targetPlatform) libc;
|
||||
in if libc == "msvcrt" then targetPackages.windows.mingw_w64_headers
|
||||
else if libc == "nblibc" then targetPackages.netbsdCross.headers
|
||||
else null;
|
||||
|
||||
# We can choose:
|
||||
libcCrossChooser = name:
|
||||
# libc is hackily often used from the previous stage. This `or`
|
||||
|
@ -14755,8 +14758,10 @@ in
|
|||
else if name == "newlib" then targetPackages.newlibCross or newlibCross
|
||||
else if name == "musl" then targetPackages.muslCross or muslCross
|
||||
else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
|
||||
else if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries
|
||||
else if name == "libSystem" then targetPackages.darwin.xcode
|
||||
else if name == "libSystem" then
|
||||
if stdenv.targetPlatform.useiOSPrebuilt
|
||||
then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries
|
||||
else throw "don't yet have a `targetPackages.darwin.LibsystemCross`"
|
||||
else if name == "nblibc" then targetPackages.netbsdCross.libc or netbsdCross.libc
|
||||
else if name == "wasilibc" then targetPackages.wasilibc or wasilibc
|
||||
else if name == "relibc" then targetPackages.relibc or relibc
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
, buildPackages, pkgs, targetPackages
|
||||
, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget
|
||||
, stdenv, splicePackages, newScope
|
||||
, preLibcCrossHeaders
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -52,7 +53,7 @@ impure-cmds // apple-source-releases // {
|
|||
};
|
||||
|
||||
binutilsNoLibc = pkgs.wrapBintoolsWith {
|
||||
libc = null;
|
||||
libc = preLibcCrossHeaders;
|
||||
bintools = self.binutils-unwrapped;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue