From b6bacc4bb2e9cc1e8ee7c810e697e93439b83529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 16 Jun 2017 16:52:58 +0100 Subject: [PATCH] llvmPackage_{3.4,3.5,3.7,3.8,3.9}: fix output of llvm-config llvm-config is a tool to output compile and linker flags, when compiling against llvm. The tool however outputs static library names despite libllvm is build as shared library on nixos. This was fixed for llvm 3.4, 3.5 and 3.7. For llvm 3.8 and 3.9 it printed the library extension twice (.so.so). This was fixed in 4.0 and the patch is backported to 3.8 and 3.9 in this pull request. ``` $ for i in 34 35 37 38 39; do echo "\nllvm-$i"; nix-shell -p llvmPackages_$i.llvm --run 'llvm-config --libnames'; done llvm-34 libLLVMInstrumentation.so libLLVMIRReader.so libLLVMAsmParser.so ... llvm-35 libLLVMLTO.so libLLVMObjCARCOpts.so libLLVMLinker.so libLLVMipo.so ... llvm-37 libLLVMLTO.so libLLVMObjCARCOpts.so libLLVMLinker.so libLLVMBitWriter.so ... llvm-38 libLLVM-3.8.1.so llvm-39 libLLVM-3.9.so ``` fixes #26713 --- pkgs/development/compilers/llvm/3.4/llvm.nix | 2 +- pkgs/development/compilers/llvm/3.5/llvm.nix | 3 ++- .../compilers/llvm/3.7/fix-llvm-config.patch | 13 ------------- pkgs/development/compilers/llvm/3.7/llvm.nix | 2 +- .../compilers/llvm/3.8/fix-llvm-config.patch | 11 +++++++++++ pkgs/development/compilers/llvm/3.8/llvm.nix | 3 ++- pkgs/development/compilers/llvm/3.9/llvm.nix | 8 ++++++++ .../compilers/llvm/{3.4 => }/fix-llvm-config.patch | 0 8 files changed, 25 insertions(+), 17 deletions(-) delete mode 100644 pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch create mode 100644 pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch rename pkgs/development/compilers/llvm/{3.4 => }/fix-llvm-config.patch (100%) diff --git a/pkgs/development/compilers/llvm/3.4/llvm.nix b/pkgs/development/compilers/llvm/3.4/llvm.nix index 73469fa122a9..79b0c9ff898d 100644 --- a/pkgs/development/compilers/llvm/3.4/llvm.nix +++ b/pkgs/development/compilers/llvm/3.4/llvm.nix @@ -36,7 +36,7 @@ in stdenv.mkDerivation rec { patches = stdenv.lib.optionals (!stdenv.isDarwin) [ # llvm-config --libfiles returns (non-existing) static libs - ./fix-llvm-config.patch + ../fix-llvm-config.patch ]; # hacky fix: created binaries need to be run before installation diff --git a/pkgs/development/compilers/llvm/3.5/llvm.nix b/pkgs/development/compilers/llvm/3.5/llvm.nix index 8bb5a6c684bb..c5503da9b838 100644 --- a/pkgs/development/compilers/llvm/3.5/llvm.nix +++ b/pkgs/development/compilers/llvm/3.5/llvm.nix @@ -53,7 +53,8 @@ in stdenv.mkDerivation rec { "-DCAN_TARGET_i386=false" ]; - patches = [ ./fix-15974.patch ]; + patches = [ ./fix-15974.patch ] ++ + stdenv.lib.optionals (!stdenv.isDarwin) [../fix-llvm-config.patch ]; postBuild = '' rm -fR $out diff --git a/pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch b/pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch deleted file mode 100644 index 772c49609275..000000000000 --- a/pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py -index eacefdf60bf..40d25f5cef8 100644 ---- a/utils/llvm-build/llvmbuild/main.py -+++ b/utils/llvm-build/llvmbuild/main.py -@@ -412,7 +412,7 @@ subdirectories = %s - if library_name is None: - library_name_as_cstr = '0' - else: -- library_name_as_cstr = '"lib%s.a"' % library_name -+ library_name_as_cstr = '"lib%s.so"' % library_name - f.write(' { "%s", %s, %d, { %s } },\n' % ( - name, library_name_as_cstr, is_installed, - ', '.join('"%s"' % dep diff --git a/pkgs/development/compilers/llvm/3.7/llvm.nix b/pkgs/development/compilers/llvm/3.7/llvm.nix index 1bdefd214f96..81aaa7cd65c2 100644 --- a/pkgs/development/compilers/llvm/3.7/llvm.nix +++ b/pkgs/development/compilers/llvm/3.7/llvm.nix @@ -55,7 +55,7 @@ in stdenv.mkDerivation rec { patches = stdenv.lib.optionals (!stdenv.isDarwin) [ # llvm-config --libfiles returns (non-existing) static libs - ./fix-llvm-config.patch + ../fix-llvm-config.patch ]; cmakeFlags = with stdenv; [ diff --git a/pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch b/pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch new file mode 100644 index 000000000000..6e56c67c8977 --- /dev/null +++ b/pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch @@ -0,0 +1,11 @@ +--- llvm.org/utils/llvm-build/llvmbuild/main.py 2015-10-07 00:24:35.000000000 +0100 ++++ llvm/utils/llvm-build/llvmbuild/main.py 2017-06-16 17:08:39.866586578 +0100 +@@ -413,7 +413,7 @@ + if library_name is None: + library_name_as_cstr = 'nullptr' + else: +- library_name_as_cstr = '"lib%s.a"' % library_name ++ library_name_as_cstr = '"lib%s.so"' % library_name + if is_installed: + is_installed_as_cstr = 'true' + else: diff --git a/pkgs/development/compilers/llvm/3.8/llvm.nix b/pkgs/development/compilers/llvm/3.8/llvm.nix index 9394179a8f94..ee0a50c93978 100644 --- a/pkgs/development/compilers/llvm/3.8/llvm.nix +++ b/pkgs/development/compilers/llvm/3.8/llvm.nix @@ -37,7 +37,8 @@ in stdenv.mkDerivation rec { # Fix a segfault in llc # See http://lists.llvm.org/pipermail/llvm-dev/2016-October/106500.html - patches = [ ./D17533-1.patch ]; + patches = [ ./D17533-1.patch ] ++ + stdenv.lib.optionals (!stdenv.isDarwin) [./fix-llvm-config.patch]; # hacky fix: New LLVM releases require a newer OS X SDK than # 10.9. This is a temporary measure until nixpkgs darwin support is diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix index 964b6232fb54..654e1ce0023b 100644 --- a/pkgs/development/compilers/llvm/3.9/llvm.nix +++ b/pkgs/development/compilers/llvm/3.9/llvm.nix @@ -58,6 +58,14 @@ in stdenv.mkDerivation rec { propagatedBuildInputs = [ ncurses zlib ]; + patches = [ + # fix output of llvm-config (fixed in llvm 4.0) + (fetchpatch { + url = https://github.com/llvm-mirror/llvm/commit/5340b5b3d970069aebf3dde49d8964583742e01a.patch; + sha256 = "095f8knplwqbc2p7rad1kq8633i34qynni9jna93an7kyc80wdxl"; + }) + ]; + postPatch = "" + '' patch -p1 --reverse < ${fetchpatch { diff --git a/pkgs/development/compilers/llvm/3.4/fix-llvm-config.patch b/pkgs/development/compilers/llvm/fix-llvm-config.patch similarity index 100% rename from pkgs/development/compilers/llvm/3.4/fix-llvm-config.patch rename to pkgs/development/compilers/llvm/fix-llvm-config.patch