[129361] trunk/dports/lang

larryv at macports.org larryv at macports.org
Wed Dec 10 16:07:47 PST 2014


Revision: 129361
          https://trac.macports.org/changeset/129361
Author:   larryv at macports.org
Date:     2014-12-10 16:07:46 -0800 (Wed, 10 Dec 2014)
Log Message:
-----------
{clang,llvm}-3.{4,5,6}: Use full paths for dylib IDs
    
Most of the installed binaries still link to at least one dylib using
@rpath or @executable_path. Patching the make rules should catch all of
them. Probably.
    
(Jeremy signed off via email.)

Modified Paths:
--------------
    trunk/dports/lang/llvm-3.4/Portfile
    trunk/dports/lang/llvm-3.5/Portfile
    trunk/dports/lang/llvm-3.6/Portfile

Added Paths:
-----------
    trunk/dports/lang/llvm-3.4/files/fix-clang-dylib-ids.patch
    trunk/dports/lang/llvm-3.4/files/fix-dylib-ids.patch
    trunk/dports/lang/llvm-3.5/files/fix-dylib-ids.patch
    trunk/dports/lang/llvm-3.5/files/fix-libclang_rt-dylib-ids.patch
    trunk/dports/lang/llvm-3.6/files/fix-dylib-ids.patch
    trunk/dports/lang/llvm-3.6/files/fix-libclang_rt-dylib-ids.patch

Removed Paths:
-------------
    trunk/dports/lang/llvm-3.4/files/tiger-shlib-clang.patch
    trunk/dports/lang/llvm-3.4/files/tiger-shlib.patch

Modified: trunk/dports/lang/llvm-3.4/Portfile
===================================================================
--- trunk/dports/lang/llvm-3.4/Portfile	2014-12-10 23:56:05 UTC (rev 129360)
+++ trunk/dports/lang/llvm-3.4/Portfile	2014-12-11 00:07:46 UTC (rev 129361)
@@ -7,7 +7,8 @@
 set llvm_version        3.4
 set llvm_version_no_dot 34
 name                    llvm-${llvm_version}
-subport                 clang-${llvm_version} { revision 2 }
+revision                1
+subport                 clang-${llvm_version} { revision 3 }
 set suffix              mp-${llvm_version}
 set sub_prefix          ${prefix}/libexec/llvm-${llvm_version}
 dist_subdir             llvm
@@ -107,13 +108,13 @@
 
 patchfiles      install_target.patch \
                 0001-Fix-regular-expression-to-work-with-multiple-digit-v.patch \
-                tiger-shlib.patch
+                fix-dylib-ids.patch
 
 patch.pre_args  -p1
 
 if {${subport} eq "clang-${llvm_version}"} {
     patchfiles-append   move-clang-resources.patch \
-                        tiger-shlib-clang.patch \
+                        fix-clang-dylib-ids.patch \
                         tiger-libclang.patch \
                         scan-build-PR-35006.patch \
                         0001-Comment-out-SL-cctools-workaround.patch \
@@ -286,35 +287,11 @@
         #    set basename [string map "${destroot}${sub_prefix}/share/man/man1/ {}" ${man}]
         #    file rename ${man} ${destroot}${prefix}/share/man/man1/[string map ".1 -${suffix}.1" ${basename}]
         #}
-
-        foreach liba [glob ${destroot}${sub_prefix}/lib/*dylib] {
-            set liba_nodr [string map "${destroot} {}" ${liba}]
-            system "install_name_tool -id ${liba_nodr} ${liba}"
-
-            foreach libb [glob ${destroot}${sub_prefix}/lib/*dylib] {
-                set libb_base [string map "${destroot}${sub_prefix}/lib/ {}" ${libb}]
-                set libb_nodr [string map "${destroot} {}" ${libb}]
-
-                system "install_name_tool -change @executable_path/../lib/${libb_base} ${libb_nodr} ${liba}"
-                system "install_name_tool -change @rpath/${libb_base} ${libb_nodr} ${liba}"
-            }
-        }
     } elseif {${subport} eq "clang-${llvm_version}"} {
         system "ditto ${worksrcpath}/projects/libcxx/include ${destroot}${sub_prefix}/lib/c++/v1"
 
         # http://trac.macports.org/ticket/33207
         ln -s ${prefix}/libexec/ld64/ld ${destroot}${sub_prefix}/bin/ld
-
-        system "install_name_tool -id ${sub_prefix}/lib/libclang.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @executable_path/../lib/libLLVM-${llvm_version}svn.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}svn.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @executable_path/../lib/libLLVM-${llvm_version}.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @rpath/libLLVM-${llvm_version}svn.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}svn.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @rpath/libLLVM-${llvm_version}.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-
-        if {${os.major} > 9} {
-            # http://trac.macports.org/ticket/38527
-            system "install_name_tool -id ${sub_prefix}/lib/clang/${llvm_version}/lib/darwin/libclang_rt.asan_osx_dynamic.dylib ${destroot}${sub_prefix}/lib/clang/${llvm_version}/lib/darwin/libclang_rt.asan_osx_dynamic.dylib"
-        }
     }
 }
 

Copied: trunk/dports/lang/llvm-3.4/files/fix-clang-dylib-ids.patch (from rev 129360, trunk/dports/lang/llvm-3.4/files/tiger-shlib-clang.patch)
===================================================================
--- trunk/dports/lang/llvm-3.4/files/fix-clang-dylib-ids.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-3.4/files/fix-clang-dylib-ids.patch	2014-12-11 00:07:46 UTC (rev 129361)
@@ -0,0 +1,40 @@
+Index: llvm-3.4.2.src/tools/clang/runtime/compiler-rt/Makefile
+===================================================================
+--- llvm-3.4.2.src.orig/tools/clang/runtime/compiler-rt/Makefile
++++ llvm-3.4.2.src/tools/clang/runtime/compiler-rt/Makefile
+@@ -215,8 +215,6 @@ $(ResourceLibDir)/$1/libclang_rt.%.dylib
+ 		$(ResourceLibDir)/$1/.dir
+ 	$(Echo) Copying runtime library $1/$$* to build dir
+ 	$(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.dylib $$@
+-	$(Echo) Fixing LC_ID_DYLIB of $$@
+-	$(Verb) install_name_tool $$@ -id $$@
+ RuntimeLibrary.$1: \
+ 		$(RuntimeLibrary.$1.Configs:%=$(ResourceLibDir)/$1/libclang_rt.%)
+ .PHONY: RuntimeLibrary.$1
+@@ -236,6 +234,7 @@ $(PROJ_resources_lib)/$1/libclang_rt.%.d
+ 		$(ResourceLibDir)/$1/libclang_rt.%.dylib | $(PROJ_resources_lib)/$1
+ 	$(Echo) Installing compiler runtime library: $1/$$*
+ 	$(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1
++	$(Verb) install_name_tool $$@ -id $$(patsubst $(DESTDIR)%,%,$$@)
+ 
+ # Rule to install runtime libraries.
+ RuntimeLibraryInstall.$1: \
+Index: llvm-3.4.2.src/tools/clang/tools/libclang/Makefile
+===================================================================
+--- llvm-3.4.2.src.orig/tools/clang/tools/libclang/Makefile
++++ llvm-3.4.2.src/tools/clang/tools/libclang/Makefile
+@@ -49,12 +49,8 @@ ifeq ($(HOST_OS),Darwin)
+     # Extra options to override libtool defaults.
+     LLVMLibsOptions += -Wl,-dead_strip
+ 
+-    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
+-    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
+-    ifneq ($(DARWIN_VERS),8)
+-       LLVMLibsOptions += -Wl,-install_name \
+-                          -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
+-    endif
++    # $(CLANG_LEVEL)/../../Makefile.rules has been patched to set the
++    # install name for all dylibs.
+ 
+     # If we're doing an Apple-style build, add the LTO object path.
+     ifeq ($(RC_XBS),YES)

Copied: trunk/dports/lang/llvm-3.4/files/fix-dylib-ids.patch (from rev 129360, trunk/dports/lang/llvm-3.4/files/tiger-shlib.patch)
===================================================================
--- trunk/dports/lang/llvm-3.4/files/fix-dylib-ids.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-3.4/files/fix-dylib-ids.patch	2014-12-11 00:07:46 UTC (rev 129361)
@@ -0,0 +1,62 @@
+Index: llvm-3.4.2.src/tools/llvm-shlib/Makefile
+===================================================================
+--- llvm-3.4.2.src.orig/tools/llvm-shlib/Makefile
++++ llvm-3.4.2.src/tools/llvm-shlib/Makefile
+@@ -55,13 +55,8 @@ ifeq ($(HOST_OS),Darwin)
+     LLVMLibsOptions    := $(LLVMLibsOptions)  \
+                          -Wl,-dead_strip
+ 
+-    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
+-    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
+-    ifneq ($(DARWIN_VERS),8)
+-       LLVMLibsOptions    := $(LLVMLibsOptions)  \
+-                            -Wl,-install_name \
+-                            -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
+-    endif
++    # $(LEVEL)/Makefile.rules has been patched to set the install name
++    # for all dylibs.
+ endif
+ 
+ ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD OpenBSD GNU Bitrig))
+Index: llvm-3.4.2.src/tools/lto/Makefile
+===================================================================
+--- llvm-3.4.2.src.orig/tools/lto/Makefile
++++ llvm-3.4.2.src/tools/lto/Makefile
+@@ -41,13 +41,8 @@ ifeq ($(HOST_OS),Darwin)
+     LLVMLibsOptions    := $(LLVMLibsOptions)  \
+                          -Wl,-dead_strip
+ 
+-    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
+-    DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
+-    ifneq ($(DARWIN_VERS),8)
+-       LLVMLibsOptions    := $(LLVMLibsOptions)  \
+-                            -Wl,-install_name \
+-                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
+-    endif
++    # $(LEVEL)/Makefile.rules has been patched to set the install name
++    # for all dylibs.
+ 
+     # If we're doing an Apple-style build, add the LTO object path.
+     ifeq ($(RC_XBS),YES)
+Index: llvm-3.4.2.src/Makefile.rules
+===================================================================
+--- llvm-3.4.2.src.orig/Makefile.rules
++++ llvm-3.4.2.src/Makefile.rules
+@@ -581,6 +581,17 @@ ifdef SHARED_LIBRARY
+ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ ifneq ($(HOST_OS),Darwin)
+   LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
++else
++  ifeq ($(DARWIN_MAJVERS),4)
++    LD.Flags += -Wl,-dylib_install_name
++  else
++    LD.Flags += -Wl,-install_name
++  endif
++  ifdef LOADABLE_MODULE
++    LD.Flags += -Wl,"$(PROJ_libdir)/$(LIBRARYNAME)$(SHLIBEXT)"
++  else
++    LD.Flags += -Wl,"$(PROJ_libdir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)"
++  endif
+ endif
+ endif
+ endif

Deleted: trunk/dports/lang/llvm-3.4/files/tiger-shlib-clang.patch
===================================================================
--- trunk/dports/lang/llvm-3.4/files/tiger-shlib-clang.patch	2014-12-10 23:56:05 UTC (rev 129360)
+++ trunk/dports/lang/llvm-3.4/files/tiger-shlib-clang.patch	2014-12-11 00:07:46 UTC (rev 129361)
@@ -1,16 +0,0 @@
---- llvm-3.0.src.orig/tools/clang/tools/libclang/Makefile	2011-07-09 14:35:58.000000000 -0700
-+++ llvm-3.0.src/tools/clang/tools/libclang/Makefile	2012-04-20 10:09:40.000000000 -0700
-@@ -38,9 +38,11 @@ ifeq ($(HOST_OS),Darwin)
-     # Extra options to override libtool defaults.
-     LLVMLibsOptions += -Wl,-dead_strip -Wl,-seg1addr,0xE0000000 
- 
--    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
-     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
--    ifneq ($(DARWIN_VERS),8)
-+    ifeq ($(DARWIN_VERS),8)
-+       LLVMLibsOptions += -Wl,-install_name \
-+                          -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
-+    else
-        LLVMLibsOptions += -Wl,-install_name \
-                           -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
-     endif

Deleted: trunk/dports/lang/llvm-3.4/files/tiger-shlib.patch
===================================================================
--- trunk/dports/lang/llvm-3.4/files/tiger-shlib.patch	2014-12-10 23:56:05 UTC (rev 129360)
+++ trunk/dports/lang/llvm-3.4/files/tiger-shlib.patch	2014-12-11 00:07:46 UTC (rev 129361)
@@ -1,36 +0,0 @@
-diff -Naurp trunk.orig/tools/llvm-shlib/Makefile trunk/tools/llvm-shlib/Makefile
---- trunk.orig/tools/llvm-shlib/Makefile	2012-10-12 00:37:16.000000000 -0700
-+++ trunk/tools/llvm-shlib/Makefile	2012-10-12 00:39:43.000000000 -0700
-@@ -54,9 +54,12 @@ ifeq ($(HOST_OS),Darwin)
-                          -Wl,-dead_strip \
-                          -Wl,-seg1addr -Wl,0xE0000000 
- 
--    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
-     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
--    ifneq ($(DARWIN_VERS),8)
-+    ifeq ($(DARWIN_VERS),8)
-+       LLVMLibsOptions    := $(LLVMLibsOptions)  \
-+                            -Wl,-dylib_install_name \
-+                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
-+    else
-        LLVMLibsOptions    := $(LLVMLibsOptions)  \
-                             -Wl,-install_name \
-                             -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
-diff -Naurp trunk.orig/tools/lto/Makefile trunk/tools/lto/Makefile
---- trunk.orig/tools/lto/Makefile	2012-10-12 00:37:16.000000000 -0700
-+++ trunk/tools/lto/Makefile	2012-10-12 00:39:43.000000000 -0700
-@@ -42,9 +42,12 @@ ifeq ($(HOST_OS),Darwin)
-                          -Wl,-dead_strip \
-                          -Wl,-seg1addr -Wl,0xE0000000 
- 
--    # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
-     DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
--    ifneq ($(DARWIN_VERS),8)
-+    ifeq ($(DARWIN_VERS),8)
-+       LLVMLibsOptions    := $(LLVMLibsOptions)  \
-+                            -Wl,-dylib_install_name \
-+                            -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
-+    else
-        LLVMLibsOptions    := $(LLVMLibsOptions)  \
-                             -Wl,-install_name \
-                             -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"

Modified: trunk/dports/lang/llvm-3.5/Portfile
===================================================================
--- trunk/dports/lang/llvm-3.5/Portfile	2014-12-10 23:56:05 UTC (rev 129360)
+++ trunk/dports/lang/llvm-3.5/Portfile	2014-12-11 00:07:46 UTC (rev 129361)
@@ -76,6 +76,7 @@
 #default_variants-append +assertions
 
 version                 ${llvm_version}.0
+revision                1
 epoch                   1
 master_sites            http://llvm.org/releases/${version}
 use_xz                  yes
@@ -112,7 +113,8 @@
                     rmd160  28c64aacabae5d37f0ab32ddfe96d451e540e554 \
                     sha256  2981beb378afb5aa5c50ed017720a42a33e77e902c7086ad2d412ef4fa931f69
 
-patchfiles      install_target.patch
+patchfiles      install_target.patch \
+                fix-dylib-ids.patch
 
 patch.pre_args  -p1
 
@@ -124,7 +126,8 @@
                          clang-format.patch \
                          clang-modernize.patch \
                          snowleopard-cmath.patch \
-                         move-clang-resources.patch
+                         move-clang-resources.patch \
+                         fix-libclang_rt-dylib-ids.patch
 
     build.target        clang-only
     destroot.target     install-clang
@@ -287,35 +290,11 @@
         #    set basename [string map "${destroot}${sub_prefix}/share/man/man1/ {}" ${man}]
         #    file rename ${man} ${destroot}${prefix}/share/man/man1/[string map ".1 -${suffix}.1" ${basename}]
         #}
-
-        foreach liba [glob ${destroot}${sub_prefix}/lib/*dylib] {
-            set liba_nodr [string map "${destroot} {}" ${liba}]
-            system "install_name_tool -id ${liba_nodr} ${liba}"
-
-            foreach libb [glob ${destroot}${sub_prefix}/lib/*dylib] {
-                set libb_base [string map "${destroot}${sub_prefix}/lib/ {}" ${libb}]
-                set libb_nodr [string map "${destroot} {}" ${libb}]
-
-                system "install_name_tool -change @executable_path/../lib/${libb_base} ${libb_nodr} ${liba}"
-                system "install_name_tool -change @rpath/${libb_base} ${libb_nodr} ${liba}"
-            }
-        }
     } elseif {${subport} eq "clang-${llvm_version}"} {
         system "ditto ${worksrcpath}/projects/libcxx/include ${destroot}${sub_prefix}/lib/c++/v1"
 
         # http://trac.macports.org/ticket/33207
         ln -s ${prefix}/libexec/ld64/ld ${destroot}${sub_prefix}/bin/ld
-
-        system "install_name_tool -id ${sub_prefix}/lib/libclang.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @executable_path/../lib/libLLVM-${llvm_version}svn.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}svn.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @executable_path/../lib/libLLVM-${llvm_version}.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @rpath/libLLVM-${llvm_version}svn.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}svn.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @rpath/libLLVM-${llvm_version}.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-
-        if {${os.major} > 9} {
-            # http://trac.macports.org/ticket/38527
-            system "install_name_tool -id ${sub_prefix}/lib/clang/${llvm_version}.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib ${destroot}${sub_prefix}/lib/clang/${llvm_version}.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib"
-        }
     }
 }
 

Added: trunk/dports/lang/llvm-3.5/files/fix-dylib-ids.patch
===================================================================
--- trunk/dports/lang/llvm-3.5/files/fix-dylib-ids.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-3.5/files/fix-dylib-ids.patch	2014-12-11 00:07:46 UTC (rev 129361)
@@ -0,0 +1,18 @@
+Index: llvm-3.5.0.src/Makefile.rules
+===================================================================
+--- llvm-3.5.0.src.orig/Makefile.rules
++++ llvm-3.5.0.src/Makefile.rules
+@@ -599,7 +599,12 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), 
+ ifneq ($(HOST_OS),Darwin)
+   LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
+ else
+-  LD.Flags += -Wl,-install_name  -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
++  LD.Flags += -Wl,-install_name
++  ifdef LOADABLE_MODULE
++    LD.Flags += -Wl,"$(PROJ_libdir)/$(LIBRARYNAME)$(SHLIBEXT)"
++  else
++    LD.Flags += -Wl,"$(PROJ_libdir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)"
++  endif
+ endif
+ endif
+ endif

Added: trunk/dports/lang/llvm-3.5/files/fix-libclang_rt-dylib-ids.patch
===================================================================
--- trunk/dports/lang/llvm-3.5/files/fix-libclang_rt-dylib-ids.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-3.5/files/fix-libclang_rt-dylib-ids.patch	2014-12-11 00:07:46 UTC (rev 129361)
@@ -0,0 +1,21 @@
+Index: llvm-3.5.0.src/tools/clang/runtime/compiler-rt/Makefile
+===================================================================
+--- llvm-3.5.0.src.orig/tools/clang/runtime/compiler-rt/Makefile
++++ llvm-3.5.0.src/tools/clang/runtime/compiler-rt/Makefile
+@@ -221,8 +221,6 @@ $(ResourceLibDir)/$1/libclang_rt.%.dylib
+ 		$(ResourceLibDir)/$1/.dir
+ 	$(Echo) Copying runtime library $1/$$* to build dir
+ 	$(Verb) cp $(PROJ_OBJ_DIR)/clang_$1/$$*/libcompiler_rt.dylib $$@
+-	$(Echo) Fixing LC_ID_DYLIB of $$@
+-	$(Verb) install_name_tool $$@ -id $$@
+ RuntimeLibrary.$1: \
+ 		$(RuntimeLibrary.$1.Configs:%=$(ResourceLibDir)/$1/libclang_rt.%)
+ .PHONY: RuntimeLibrary.$1
+@@ -242,6 +240,7 @@ $(PROJ_resources_lib)/$1/libclang_rt.%.d
+ 		$(ResourceLibDir)/$1/libclang_rt.%.dylib | $(PROJ_resources_lib)/$1
+ 	$(Echo) Installing compiler runtime library: $1/$$*
+ 	$(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1
++	$(Verb) install_name_tool $$@ -id $$(patsubst $(DESTDIR)%,%,$$@)
+ 
+ # Rule to install runtime libraries.
+ RuntimeLibraryInstall.$1: \

Modified: trunk/dports/lang/llvm-3.6/Portfile
===================================================================
--- trunk/dports/lang/llvm-3.6/Portfile	2014-12-10 23:56:05 UTC (rev 129360)
+++ trunk/dports/lang/llvm-3.6/Portfile	2014-12-11 00:07:46 UTC (rev 129361)
@@ -93,7 +93,8 @@
     }
 }
 
-patchfiles      install_target.patch
+patchfiles      install_target.patch \
+                fix-dylib-ids.patch
 
 patch.pre_args  -p1
 
@@ -103,7 +104,8 @@
                          clang-format.patch \
                          clang-modernize.patch \
                          snowleopard-cmath.patch \
-                         move-clang-resources.patch
+                         move-clang-resources.patch \
+                         fix-libclang_rt-dylib-ids.patch
 
     build.target        clang-only
     destroot.target     install-clang
@@ -266,35 +268,11 @@
         #    set basename [string map "${destroot}${sub_prefix}/share/man/man1/ {}" ${man}]
         #    file rename ${man} ${destroot}${prefix}/share/man/man1/[string map ".1 -${suffix}.1" ${basename}]
         #}
-
-        foreach liba [glob ${destroot}${sub_prefix}/lib/*dylib] {
-            set liba_nodr [string map "${destroot} {}" ${liba}]
-            system "install_name_tool -id ${liba_nodr} ${liba}"
-
-            foreach libb [glob ${destroot}${sub_prefix}/lib/*dylib] {
-                set libb_base [string map "${destroot}${sub_prefix}/lib/ {}" ${libb}]
-                set libb_nodr [string map "${destroot} {}" ${libb}]
-
-                system "install_name_tool -change @executable_path/../lib/${libb_base} ${libb_nodr} ${liba}"
-                system "install_name_tool -change @rpath/${libb_base} ${libb_nodr} ${liba}"
-            }
-        }
     } elseif {${subport} eq "clang-${llvm_version}"} {
         system "ditto ${worksrcpath}/projects/libcxx/include ${destroot}${sub_prefix}/lib/c++/v1"
 
         # http://trac.macports.org/ticket/33207
         ln -s ${prefix}/libexec/ld64/ld ${destroot}${sub_prefix}/bin/ld
-
-        system "install_name_tool -id ${sub_prefix}/lib/libclang.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @executable_path/../lib/libLLVM-${llvm_version}svn.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}svn.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @executable_path/../lib/libLLVM-${llvm_version}.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @rpath/libLLVM-${llvm_version}svn.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}svn.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-        system "install_name_tool -change @rpath/libLLVM-${llvm_version}.dylib ${sub_prefix}/lib/libLLVM-${llvm_version}.dylib ${destroot}${sub_prefix}/lib/libclang.dylib"
-
-        if {${os.major} > 9} {
-            # http://trac.macports.org/ticket/38527
-            system "install_name_tool -id ${sub_prefix}/lib/clang/${llvm_version}.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib ${destroot}${sub_prefix}/lib/clang/${llvm_version}.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib"
-        }
     }
 }
 

Added: trunk/dports/lang/llvm-3.6/files/fix-dylib-ids.patch
===================================================================
--- trunk/dports/lang/llvm-3.6/files/fix-dylib-ids.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-3.6/files/fix-dylib-ids.patch	2014-12-11 00:07:46 UTC (rev 129361)
@@ -0,0 +1,18 @@
+diff --git a/Makefile.rules b/Makefile.rules
+index c8c971f..78b9c51 100644
+--- a/Makefile.rules
++++ b/Makefile.rules
+@@ -598,7 +598,12 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ ifneq ($(HOST_OS),Darwin)
+   LD.Flags += $(RPATH) -Wl,'$$ORIGIN'
+ else
+-  LD.Flags += -Wl,-install_name  -Wl,"@rpath/lib$(LIBRARYNAME)$(SHLIBEXT)"
++  LD.Flags += -Wl,-install_name
++  ifdef LOADABLE_MODULE
++    LD.Flags += -Wl,"$(PROJ_libdir)/$(LIBRARYNAME)$(SHLIBEXT)"
++  else
++    LD.Flags += -Wl,"$(PROJ_libdir)/$(SharedPrefix)$(LIBRARYNAME)$(SHLIBEXT)"
++  endif
+ endif
+ endif
+ endif

Added: trunk/dports/lang/llvm-3.6/files/fix-libclang_rt-dylib-ids.patch
===================================================================
--- trunk/dports/lang/llvm-3.6/files/fix-libclang_rt-dylib-ids.patch	                        (rev 0)
+++ trunk/dports/lang/llvm-3.6/files/fix-libclang_rt-dylib-ids.patch	2014-12-11 00:07:46 UTC (rev 129361)
@@ -0,0 +1,12 @@
+diff --git a/tools/clang/runtime/compiler-rt/Makefile b/tools/clang/runtime/compiler-rt/Makefile
+index f06ef99..ca9bcd9 100644
+--- a/tools/clang/runtime/compiler-rt/Makefile
++++ b/tools/clang/runtime/compiler-rt/Makefile
+@@ -234,6 +234,7 @@ $(PROJ_resources_lib)/$1/libclang_rt.%.dylib: \
+ 		$(ResourceLibDir)/$1/libclang_rt.%.dylib | $(PROJ_resources_lib)/$1
+ 	$(Echo) Installing compiler runtime library: $1/$$*
+ 	$(Verb) $(DataInstall) $$< $(PROJ_resources_lib)/$1
++	$(Verb) install_name_tool $$@ -id $$(patsubst $(DESTDIR)%,%,$$@)
+ 
+ # Rule to install runtime libraries.
+ RuntimeLibraryInstall.$1: \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20141210/d96cb6eb/attachment-0001.html>


More information about the macports-changes mailing list