Centralize the handling of install_name and rpath.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 28 Feb 2014 13:48:03 +0000 (13:48 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 28 Feb 2014 13:48:03 +0000 (13:48 +0000)
This centralizes the Makefile handling of -install_name and -rpath. It also
moves the cmake build to using @rpath. The reason being that libclang needs it,
and it works for everything else.

A followup patch will move clang to using this and then there will be a single
point to edit to support other systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202499 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt
Makefile.rules
tools/llvm-shlib/Makefile
tools/lto/Makefile

index 72901c88768bdd0dbc6cbc6a8640f14e532b6d69..ab93503f282be9137c6ba9d687657914462e1605 100644 (file)
@@ -443,7 +443,7 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
 
 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
 if (APPLE)
-  set(CMAKE_INSTALL_NAME_DIR "@executable_path/../lib")
+  set(CMAKE_INSTALL_NAME_DIR "@rpath")
   set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
 else(UNIX)
   if(NOT DEFINED CMAKE_INSTALL_RPATH)
index d668b23afbb98edc8d25475e9c6e9addb297e276..3f1c2afe73d4802ee82378ec413f87f61d93b1cc 100644 (file)
@@ -589,6 +589,8 @@ ifdef SHARED_LIBRARY
 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)"
 endif
 endif
 endif
index 317da517202df73c89ef1b342e8a10e9f40dc703..92ddfdb76318be6bc60b1717ed97f4f962a1be91 100644 (file)
@@ -49,14 +49,6 @@ ifeq ($(HOST_OS),Darwin)
     endif
     # Include everything from the .a's into the shared library.
     LLVMLibsOptions    := $(LLVMLibsOptions) -all_load
-
-    # 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
 endif
 
 ifeq ($(HOST_OS), $(filter $(HOST_OS), DragonFly Linux FreeBSD GNU/kFreeBSD OpenBSD GNU Bitrig))
index 1cfff028f6f00ba7420b4a53a6f837156634cb11..a4fe9ac77c178f83a98beef247226c3eb2831fe6 100644 (file)
@@ -37,14 +37,6 @@ ifeq ($(HOST_OS),Darwin)
                         -Wl,-compatibility_version -Wl,1
     endif
 
-    # 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
-
     # If we're doing an Apple-style build, add the LTO object path.
     ifeq ($(RC_XBS),YES)
        TempFile        := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX)