Merge pull request #99984 from ggreif/darwin-llvm11
llvmPackages_11: 11.0.0rc5 -> 11.0.0 and various fixes/improvements: - llvmPackages_11 now compiles on Darwin - libcxx now compiles on Linux - Ported #91293 to 11.0.0 - Try to anticipate #100388
This commit is contained in:
commit
86a4a50e10
10 changed files with 37 additions and 35 deletions
|
@ -8,7 +8,7 @@ let
|
||||||
pname = "clang";
|
pname = "clang";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch "clang" "1p64l5a3x55118nyms1805qbk3r9w37nz1rb7xvbgc9fmyzaffay";
|
src = fetch "clang" "02ajkij85966vd150iy246mv16dsaph1kfi0y8wnncp8w6nar5hg";
|
||||||
inherit clang-tools-extra_src;
|
inherit clang-tools-extra_src;
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
|
@ -86,8 +86,6 @@ let
|
||||||
passthru = {
|
passthru = {
|
||||||
isClang = true;
|
isClang = true;
|
||||||
inherit llvm;
|
inherit llvm;
|
||||||
} // stdenv.lib.optionalAttrs (stdenv.targetPlatform.isLinux || (stdenv.cc.isGNU && stdenv.cc.cc ? gcc)) {
|
|
||||||
gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -11,7 +11,7 @@ in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "compiler-rt";
|
pname = "compiler-rt";
|
||||||
inherit version;
|
inherit version;
|
||||||
src = fetch pname "0cpyi5g0wlwyb7gvy47k5rjiipnlhrr3ks4q4rlrlyax6w9dx98n";
|
src = fetch pname "0d5j5l8phwqjjscmk8rmqn0i2i0abl537gdbkagl8fjpzy1gyjip";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python3 llvm ];
|
nativeBuildInputs = [ cmake python3 llvm ];
|
||||||
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
|
||||||
|
@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
|
||||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
||||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
||||||
|
] ++ stdenv.lib.optionals (stdenv.isDarwin) [
|
||||||
|
"-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
|
||||||
] ++ stdenv.lib.optionals (useLLVM || bareMetal || isMusl) [
|
] ++ stdenv.lib.optionals (useLLVM || bareMetal || isMusl) [
|
||||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||||
|
@ -61,6 +63,8 @@ stdenv.mkDerivation rec {
|
||||||
substituteInPlace cmake/builtin-config-ix.cmake \
|
substituteInPlace cmake/builtin-config-ix.cmake \
|
||||||
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
|
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
|
substituteInPlace cmake/builtin-config-ix.cmake \
|
||||||
|
--replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)'
|
||||||
substituteInPlace cmake/config-ix.cmake \
|
substituteInPlace cmake/config-ix.cmake \
|
||||||
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
--replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
|
||||||
'' + stdenv.lib.optionalString (useLLVM) ''
|
'' + stdenv.lib.optionalString (useLLVM) ''
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
{ lowPrio, newScope, pkgs, stdenv, cmake
|
{ lowPrio, newScope, pkgs, stdenv, cmake, gccForLibs
|
||||||
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
, libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith
|
||||||
|
, buildPackages
|
||||||
, buildLlvmTools # tools, but from the previous stage, for cross
|
, buildLlvmTools # tools, but from the previous stage, for cross
|
||||||
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
, targetLlvmLibraries # libraries, but from the next stage, for cross
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
release_version = "11.0.0";
|
release_version = "11.0.0";
|
||||||
candidate = "rc5";
|
version = "${release_version}"; # differentiating these (variables) is important for RCs
|
||||||
version = "${release_version}${candidate}"; # differentiating these (variables) is important for RCs
|
|
||||||
targetConfig = stdenv.targetPlatform.config;
|
targetConfig = stdenv.targetPlatform.config;
|
||||||
|
|
||||||
fetch = name: sha256: fetchurl {
|
fetch = name: sha256: fetchurl {
|
||||||
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}-${candidate}/${name}-${version}.src.tar.xz";
|
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_version}/${name}-${version}.src.tar.xz";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
clang-tools-extra_src = fetch "clang-tools-extra" "0slqx5430pc699idabqnq34s9n0y2fq6q8z8hn5wakbi93dal71r";
|
clang-tools-extra_src = fetch "clang-tools-extra" "02bcwwn54661madhq4nxc069s7p7pj5gpqi8ww50w3anbpviilzy";
|
||||||
|
|
||||||
tools = stdenv.lib.makeExtensible (tools: let
|
tools = stdenv.lib.makeExtensible (tools: let
|
||||||
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; });
|
||||||
|
@ -26,8 +26,8 @@ let
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
|
||||||
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
|
||||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||||
'' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && tools.clang-unwrapped ? gcc && !(stdenv.targetPlatform.useLLVM or false)) ''
|
'' + stdenv.lib.optionalString (stdenv.targetPlatform.isLinux && !(stdenv.targetPlatform.useLLVM or false)) ''
|
||||||
echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags
|
echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@ let
|
||||||
|
|
||||||
libstdcxxClang = wrapCCWith rec {
|
libstdcxxClang = wrapCCWith rec {
|
||||||
cc = tools.clang-unwrapped;
|
cc = tools.clang-unwrapped;
|
||||||
libcxx = null; # libstdcxx is smuggled in with clang.gcc
|
# libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
|
||||||
|
libcxx = null;
|
||||||
extraPackages = [
|
extraPackages = [
|
||||||
targetLlvmLibraries.compiler-rt
|
targetLlvmLibraries.compiler-rt
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,33 +1,31 @@
|
||||||
{ lib, stdenv, fetch, cmake, python3, libcxxabi, fixDarwinDylibNames, version
|
{ lib, stdenv, fetch, cmake, python3, libcxxabi, llvm, fixDarwinDylibNames, version
|
||||||
, enableShared ? true }:
|
, enableShared ? true }:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "libc++";
|
pname = "libc++";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch "libcxx" "1rlp8hx0nmqpx0gxq8hh9kqbkkzfpadx9chm47c38d4lahdksr1v";
|
src = fetch "libcxx" "0ylbkcd38zrrz9xmkq9na3d9s8d96hc286dwfwd73wi205lyc7kc";
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
unpackFile ${libcxxabi.src}
|
unpackFile ${libcxxabi.src}
|
||||||
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
mv libcxxabi-* libcxxabi
|
||||||
|
unpackFile ${llvm.src}
|
||||||
|
mv llvm-* llvm
|
||||||
'';
|
'';
|
||||||
|
|
||||||
patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
|
patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
|
|
||||||
cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
|
|
||||||
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
|
||||||
patchShebangs utils/cat_files.py
|
patchShebangs utils/cat_files.py
|
||||||
'';
|
'';
|
||||||
nativeBuildInputs = [ cmake ]
|
|
||||||
++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) python3;
|
|
||||||
|
|
||||||
buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
nativeBuildInputs = [ cmake python3 ]
|
||||||
|
++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||||
|
|
||||||
|
buildInputs = [ libcxxabi ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
|
|
||||||
"-DLIBCXX_LIBCPPABI_VERSION=2"
|
|
||||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||||
] ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
] ++ stdenv.lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
|
||||||
++ stdenv.lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
++ stdenv.lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
|
||||||
|
|
|
@ -5,7 +5,7 @@ stdenv.mkDerivation {
|
||||||
pname = "libc++abi";
|
pname = "libc++abi";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch "libcxxabi" "0214sl9m80hb8v0mdkrwl8l4ca3dvapis23mkld85bnxa8zq2c1q";
|
src = fetch "libcxxabi" "05ac7rkjbla03bc0lf92f901dfjgxdvp8cr9fpn59a5p4x27ssaq";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
|
buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
|
||||||
|
@ -24,14 +24,15 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
postUnpack = ''
|
postUnpack = ''
|
||||||
unpackFile ${libcxx.src}
|
unpackFile ${libcxx.src}
|
||||||
|
mv libcxx-* libcxx
|
||||||
unpackFile ${llvm.src}
|
unpackFile ${llvm.src}
|
||||||
cmakeFlags+=" -DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
|
mv llvm-* llvm
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
export TRIPLE=x86_64-apple-darwin
|
export TRIPLE=x86_64-apple-darwin
|
||||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
|
patch -p1 -d libcxx -i ${../libcxx-0001-musl-hacks.patch}
|
||||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isWasm ''
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isWasm ''
|
||||||
patch -p1 -d $(ls -d llvm-*) -i ${./libcxxabi-wasm.patch}
|
patch -p1 -d llvm -i ${./libcxxabi-wasm.patch}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = if stdenv.isDarwin
|
installPhase = if stdenv.isDarwin
|
||||||
|
|
|
@ -4,7 +4,7 @@ stdenv.mkDerivation rec {
|
||||||
pname = "libunwind";
|
pname = "libunwind";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch pname "1xw8y6agnix7qlwh676gm1kbkzh9c1nz7l3vhxjpazbk70biz9mq";
|
src = fetch pname "0bwjd2xf51r2apn8p0f9shb6nc8hnqzq1n9gggjvyjmi6cf02mc4";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
|
||||||
pname = "lld";
|
pname = "lld";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch pname "1ibyahcxxckdfwh95f1dzxgcf1fsd0r9rpanm3dnn6nb99mn0is4";
|
src = fetch pname "077xyh7sij6mhp4dc4kdcmp9whrpz332fa12rwxnzp3wgd5bxrzg";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
buildInputs = [ llvm libxml2 ];
|
buildInputs = [ llvm libxml2 ];
|
||||||
|
|
|
@ -20,7 +20,7 @@ stdenv.mkDerivation (rec {
|
||||||
pname = "lldb";
|
pname = "lldb";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch pname "1v8nvw6rxmi7w3ayjcjan4plb5ryhizc41sras7fza2l7n3cz8iz";
|
src = fetch pname "0wic9lyb2la9bkzdc13szkm4f793w1mddp50xvh237iraygw0w45";
|
||||||
|
|
||||||
patches = [ ./lldb-procfs.patch ];
|
patches = [ ./lldb-procfs.patch ];
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ in stdenv.mkDerivation (rec {
|
||||||
pname = "llvm";
|
pname = "llvm";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch pname "1k7i2syqdm29l10di3ws64i02snh9jhd1s2jzgh8565b0vg25wlc";
|
src = fetch pname "0s94lwil98w7zb7cjrbnxli0z7gklb312pkw74xs1d6zk346hgwi";
|
||||||
polly_src = fetch "polly" "0l0n09f6sy30x825w85v8n7pvya0ciq89r0abv66n8ggwmrk3rnw";
|
polly_src = fetch "polly" "0h442ivcslr3dv3q3g1nw5avh77f8cxsp6zild1hgspj266xpynw";
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
unpackFile $src
|
unpackFile $src
|
||||||
|
@ -96,7 +96,7 @@ in stdenv.mkDerivation (rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# E.g. mesa.drivers use the build-id as a cache key (see #93946):
|
# E.g. mesa.drivers use the build-id as a cache key (see #93946):
|
||||||
LDFLAGS = optionalString enableSharedLibraries "-Wl,--build-id=sha1";
|
LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
|
||||||
|
|
||||||
cmakeFlags = with stdenv; [
|
cmakeFlags = with stdenv; [
|
||||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||||
|
|
|
@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
|
||||||
pname = "openmp";
|
pname = "openmp";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = fetch pname "1yq7m0kwnlgq8ni719g9fny0x5wrvm8szp11b3q8zz39rqqyphsz";
|
src = fetch pname "0k389d0g9zlfyzh1kpb3i5jdawzpn0hrdxzbjinpvdv7rbw4sw1d";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake perl ];
|
nativeBuildInputs = [ cmake perl ];
|
||||||
buildInputs = [ llvm ];
|
buildInputs = [ llvm ];
|
||||||
|
|
Loading…
Reference in a new issue