From b603fd36c256e91beff758363d6943cf2f8294d8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 9 Aug 2012 15:02:44 +0200 Subject: support -rpath for modules which are not installed to QT_INSTALL_PREFIX a module's project file may set MODULE_INSTALL_LIBS before loading qt_module.prf to have an alternative RPATH linked into the users of that module. this is relevant only for linking against non-installed -prefix builds of that module, as otherwise .libs from the module's pri file is used for rpath. Change-Id: Ib240e748cf130a71a5991dc643c368a983092ead Reviewed-by: Simon Hausmann Reviewed-by: Joerg Bornemann --- configure | 9 +++------ mkspecs/features/qt_functions.prf | 7 +++++++ mkspecs/features/qt_module_fwdpri.prf | 3 +++ tools/configure/configureapp.cpp | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 304136c75c..74d7367a74 100755 --- a/configure +++ b/configure @@ -5345,8 +5345,6 @@ fi if [ "$PLATFORM_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then if [ "$CFG_RPATH" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG absolute_library_soname" - # set the default rpath to the library installation directory - RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS" fi elif [ -z "`getXQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then if [ -n "$RPATH_FLAGS" ]; then @@ -5360,15 +5358,14 @@ elif [ -z "`getXQMakeConf 'QMAKE_(LFLAGS_)?RPATH'`" ]; then CFG_RPATH=no fi else - if [ "$CFG_RPATH" = "yes" ]; then - # set the default rpath to the library installation directory - RPATH_FLAGS="\"$QT_INSTALL_LIBS\" $RPATH_FLAGS" - fi if [ -n "$RPATH_FLAGS" ]; then # add the user defined rpaths QMakeVar add QMAKE_RPATHDIR "$RPATH_FLAGS" fi fi +if [ "$CFG_RPATH" = "yes" ]; then + QT_CONFIG="$QT_CONFIG rpath" +fi if [ '!' -z "$I_FLAGS" ]; then # add the user define include paths diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 8daa2c4bbe..a8f4d34268 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -94,6 +94,12 @@ defineTest(qtAddModule) { isEmpty(lib): lib = -l$${MODULE_NAME}$${QT_LIBINFIX} LINKAGE += $$lib + contains(QT_CONFIG, rpath) { + rpath = $$eval(QT.$${MODULE}.rpath) + isEmpty(rpath): rpath = $$MODULE_LIBS + QMAKE_RPATHDIR *= $$rpath + } + # Make sure we can link to uninstalled libraries unix:!mac:!isEmpty(QT.$${1}.libs) { # Use unmodified path, so /usr/lib also works for(rpl, QT.$${1}.rpath_link): \ @@ -120,6 +126,7 @@ defineTest(qtAddModule) { export(QMAKE_FRAMEWORKPATH) export(QMAKE_LFLAGS) export(QMAKE_LIBDIR) + export(QMAKE_RPATHDIR) return(true) } diff --git a/mkspecs/features/qt_module_fwdpri.prf b/mkspecs/features/qt_module_fwdpri.prf index 0f7c7c4726..04d2d7771f 100644 --- a/mkspecs/features/qt_module_fwdpri.prf +++ b/mkspecs/features/qt_module_fwdpri.prf @@ -11,6 +11,8 @@ # Permit modules to enforce being built outside QTDIR. force_independent: mod_component_base = $$MODULE_BASE_OUTDIR + isEmpty(MODULE_INSTALL_LIBS): MODULE_INSTALL_LIBS = $$[QT_INSTALL_LIBS] + MODULE_FWD_PRI = $$mod_qmake_base/mkspecs/modules/qt_$${MODULE}.pri # -rpath-link is used by the linker to find depedencies of dynamic @@ -64,6 +66,7 @@ "QT_MODULE_PLUGIN_BASE = $$mod_component_base/plugins" \ $$module_rpathlink \ $$module_rpathlink_priv \ + "QT.$${MODULE}.rpath = $$MODULE_INSTALL_LIBS" \ "include($$MODULE_PRI)" write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.") touch($$MODULE_FWD_PRI, $$MODULE_PRI) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index d92a3237be..8358a00f36 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2534,7 +2534,7 @@ void Configure::generateOutputVars() // Directories and settings for .qmake.cache -------------------- if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux")) - dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ]; + qtConfig += "rpath"; qmakeVars += QString("OBJECTS_DIR = ") + formatPath("tmp/obj/" + dictionary["QMAKE_OUTDIR"]); qmakeVars += QString("MOC_DIR = ") + formatPath("tmp/moc/" + dictionary["QMAKE_OUTDIR"]); -- cgit v1.2.3