diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 6c935fd88de5..174cb17908cc 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -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; diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix index 5cd7901fe22c..ecb18a580540 100644 --- a/pkgs/development/compilers/llvm/4/llvm.nix +++ b/pkgs/development/compilers/llvm/4/llvm.nix @@ -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); diff --git a/pkgs/development/compilers/llvm/5/llvm.nix b/pkgs/development/compilers/llvm/5/llvm.nix index 41dc20ec4fe3..d6839f0f2909 100644 --- a/pkgs/development/compilers/llvm/5/llvm.nix +++ b/pkgs/development/compilers/llvm/5/llvm.nix @@ -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); diff --git a/pkgs/development/compilers/llvm/6/llvm.nix b/pkgs/development/compilers/llvm/6/llvm.nix index 1d96513a0ece..9237d442b776 100644 --- a/pkgs/development/compilers/llvm/6/llvm.nix +++ b/pkgs/development/compilers/llvm/6/llvm.nix @@ -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);