Merge pull request #42452 from dtzWill/feature/llvm-38-39-musl
llvmPackages_{38,39}: musl compat, minor cleanup
This commit is contained in:
commit
1667a3c2fa
@ -13,7 +13,8 @@ let
|
|||||||
mv clang-tools-extra-* $sourceRoot/tools/extra
|
mv clang-tools-extra-* $sourceRoot/tools/extra
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildInputs = [ cmake libxml2 llvm python ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
buildInputs = [ libxml2 llvm python ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DCMAKE_CXX_FLAGS=-std=c++11"
|
"-DCMAKE_CXX_FLAGS=-std=c++11"
|
||||||
@ -27,6 +28,8 @@ let
|
|||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
|
sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
|
||||||
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
|
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
|
||||||
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
|
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "lib" "python" ];
|
outputs = [ "out" "lib" "python" ];
|
||||||
|
@ -17,15 +17,22 @@ stdenv.mkDerivation rec {
|
|||||||
patches = [
|
patches = [
|
||||||
# glibc 2.26 fix
|
# glibc 2.26 fix
|
||||||
../../3.9/libc++/xlocale-glibc-2.26.patch
|
../../3.9/libc++/xlocale-glibc-2.26.patch
|
||||||
] ++ lib.optional stdenv.isDarwin ./darwin.patch;
|
]
|
||||||
|
++ lib.optional stdenv.isDarwin ./darwin.patch
|
||||||
|
++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||||
|
../../libcxx-0001-musl-hacks.patch
|
||||||
|
../../libcxx-max_align_t.patch
|
||||||
|
];
|
||||||
|
|
||||||
buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
nativeBuildInputs = [ cmake ];
|
||||||
|
|
||||||
|
buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
|
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
|
||||||
"-DLIBCXX_LIBCPPABI_VERSION=2"
|
"-DLIBCXX_LIBCPPABI_VERSION=2"
|
||||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||||
];
|
] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ stdenv.mkDerivation {
|
|||||||
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
|
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
|
||||||
'' + 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 ''
|
||||||
|
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
|
||||||
|
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = if stdenv.isDarwin
|
installPhase = if stdenv.isDarwin
|
||||||
|
@ -36,8 +36,12 @@ in stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
# Fix a segfault in llc
|
# Fix a segfault in llc
|
||||||
# See http://lists.llvm.org/pipermail/llvm-dev/2016-October/106500.html
|
# See http://lists.llvm.org/pipermail/llvm-dev/2016-October/106500.html
|
||||||
patches = [ ./D17533-1.patch ] ++
|
patches = [ ./D17533-1.patch ]
|
||||||
stdenv.lib.optionals (!stdenv.isDarwin) [./fix-llvm-config.patch];
|
++ stdenv.lib.optional (!stdenv.isDarwin) ./fix-llvm-config.patch
|
||||||
|
++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||||
|
../TLI-musl.patch
|
||||||
|
../dynamiclibrary-musl.patch
|
||||||
|
];
|
||||||
|
|
||||||
# hacky fix: New LLVM releases require a newer macOS SDK than
|
# hacky fix: New LLVM releases require a newer macOS SDK than
|
||||||
# 10.9. This is a temporary measure until nixpkgs darwin support is
|
# 10.9. This is a temporary measure until nixpkgs darwin support is
|
||||||
@ -49,7 +53,7 @@ in stdenv.mkDerivation rec {
|
|||||||
--replace 'set(CMAKE_INSTALL_NAME_DIR "@rpath")' "set(CMAKE_INSTALL_NAME_DIR "$out/lib")" \
|
--replace 'set(CMAKE_INSTALL_NAME_DIR "@rpath")' "set(CMAKE_INSTALL_NAME_DIR "$out/lib")" \
|
||||||
--replace 'set(CMAKE_INSTALL_RPATH "@executable_path/../lib")' ""
|
--replace 'set(CMAKE_INSTALL_RPATH "@executable_path/../lib")' ""
|
||||||
''
|
''
|
||||||
+ stdenv.lib.optionalString (stdenv ? glibc) ''
|
+ ''
|
||||||
(
|
(
|
||||||
cd projects/compiler-rt
|
cd projects/compiler-rt
|
||||||
patch -p1 < ${
|
patch -p1 < ${
|
||||||
@ -81,6 +85,14 @@ in stdenv.mkDerivation rec {
|
|||||||
++ stdenv.lib.optionals ( isDarwin) [
|
++ stdenv.lib.optionals ( isDarwin) [
|
||||||
"-DLLVM_ENABLE_LIBCXX=ON"
|
"-DLLVM_ENABLE_LIBCXX=ON"
|
||||||
"-DCAN_TARGET_i386=false"
|
"-DCAN_TARGET_i386=false"
|
||||||
|
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||||
|
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
||||||
|
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}"
|
||||||
|
"-DTARGET_TRIPLE=${stdenv.targetPlatform.config}"
|
||||||
|
# Not yet supported
|
||||||
|
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||||
|
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
|
@ -29,6 +29,8 @@ let
|
|||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
|
sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
|
||||||
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
|
sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
|
||||||
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
|
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "lib" "python" ];
|
outputs = [ "out" "lib" "python" ];
|
||||||
|
@ -17,15 +17,21 @@ stdenv.mkDerivation rec {
|
|||||||
patches = [
|
patches = [
|
||||||
# glibc 2.26 fix
|
# glibc 2.26 fix
|
||||||
./xlocale-glibc-2.26.patch
|
./xlocale-glibc-2.26.patch
|
||||||
] ++ lib.optional stdenv.isDarwin ./darwin.patch;
|
]
|
||||||
|
++ lib.optional stdenv.isDarwin ./darwin.patch
|
||||||
|
++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||||
|
../../libcxx-0001-musl-hacks.patch
|
||||||
|
../../libcxx-max_align_t.patch
|
||||||
|
];
|
||||||
|
|
||||||
buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
nativeBuildInputs = [ cmake ];
|
||||||
|
buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
|
"-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
|
||||||
"-DLIBCXX_LIBCPPABI_VERSION=2"
|
"-DLIBCXX_LIBCPPABI_VERSION=2"
|
||||||
"-DLIBCXX_CXX_ABI=libcxxabi"
|
"-DLIBCXX_CXX_ABI=libcxxabi"
|
||||||
];
|
] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ stdenv.mkDerivation {
|
|||||||
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
|
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
|
||||||
'' + 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 ''
|
||||||
|
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
|
||||||
|
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = if stdenv.isDarwin
|
installPhase = if stdenv.isDarwin
|
||||||
|
@ -62,6 +62,9 @@ in stdenv.mkDerivation rec {
|
|||||||
url = https://github.com/llvm-mirror/llvm/commit/5340b5b3d970069aebf3dde49d8964583742e01a.patch;
|
url = https://github.com/llvm-mirror/llvm/commit/5340b5b3d970069aebf3dde49d8964583742e01a.patch;
|
||||||
sha256 = "095f8knplwqbc2p7rad1kq8633i34qynni9jna93an7kyc80wdxl";
|
sha256 = "095f8knplwqbc2p7rad1kq8633i34qynni9jna93an7kyc80wdxl";
|
||||||
})
|
})
|
||||||
|
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||||
|
../TLI-musl.patch
|
||||||
|
../dynamiclibrary-musl.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ""
|
postPatch = ""
|
||||||
@ -91,7 +94,7 @@ in stdenv.mkDerivation rec {
|
|||||||
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
|
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
|
||||||
patch -p1 < ./llvm-outputs.patch
|
patch -p1 < ./llvm-outputs.patch
|
||||||
''
|
''
|
||||||
+ stdenv.lib.optionalString (stdenv ? glibc) ''
|
+ ''
|
||||||
(
|
(
|
||||||
cd projects/compiler-rt
|
cd projects/compiler-rt
|
||||||
patch -p1 < ${
|
patch -p1 < ${
|
||||||
@ -129,6 +132,14 @@ in stdenv.mkDerivation rec {
|
|||||||
] ++ stdenv.lib.optionals (buildPlatform != hostPlatform) [
|
] ++ stdenv.lib.optionals (buildPlatform != hostPlatform) [
|
||||||
"-DCMAKE_CROSSCOMPILING=True"
|
"-DCMAKE_CROSSCOMPILING=True"
|
||||||
"-DLLVM_TABLEGEN=${buildPackages.llvmPackages_39.llvm}/bin/llvm-tblgen"
|
"-DLLVM_TABLEGEN=${buildPackages.llvmPackages_39.llvm}/bin/llvm-tblgen"
|
||||||
|
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||||
|
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
||||||
|
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}"
|
||||||
|
"-DTARGET_TRIPLE=${stdenv.targetPlatform.config}"
|
||||||
|
# Not yet supported
|
||||||
|
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||||
|
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
|
@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
|
|||||||
./xlocale-glibc-2.26.patch
|
./xlocale-glibc-2.26.patch
|
||||||
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||||
../../libcxx-0001-musl-hacks.patch
|
../../libcxx-0001-musl-hacks.patch
|
||||||
./max_align_t.patch
|
../../libcxx-max_align_t.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
|
@ -16,7 +16,7 @@ stdenv.mkDerivation {
|
|||||||
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 $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
|
||||||
patch -p1 -d $(ls -d libcxx-*) -i ${./libc++/max_align_t.patch}
|
patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = if stdenv.isDarwin
|
installPhase = if stdenv.isDarwin
|
||||||
|
@ -83,7 +83,7 @@ in stdenv.mkDerivation (rec {
|
|||||||
patch -p0 < ${../aarch64.patch}
|
patch -p0 < ${../aarch64.patch}
|
||||||
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
patch -p1 -i ${../TLI-musl.patch}
|
patch -p1 -i ${../TLI-musl.patch}
|
||||||
patch -p1 -i ${./dynamiclibrary-musl.patch}
|
patch -p1 -i ${../dynamiclibrary-musl.patch}
|
||||||
patch -p1 -i ${./sanitizers-nongnu.patch} -d projects/compiler-rt
|
patch -p1 -i ${./sanitizers-nongnu.patch} -d projects/compiler-rt
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user