llvm: create all versioned symlinks for libLLVM on darwin

Apply eb31e481475 to older versions where applicable.
This commit is contained in:
Daiderd Jordan 2019-05-04 13:24:12 +02:00 committed by Frederik Rietdijk
parent 807ba5f123
commit 626a95a9b4
4 changed files with 39 additions and 24 deletions

View File

@ -22,10 +22,13 @@ assert (stdenv.hostPlatform != stdenv.buildPlatform) -> !enableSharedLibraries;
let
src = fetch "llvm" "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z";
# Used when creating a version-suffixed symlink of libLLVM.dylib
shortVersion = with stdenv.lib;
concatStringsSep "." (take 2 (splitString "." version));
in stdenv.mkDerivation rec {
# Used when creating a versioned symlinks of libLLVM.dylib
versionSuffixes = with stdenv.lib;
let parts = splitString "." version; in
imap (i: _: concatStringsSep "." (take i parts)) parts;
in
stdenv.mkDerivation {
name = "llvm-${version}";
unpackPhase = ''
@ -153,8 +156,9 @@ in stdenv.mkDerivation rec {
+ stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-release.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${version}.dylib
${stdenv.lib.concatMapStringsSep "\n" (v: ''
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes}
'';
enableParallelBuilding = true;

View File

@ -19,10 +19,13 @@
let
src = fetch "llvm" "0l9bf7kdwhlj0kq1hawpyxhna1062z3h7qcz2y8nfl9dz2qksy6s";
# Used when creating a version-suffixed symlink of libLLVM.dylib
shortVersion = with stdenv.lib;
concatStringsSep "." (take 2 (splitString "." release_version));
in stdenv.mkDerivation (rec {
# Used when creating a versioned symlinks of libLLVM.dylib
versionSuffixes = with stdenv.lib;
let parts = splitString "." release_version; in
imap (i: _: concatStringsSep "." (take i parts)) parts;
in
stdenv.mkDerivation (rec {
name = "llvm-${version}";
unpackPhase = ''
@ -136,8 +139,9 @@ in stdenv.mkDerivation (rec {
+ stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
${stdenv.lib.concatMapStringsSep "\n" (v: ''
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes}
'';
doCheck = stdenv.isLinux && (!stdenv.isi686);

View File

@ -18,10 +18,13 @@
let
src = fetch "llvm" "0g1bbj2n6xv4p1n6hh17vj3vpvg56wacipc81dgwga9mg2lys8nm";
# Used when creating a version-suffixed symlink of libLLVM.dylib
shortVersion = with stdenv.lib;
concatStringsSep "." (take 2 (splitString "." release_version));
in stdenv.mkDerivation (rec {
# Used when creating a versioned symlinks of libLLVM.dylib
versionSuffixes = with stdenv.lib;
let parts = splitString "." release_version; in
imap (i: _: concatStringsSep "." (take i parts)) parts;
in
stdenv.mkDerivation (rec {
name = "llvm-${version}";
unpackPhase = ''
@ -119,8 +122,9 @@ in stdenv.mkDerivation (rec {
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" \
--replace "\''${_IMPORT_PREFIX}/lib/libLTO.dylib" "$lib/lib/libLTO.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
${stdenv.lib.concatMapStringsSep "\n" (v: ''
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes}
'';
doCheck = stdenv.isLinux && (!stdenv.isi686);

View File

@ -21,11 +21,13 @@ let
src = fetch "llvm" "1qpls3vk85lydi5b4axl0809fv932qgsqgdgrk098567z4jc7mmn";
# Used when creating a version-suffixed symlink of libLLVM.dylib
shortVersion = with stdenv.lib;
concatStringsSep "." (take 2 (splitString "." release_version));
# Used when creating a versioned symlinks of libLLVM.dylib
versionSuffixes = with stdenv.lib;
let parts = splitString "." release_version; in
imap (i: _: concatStringsSep "." (take i parts)) parts;
in
in stdenv.mkDerivation (rec {
stdenv.mkDerivation (rec {
name = "llvm-${version}";
unpackPhase = ''
@ -133,8 +135,9 @@ in stdenv.mkDerivation (rec {
+ optionalString (stdenv.isDarwin && enableSharedLibraries) ''
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
${stdenv.lib.concatMapStringsSep "\n" (v: ''
ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${v}.dylib
'') versionSuffixes}
'';
doCheck = stdenv.isLinux && (!stdenv.isi686);