mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-30 15:23:26 +03:00
llvm_39: fix on darwin
This commit is contained in:
parent
598d824198
commit
0f6ef7c41c
@ -1,4 +1,4 @@
|
|||||||
{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC }:
|
{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC, darwin }:
|
||||||
let
|
let
|
||||||
callPackage = newScope (self // { inherit stdenv isl version fetch; });
|
callPackage = newScope (self // { inherit stdenv isl version fetch; });
|
||||||
|
|
||||||
|
@ -15,10 +15,16 @@
|
|||||||
, libcxxabi
|
, libcxxabi
|
||||||
, debugVersion ? false
|
, debugVersion ? false
|
||||||
, enableSharedLibraries ? true
|
, enableSharedLibraries ? true
|
||||||
|
, darwin
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
src = fetch "llvm" "0j49lkd5d7nnpdqzaybs2472bvcxyx0i4r3iccwf3kj2v9wk3iv6";
|
src = fetch "llvm" "0j49lkd5d7nnpdqzaybs2472bvcxyx0i4r3iccwf3kj2v9wk3iv6";
|
||||||
|
shlib = if stdenv.isDarwin then "dylib" else "so";
|
||||||
|
|
||||||
|
# Used when creating a version-suffixed symlink of libLLVM.dylib
|
||||||
|
shortVersion = with stdenv.lib;
|
||||||
|
concatStringsSep "." (take 2 (splitString "." version));
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
name = "llvm-${version}";
|
name = "llvm-${version}";
|
||||||
|
|
||||||
@ -33,7 +39,8 @@ in stdenv.mkDerivation rec {
|
|||||||
outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
|
outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
|
||||||
|
|
||||||
buildInputs = [ perl groff cmake libxml2 python libffi ]
|
buildInputs = [ perl groff cmake libxml2 python libffi ]
|
||||||
++ stdenv.lib.optional stdenv.isDarwin libcxxabi;
|
++ stdenv.lib.optionals stdenv.isDarwin
|
||||||
|
[ libcxxabi darwin.cctools darwin.apple_sdk.libs.xpc ];
|
||||||
|
|
||||||
propagatedBuildInputs = [ ncurses zlib ];
|
propagatedBuildInputs = [ ncurses zlib ];
|
||||||
|
|
||||||
@ -70,6 +77,7 @@ 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"
|
||||||
|
"-DCMAKE_LIBTOOL=${darwin.cctools}/bin/libtool"
|
||||||
];
|
];
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
@ -81,13 +89,17 @@ in stdenv.mkDerivation rec {
|
|||||||
postInstall = ""
|
postInstall = ""
|
||||||
+ stdenv.lib.optionalString (enableSharedLibraries) ''
|
+ stdenv.lib.optionalString (enableSharedLibraries) ''
|
||||||
moveToOutput "lib/libLLVM-*" "$lib"
|
moveToOutput "lib/libLLVM-*" "$lib"
|
||||||
moveToOutput "lib/libLLVM.so" "$lib"
|
moveToOutput "lib/libLLVM.${shlib}" "$lib"
|
||||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \
|
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \
|
||||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
||||||
''
|
''
|
||||||
+ stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
|
+ stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
|
||||||
install_name_tool -id $out/lib/libLLVM.dylib $out/lib/libLLVM.dylib
|
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \
|
||||||
ln -s $out/lib/libLLVM.dylib $out/lib/libLLVM-${version}.dylib
|
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
|
||||||
|
install_name_tool -id $lib/lib/libLLVM.dylib $lib/lib/libLLVM.dylib
|
||||||
|
install_name_tool -change @rpath/libLLVM.dylib $lib/lib/libLLVM.dylib $out/bin/llvm-config
|
||||||
|
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
|
||||||
|
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${version}.dylib
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user