git.iko.soy/typeable/nixpkgs
on master help sign in
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

commitb6bacc4bb2e9cc1e8ee7c810e697e93439b83529 authorJörg Thalheim <joerg@thalheim.io> dateFri 16 Jun 2017, 16:52 (9 years ago) parentfe9c7ad
8 files changed+25−17
pkgs/development/compilers/llvm/3.4/llvm.nix+1−1 pkgs/development/compilers/llvm/3.5/llvm.nix+2−1 pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch−13 pkgs/development/compilers/llvm/3.7/llvm.nix+1−1 pkgs/development/compilers/llvm/3.8/fix-llvm-config.patch+11 pkgs/development/compilers/llvm/3.8/llvm.nix+2−1 pkgs/development/compilers/llvm/3.9/llvm.nix+8 pkgs/development/compilers/llvm/3.4/fix-llvm-config.patch → pkgs/development/compilers/llvm/fix-llvm-config.patch
pkgs/development/compilers/llvm/3.4/llvm.nix+1−1
@@ -36,7 +36,7 @@ in stdenv.mkDerivation rec {
3636
3737 patches = stdenv.lib.optionals (!stdenv.isDarwin) [
3838 # llvm-config --libfiles returns (non-existing) static libs
39− ./fix-llvm-config.patch
39+ ../fix-llvm-config.patch
4040 ];
4141
4242 # hacky fix: created binaries need to be run before installation
pkgs/development/compilers/llvm/3.5/llvm.nix+2−1
@@ -53,7 +53,8 @@ in stdenv.mkDerivation rec {
5353 "-DCAN_TARGET_i386=false"
5454 ];
5555
56− patches = [ ./fix-15974.patch ];
56+ patches = [ ./fix-15974.patch ] ++
57+ stdenv.lib.optionals (!stdenv.isDarwin) [../fix-llvm-config.patch ];
5758
5859 postBuild = ''
5960 rm -fR $out
pkgs/development/compilers/llvm/3.7/fix-llvm-config.patchdeleted−13
@@ -1,13 +0,0 @@
1−diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
2−index eacefdf60bf..40d25f5cef8 100644
3−--- a/utils/llvm-build/llvmbuild/main.py
4−+++ b/utils/llvm-build/llvmbuild/main.py
5−@@ -412,7 +412,7 @@ subdirectories = %s
6− if library_name is None:
7− library_name_as_cstr = '0'
8− else:
9−- library_name_as_cstr = '"lib%s.a"' % library_name
10−+ library_name_as_cstr = '"lib%s.so"' % library_name
11− f.write(' { "%s", %s, %d, { %s } },\n' % (
12− name, library_name_as_cstr, is_installed,
13− ', '.join('"%s"' % dep
pkgs/development/compilers/llvm/3.7/llvm.nix+1−1
@@ -55,7 +55,7 @@ in stdenv.mkDerivation rec {
5555
5656 patches = stdenv.lib.optionals (!stdenv.isDarwin) [
5757 # llvm-config --libfiles returns (non-existing) static libs
58− ./fix-llvm-config.patch
58+ ../fix-llvm-config.patch
5959 ];
6060
6161 cmakeFlags = with stdenv; [
pkgs/development/compilers/llvm/3.8/fix-llvm-config.patchnew file+11
@@ -0,0 +1,11 @@
1+--- llvm.org/utils/llvm-build/llvmbuild/main.py 2015-10-07 00:24:35.000000000 +0100
2++++ llvm/utils/llvm-build/llvmbuild/main.py 2017-06-16 17:08:39.866586578 +0100
3+@@ -413,7 +413,7 @@
4+ if library_name is None:
5+ library_name_as_cstr = 'nullptr'
6+ else:
7+- library_name_as_cstr = '"lib%s.a"' % library_name
8++ library_name_as_cstr = '"lib%s.so"' % library_name
9+ if is_installed:
10+ is_installed_as_cstr = 'true'
11+ else:
pkgs/development/compilers/llvm/3.8/llvm.nix+2−1
@@ -37,7 +37,8 @@ in stdenv.mkDerivation rec {
3737
3838 # Fix a segfault in llc
3939 # See http://lists.llvm.org/pipermail/llvm-dev/2016-October/106500.html
40− patches = [ ./D17533-1.patch ];
40+ patches = [ ./D17533-1.patch ] ++
41+ stdenv.lib.optionals (!stdenv.isDarwin) [./fix-llvm-config.patch];
4142
4243 # hacky fix: New LLVM releases require a newer OS X SDK than
4344 # 10.9. This is a temporary measure until nixpkgs darwin support is
pkgs/development/compilers/llvm/3.9/llvm.nix+8
@@ -58,6 +58,14 @@ in stdenv.mkDerivation rec {
5858
5959 propagatedBuildInputs = [ ncurses zlib ];
6060
61+ patches = [
62+ # fix output of llvm-config (fixed in llvm 4.0)
63+ (fetchpatch {
64+ url = https://github.com/llvm-mirror/llvm/commit/5340b5b3d970069aebf3dde49d8964583742e01a.patch;
65+ sha256 = "095f8knplwqbc2p7rad1kq8633i34qynni9jna93an7kyc80wdxl";
66+ })
67+ ];
68+
6169 postPatch = ""
6270 + ''
6371 patch -p1 --reverse < ${fetchpatch {
pkgs/development/compilers/llvm/3.4/fix-llvm-config.patch → pkgs/development/compilers/llvm/fix-llvm-config.patchrenamed

The content is the same.