From 2221a35e7bdd8bbb898a28847c52b929e272b09f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 9 Jan 2023 12:16:36 +0200 Subject: [PATCH] Setup rpaths only for dynamic libraries. Property to disable the use of rpath. --- qbs/imports/VApp.qbs | 14 +++++++++----- qbs/imports/VLib.qbs | 10 ++++++++-- qbs/modules/buildconfig/buildconfig.qbs | 4 ++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/qbs/imports/VApp.qbs b/qbs/imports/VApp.qbs index 79a639a9f..cfbfc0306 100644 --- a/qbs/imports/VApp.qbs +++ b/qbs/imports/VApp.qbs @@ -10,11 +10,15 @@ CppApplication { cpp.minimumMacosVersion: buildconfig.minimumMacosVersion } - cpp.rpaths: FileInfo.joinPaths(cpp.rpathOrigin, - "..", - qbs.targetOS.contains("macos") - ? "Frameworks" - : buildconfig.installLibraryPath) + Properties { + condition: buildconfig.enableRPath + cpp.rpaths: FileInfo.joinPaths(cpp.rpathOrigin, + "..", + qbs.targetOS.contains("macos") + ? "Frameworks" + : buildconfig.installLibraryPath) + } + install: true installDir: buildconfig.installAppPath installDebugInformation: true diff --git a/qbs/imports/VLib.qbs b/qbs/imports/VLib.qbs index 20aed4c30..adc133181 100644 --- a/qbs/imports/VLib.qbs +++ b/qbs/imports/VLib.qbs @@ -10,8 +10,14 @@ Library { buildconfig.appTarget: "valentina" bundle.isBundle: buildconfig.frameworksBuild cpp.includePaths: [".."] - cpp.sonamePrefix: qbs.targetOS.contains("macos") ? "@rpath" : undefined - cpp.rpaths: cpp.rpathOrigin + + // Allow MAC OS X to find library inside a bundle + cpp.sonamePrefix: (!buildconfig.staticBuild && qbs.targetOS.contains("macos")) ? "@rpath" : undefined + + Properties { + condition: (!buildconfig.staticBuild && buildconfig.enableRPath) + cpp.rpaths: cpp.rpathOrigin + } install: !buildconfig.staticBuild installDir: buildconfig.installLibraryPath diff --git a/qbs/modules/buildconfig/buildconfig.qbs b/qbs/modules/buildconfig/buildconfig.qbs index 13074d0ab..32117b891 100644 --- a/qbs/modules/buildconfig/buildconfig.qbs +++ b/qbs/modules/buildconfig/buildconfig.qbs @@ -12,6 +12,10 @@ Module { // Use this property to disable building unit tests. property bool enableUnitTests: true + // Use this property to disable the use of rpath. This can be used when packaging Valentina for distributions which + // do not permit the use of rpath, such as Fedora. + property bool enableRPath: true + property string libDirName: "lib" property string appTarget