From d417ada9a6b13e4a070dd4eb7309adeb708db432 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 17 Apr 2018 09:50:21 -0500 Subject: [PATCH] clang: only link if LLVMgold exists buildEnv now errors with broken symlinks. Lots of things like this still exist. Discussion in #39038. (cherry picked from commit 7b73c7f49a0a4673987b661b9d679ec595704d89) --- pkgs/development/compilers/llvm/3.4/clang.nix | 5 ++++- pkgs/development/compilers/llvm/3.5/clang.nix | 5 ++++- pkgs/development/compilers/llvm/3.7/clang/default.nix | 5 ++++- pkgs/development/compilers/llvm/3.8/clang/default.nix | 5 ++++- pkgs/development/compilers/llvm/3.9/clang/default.nix | 5 ++++- pkgs/development/compilers/llvm/4/clang/default.nix | 5 ++++- pkgs/development/compilers/llvm/6/clang/default.nix | 5 ++++- 7 files changed, 28 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/llvm/3.4/clang.nix b/pkgs/development/compilers/llvm/3.4/clang.nix index 10510c750354..863e7eb22474 100644 --- a/pkgs/development/compilers/llvm/3.4/clang.nix +++ b/pkgs/development/compilers/llvm/3.4/clang.nix @@ -29,7 +29,10 @@ stdenv.mkDerivation { # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix postInstall = '' - ln -sv ${llvm}/lib/LLVMgold.so $out/lib + if [ -e ${llvm}/lib/LLVMgold.so ]; then + ln -sv ${llvm}/lib/LLVMgold.so $out/lib + fi + ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/ ''; diff --git a/pkgs/development/compilers/llvm/3.5/clang.nix b/pkgs/development/compilers/llvm/3.5/clang.nix index f15c989ef510..b61118439ee7 100644 --- a/pkgs/development/compilers/llvm/3.5/clang.nix +++ b/pkgs/development/compilers/llvm/3.5/clang.nix @@ -31,7 +31,10 @@ in stdenv.mkDerivation { # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix postInstall = '' - ln -sv ${llvm}/lib/LLVMgold.so $out/lib + if [ -e ${llvm}/lib/LLVMgold.so ]; then + ln -sv ${llvm}/lib/LLVMgold.so $out/lib + fi + ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/ ln -sv $out/bin/clang $out/bin/cpp ''; diff --git a/pkgs/development/compilers/llvm/3.7/clang/default.nix b/pkgs/development/compilers/llvm/3.7/clang/default.nix index f27e3f0089e2..a63706e95cfb 100644 --- a/pkgs/development/compilers/llvm/3.7/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.7/clang/default.nix @@ -32,7 +32,10 @@ let # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix postInstall = '' - ln -sv ${llvm}/lib/LLVMgold.so $out/lib + if [ -e ${llvm}/lib/LLVMgold.so ]; then + ln -sv ${llvm}/lib/LLVMgold.so $out/lib + fi + ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/ ln -sv $out/bin/clang $out/bin/cpp ''; diff --git a/pkgs/development/compilers/llvm/3.8/clang/default.nix b/pkgs/development/compilers/llvm/3.8/clang/default.nix index 0147485dd58d..c8b2fec5e51d 100644 --- a/pkgs/development/compilers/llvm/3.8/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.8/clang/default.nix @@ -34,7 +34,10 @@ let # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix postInstall = '' - ln -sv ${llvm}/lib/LLVMgold.so $out/lib + if [ -e ${llvm}/lib/LLVMgold.so ]; then + ln -sv ${llvm}/lib/LLVMgold.so $out/lib + fi + ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/ ln -sv $out/bin/clang $out/bin/cpp diff --git a/pkgs/development/compilers/llvm/3.9/clang/default.nix b/pkgs/development/compilers/llvm/3.9/clang/default.nix index aafe30e4c9b3..fabc6a39d9f4 100644 --- a/pkgs/development/compilers/llvm/3.9/clang/default.nix +++ b/pkgs/development/compilers/llvm/3.9/clang/default.nix @@ -36,7 +36,10 @@ let # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix postInstall = '' - ln -sv ${llvm}/lib/LLVMgold.so $out/lib + if [ -e ${llvm}/lib/LLVMgold.so ]; then + ln -sv ${llvm}/lib/LLVMgold.so $out/lib + fi + ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/ ln -sv $out/bin/clang $out/bin/cpp diff --git a/pkgs/development/compilers/llvm/4/clang/default.nix b/pkgs/development/compilers/llvm/4/clang/default.nix index 5531fd2ab77e..e8f025c24ede 100644 --- a/pkgs/development/compilers/llvm/4/clang/default.nix +++ b/pkgs/development/compilers/llvm/4/clang/default.nix @@ -52,7 +52,10 @@ let # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix postInstall = '' - ln -sv ${llvm}/lib/LLVMgold.so $out/lib + if [ -e ${llvm}/lib/LLVMgold.so ]; then + ln -sv ${llvm}/lib/LLVMgold.so $out/lib + fi + ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/ ln -sv $out/bin/clang $out/bin/cpp diff --git a/pkgs/development/compilers/llvm/6/clang/default.nix b/pkgs/development/compilers/llvm/6/clang/default.nix index 919efdc8ef97..c540a8267e97 100644 --- a/pkgs/development/compilers/llvm/6/clang/default.nix +++ b/pkgs/development/compilers/llvm/6/clang/default.nix @@ -53,7 +53,10 @@ let # Clang expects to find LLVMgold in its own prefix # Clang expects to find sanitizer libraries in its own prefix postInstall = '' - ln -sv ${llvm}/lib/LLVMgold.so $out/lib + if [ -e ${llvm}/lib/LLVMgold.so ]; then + ln -sv ${llvm}/lib/LLVMgold.so $out/lib + fi + ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/ ln -sv $out/bin/clang $out/bin/cpp