git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #42452 from dtzWill/feature/llvm-38-39-musl

llvmPackages_{38,39}: musl compat, minor cleanup

commit1667a3c2fa13631f072ed6c263736a20054c1995 authorWill Dietz <github@wdtz.org> dateSat 23 Jun 2018, 16:27 (8 years ago) parent469cca0db7041a
13 files changed+65−18
pkgs/development/compilers/llvm/3.8/clang/default.nix+4−1 pkgs/development/compilers/llvm/3.8/libc++/default.nix+10−3 pkgs/development/compilers/llvm/3.8/libc++abi.nix+3 pkgs/development/compilers/llvm/3.8/llvm.nix+15−3 pkgs/development/compilers/llvm/3.9/clang/default.nix+2 pkgs/development/compilers/llvm/3.9/libc++/default.nix+12−6 pkgs/development/compilers/llvm/3.9/libc++abi.nix+3 pkgs/development/compilers/llvm/3.9/llvm.nix+13−2 pkgs/development/compilers/llvm/4/libc++/default.nix+1−1 pkgs/development/compilers/llvm/4/libc++abi.nix+1−1 pkgs/development/compilers/llvm/4/llvm.nix+1−1 pkgs/development/compilers/llvm/4/dynamiclibrary-musl.patch → pkgs/development/compilers/llvm/dynamiclibrary-musl.patch pkgs/development/compilers/llvm/4/libc++/max_align_t.patch → pkgs/development/compilers/llvm/libcxx-max_align_t.patch
pkgs/development/compilers/llvm/3.8/clang/default.nix+4−1
@@ -13,7 +13,8 @@ let
1313 mv clang-tools-extra-* $sourceRoot/tools/extra
1414 '';
1515
16− buildInputs = [ cmake libxml2 llvm python ];
16+ nativeBuildInputs = [ cmake ];
17+ buildInputs = [ libxml2 llvm python ];
1718
1819 cmakeFlags = [
1920 "-DCMAKE_CXX_FLAGS=-std=c++11"
@@ -27,6 +28,8 @@ let
2728 postPatch = ''
2829 sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
2930 sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
31+ '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
32+ sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
3033 '';
3134
3235 outputs = [ "out" "lib" "python" ];
pkgs/development/compilers/llvm/3.8/libc++/default.nix+10−3
@@ -17,15 +17,22 @@ stdenv.mkDerivation rec {
1717 patches = [
1818 # glibc 2.26 fix
1919 ../../3.9/libc++/xlocale-glibc-2.26.patch
20− ] ++ lib.optional stdenv.isDarwin ./darwin.patch;
20+ ]
21+ ++ lib.optional stdenv.isDarwin ./darwin.patch
22+ ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
23+ ../../libcxx-0001-musl-hacks.patch
24+ ../../libcxx-max_align_t.patch
25+ ];
26+
27+ nativeBuildInputs = [ cmake ];
2128
22− buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
29+ buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
2330
2431 cmakeFlags = [
2532 "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
2633 "-DLIBCXX_LIBCPPABI_VERSION=2"
2734 "-DLIBCXX_CXX_ABI=libcxxabi"
28− ];
35+ ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
2936
3037 enableParallelBuilding = true;
3138
pkgs/development/compilers/llvm/3.8/libc++abi.nix+3
@@ -15,6 +15,9 @@ stdenv.mkDerivation {
1515 export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
1616 '' + stdenv.lib.optionalString stdenv.isDarwin ''
1717 export TRIPLE=x86_64-apple-darwin
18+ '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
19+ patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
20+ patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
1821 '';
1922
2023 installPhase = if stdenv.isDarwin
pkgs/development/compilers/llvm/3.8/llvm.nix+15−3
@@ -36,8 +36,12 @@ in stdenv.mkDerivation rec {
3636
3737 # Fix a segfault in llc
3838 # See http://lists.llvm.org/pipermail/llvm-dev/2016-October/106500.html
39− patches = [ ./D17533-1.patch ] ++
40− stdenv.lib.optionals (!stdenv.isDarwin) [./fix-llvm-config.patch];
39+ patches = [ ./D17533-1.patch ]
40+ ++ stdenv.lib.optional (!stdenv.isDarwin) ./fix-llvm-config.patch
41+ ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
42+ ../TLI-musl.patch
43+ ../dynamiclibrary-musl.patch
44+ ];
4145
4246 # hacky fix: New LLVM releases require a newer macOS SDK than
4347 # 10.9. This is a temporary measure until nixpkgs darwin support is
@@ -49,7 +53,7 @@ in stdenv.mkDerivation rec {
4953 --replace 'set(CMAKE_INSTALL_NAME_DIR "@rpath")' "set(CMAKE_INSTALL_NAME_DIR "$out/lib")" \
5054 --replace 'set(CMAKE_INSTALL_RPATH "@executable_path/../lib")' ""
5155 ''
52− + stdenv.lib.optionalString (stdenv ? glibc) ''
56+ + ''
5357 (
5458 cd projects/compiler-rt
5559 patch -p1 < ${
@@ -81,6 +85,14 @@ in stdenv.mkDerivation rec {
8185 ++ stdenv.lib.optionals ( isDarwin) [
8286 "-DLLVM_ENABLE_LIBCXX=ON"
8387 "-DCAN_TARGET_i386=false"
88+ ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
89+ "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
90+ "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}"
91+ "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}"
92+ # Not yet supported
93+ "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
94+ "-DCOMPILER_RT_BUILD_XRAY=OFF"
95+
8496 ];
8597
8698 postBuild = ''
pkgs/development/compilers/llvm/3.9/clang/default.nix+2
@@ -29,6 +29,8 @@ let
2929 postPatch = ''
3030 sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
3131 sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
32+ '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
33+ sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/Tools.cpp
3234 '';
3335
3436 outputs = [ "out" "lib" "python" ];
pkgs/development/compilers/llvm/3.9/libc++/default.nix+12−6
@@ -17,15 +17,21 @@ stdenv.mkDerivation rec {
1717 patches = [
1818 # glibc 2.26 fix
1919 ./xlocale-glibc-2.26.patch
20− ] ++ lib.optional stdenv.isDarwin ./darwin.patch;
20+ ]
21+ ++ lib.optional stdenv.isDarwin ./darwin.patch
22+ ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
23+ ../../libcxx-0001-musl-hacks.patch
24+ ../../libcxx-max_align_t.patch
25+ ];
2126
22− buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
27+ nativeBuildInputs = [ cmake ];
28+ buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
2329
2430 cmakeFlags = [
25− "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
26− "-DLIBCXX_LIBCPPABI_VERSION=2"
27− "-DLIBCXX_CXX_ABI=libcxxabi"
28− ];
31+ "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
32+ "-DLIBCXX_LIBCPPABI_VERSION=2"
33+ "-DLIBCXX_CXX_ABI=libcxxabi"
34+ ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
2935
3036 enableParallelBuilding = true;
3137
pkgs/development/compilers/llvm/3.9/libc++abi.nix+3
@@ -15,6 +15,9 @@ stdenv.mkDerivation {
1515 export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_INCLUDES=$PWD/$(ls -d libcxx-*)/include"
1616 '' + stdenv.lib.optionalString stdenv.isDarwin ''
1717 export TRIPLE=x86_64-apple-darwin
18+ '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
19+ patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
20+ patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
1821 '';
1922
2023 installPhase = if stdenv.isDarwin
pkgs/development/compilers/llvm/3.9/llvm.nix+13−2
@@ -62,7 +62,10 @@ in stdenv.mkDerivation rec {
6262 url = https://github.com/llvm-mirror/llvm/commit/5340b5b3d970069aebf3dde49d8964583742e01a.patch;
6363 sha256 = "095f8knplwqbc2p7rad1kq8633i34qynni9jna93an7kyc80wdxl";
6464 })
65− ];
65+ ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
66+ ../TLI-musl.patch
67+ ../dynamiclibrary-musl.patch
68+ ];
6669
6770 postPatch = ""
6871 + ''
@@ -91,7 +94,7 @@ in stdenv.mkDerivation rec {
9194 substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
9295 patch -p1 < ./llvm-outputs.patch
9396 ''
94− + stdenv.lib.optionalString (stdenv ? glibc) ''
97+ + ''
9598 (
9699 cd projects/compiler-rt
97100 patch -p1 < ${
@@ -129,6 +132,14 @@ in stdenv.mkDerivation rec {
129132 ] ++ stdenv.lib.optionals (buildPlatform != hostPlatform) [
130133 "-DCMAKE_CROSSCOMPILING=True"
131134 "-DLLVM_TABLEGEN=${buildPackages.llvmPackages_39.llvm}/bin/llvm-tblgen"
135+ ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
136+ "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
137+ "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}"
138+ "-DTARGET_TRIPLE=${stdenv.targetPlatform.config}"
139+ # Not yet supported
140+ "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
141+ "-DCOMPILER_RT_BUILD_XRAY=OFF"
142+
132143 ];
133144
134145 postBuild = ''
pkgs/development/compilers/llvm/4/libc++/default.nix+1−1
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
1717 ./xlocale-glibc-2.26.patch
1818 ] ++ stdenv.lib.optionals stdenv.hostPlatform.isMusl [
1919 ../../libcxx-0001-musl-hacks.patch
20− ./max_align_t.patch
20+ ../../libcxx-max_align_t.patch
2121 ];
2222
2323 prePatch = ''
pkgs/development/compilers/llvm/4/libc++abi.nix+1−1
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
1616 export TRIPLE=x86_64-apple-darwin
1717 '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
1818 patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
19− patch -p1 -d $(ls -d libcxx-*) -i ${./libc++/max_align_t.patch}
19+ patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-max_align_t.patch}
2020 '';
2121
2222 installPhase = if stdenv.isDarwin
pkgs/development/compilers/llvm/4/llvm.nix+1−1
@@ -83,7 +83,7 @@ in stdenv.mkDerivation (rec {
8383 patch -p0 < ${../aarch64.patch}
8484 '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
8585 patch -p1 -i ${../TLI-musl.patch}
86− patch -p1 -i ${./dynamiclibrary-musl.patch}
86+ patch -p1 -i ${../dynamiclibrary-musl.patch}
8787 patch -p1 -i ${./sanitizers-nongnu.patch} -d projects/compiler-rt
8888 '';
8989
pkgs/development/compilers/llvm/4/dynamiclibrary-musl.patch → pkgs/development/compilers/llvm/dynamiclibrary-musl.patchrenamed

The content is the same.

pkgs/development/compilers/llvm/4/libc++/max_align_t.patch → pkgs/development/compilers/llvm/libcxx-max_align_t.patchrenamed

The content is the same.