From 49b86e771761b3a9a1799d11f777b13077c6305e Mon Sep 17 00:00:00 2001
From: con <qtc-committer@nokia.com>
Date: Mon, 1 Nov 2010 12:15:49 +0100
Subject: [PATCH] Mac: Use rpath instead of executable_path.

Because executable_path and loader_path are just too inflexible for some
stuff. The rpath is supposed to be set to the Qt Creator app's Contents
folder.
Compiling on 10.4 now requires to enter compatibility mode via
QTC_TIGER_COMPAT env variable or TIGER_COMPAT_MODE qmake variable.
---
 qtcreator.pri           | 1 +
 src/qtcreatorplugin.pri | 5 +++++
 src/rpath.pri           | 7 ++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/qtcreator.pri b/qtcreator.pri
index 2994770571f..f1a9f6af50e 100644
--- a/qtcreator.pri
+++ b/qtcreator.pri
@@ -99,6 +99,7 @@ macx {
     IDE_BIN_PATH     = $$IDE_APP_PATH/$${IDE_APP_TARGET}.app/Contents/MacOS
     contains(QT_CONFIG, ppc):CONFIG += ppc x86
     copydata = 1
+    isEmpty(TIGER_COMPAT_MODE):TIGER_COMPAT_MODE=$$(QTC_TIGER_COMPAT)
 } else {
     win32 {
         contains(TEMPLATE, vc.*)|contains(TEMPLATE_PREFIX, vc):vcproj = 1
diff --git a/src/qtcreatorplugin.pri b/src/qtcreatorplugin.pri
index a13d519dc80..f27097c0372 100644
--- a/src/qtcreatorplugin.pri
+++ b/src/qtcreatorplugin.pri
@@ -28,7 +28,12 @@ QMAKE_EXTRA_COMPILERS += copy2build
 
 
 macx {
+    !isEmpty(TIGER_COMPAT_MODE) {
         QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/$${PROVIDER}/
+    } else {
+        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/$${PROVIDER}/
+        QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../../
+    }
 } else:linux-* {
     #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
     QMAKE_RPATHDIR += \$\$ORIGIN
diff --git a/src/rpath.pri b/src/rpath.pri
index 750d0ed4d8d..c0882c41154 100644
--- a/src/rpath.pri
+++ b/src/rpath.pri
@@ -1,5 +1,10 @@
 macx {
-    QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/
+    !isEmpty(TIGER_COMPAT_MODE) {
+        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/
+    } else {
+        QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/
+        QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../
+    }
 } else:linux-* {
     #do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
     # this expands to $ORIGIN (after qmake and make), it does NOT read a qmake var
-- 
GitLab