llvm6: musl compat
This commit is contained in:
parent
ab0a72a33d
commit
e876e97ef0
@ -47,6 +47,8 @@ let
|
|||||||
|
|
||||||
# Patch for standalone doc building
|
# Patch for standalone doc building
|
||||||
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
|
sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
|
||||||
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
|
sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "lib" "python" ];
|
outputs = [ "out" "lib" "python" ];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ lib, stdenv, fetch, cmake, llvm, libcxxabi, fixDarwinDylibNames, version }:
|
{ lib, stdenv, fetch, cmake, python, llvm, libcxxabi, fixDarwinDylibNames, version }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "libc++-${version}";
|
name = "libc++-${version}";
|
||||||
@ -10,6 +10,12 @@ stdenv.mkDerivation rec {
|
|||||||
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# on next rebuild, this can be replaced with optionals; for now set to null to avoid
|
||||||
|
# patches = stdenv.lib.optionals stdenv.hostPlatform.isMusl [
|
||||||
|
patches = if stdenv.hostPlatform.isMusl then [
|
||||||
|
../../libcxx-0001-musl-hacks.patch
|
||||||
|
] else null;
|
||||||
|
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
|
substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
|
||||||
'';
|
'';
|
||||||
@ -17,9 +23,10 @@ stdenv.mkDerivation rec {
|
|||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
# Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
|
# 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")
|
cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
|
||||||
|
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
|
patchShebangs utils/cat_files.py
|
||||||
'';
|
'';
|
||||||
|
nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
|
||||||
nativeBuildInputs = [ cmake ];
|
|
||||||
|
|
||||||
buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||||
|
|
||||||
@ -27,7 +34,7 @@ stdenv.mkDerivation rec {
|
|||||||
"-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;
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ stdenv.mkDerivation {
|
|||||||
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
|
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
|
||||||
'' + 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}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = if stdenv.isDarwin
|
installPhase = if stdenv.isDarwin
|
||||||
|
@ -74,6 +74,11 @@ in stdenv.mkDerivation (rec {
|
|||||||
|
|
||||||
# Revert compiler-rt commit that makes codesign mandatory
|
# Revert compiler-rt commit that makes codesign mandatory
|
||||||
patch -p1 -i ${./compiler-rt-codesign.patch} -d projects/compiler-rt
|
patch -p1 -i ${./compiler-rt-codesign.patch} -d projects/compiler-rt
|
||||||
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
||||||
|
patch -p1 -i ${../TLI-musl.patch}
|
||||||
|
substituteInPlace unittests/Support/CMakeLists.txt \
|
||||||
|
--replace "add_subdirectory(DynamicLibrary)" ""
|
||||||
|
rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# hacky fix: created binaries need to be run before installation
|
# hacky fix: created binaries need to be run before installation
|
||||||
@ -104,6 +109,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}"
|
||||||
|
|
||||||
|
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
||||||
|
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
||||||
];
|
];
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user