aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/imports/qbs/UnixUtils
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@theqtcompany.com>2015-08-13 16:47:43 -0700
committerJake Petroules <jake.petroules@theqtcompany.com>2016-03-17 05:05:05 +0000
commit868f33fc325855d7539d2771c7683f2792e7edd2 (patch)
treef755a6d1db73fc2e35c81ad94dd43280fc9cb90b /share/qbs/imports/qbs/UnixUtils
parent6f17b962144390ed9b13d74cdbdc6727e740a821 (diff)
Support soname prefixes on non-Apple Unix-like platforms.
Change-Id: I48fb27137e9eafea021eff3cf0cf9c4087c0be89 Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
Diffstat (limited to 'share/qbs/imports/qbs/UnixUtils')
-rw-r--r--share/qbs/imports/qbs/UnixUtils/unix-utils.js34
1 files changed, 19 insertions, 15 deletions
diff --git a/share/qbs/imports/qbs/UnixUtils/unix-utils.js b/share/qbs/imports/qbs/UnixUtils/unix-utils.js
index 473075f7f..96b331a5f 100644
--- a/share/qbs/imports/qbs/UnixUtils/unix-utils.js
+++ b/share/qbs/imports/qbs/UnixUtils/unix-utils.js
@@ -31,27 +31,31 @@
var FileInfo = loadExtension("qbs.FileInfo");
function soname(product, outputFileName) {
+ var version = product.moduleProperty("cpp", "internalVersion");
if (product.moduleProperty("qbs", "targetOS").contains("darwin")) {
+ // If this is a bundle, ignore the parameter and use the relative path to the bundle binary
+ // For example: qbs.framework/Versions/1/qbs
if (product.moduleProperty("bundle", "isBundle"))
outputFileName = product.moduleProperty("bundle", "executablePath");
- var prefix = product.moduleProperty("cpp", "installNamePrefix");
- if (prefix)
- outputFileName = FileInfo.joinPaths(prefix, outputFileName);
- return outputFileName;
- }
-
- function majorVersion(version, defaultValue) {
- var n = parseInt(version, 10);
- return isNaN(n) ? defaultValue : n;
- }
+ } else if (version) {
+ function majorVersion(version, defaultValue) {
+ var n = parseInt(version, 10);
+ return isNaN(n) ? defaultValue : n;
+ }
- var version = product.moduleProperty("cpp", "internalVersion");
- if (version) {
+ // For non-Darwin platforms, append the shared library major version number to the soname
+ // For example: libqbscore.so.1
var major = majorVersion(version);
- if (major !== undefined) {
- return outputFileName.substr(0, outputFileName.length - version.length)
+ if (major !== undefined)
+ outputFileName = outputFileName.substr(0, outputFileName.length - version.length)
+ major;
- }
}
+
+ // Prepend the soname prefix
+ // For example, @rpath/libqbscore.dylib or /usr/lib/libqbscore.so.1
+ var prefix = product.moduleProperty("cpp", "sonamePrefix");
+ if (prefix)
+ outputFileName = FileInfo.joinPaths(prefix, outputFileName);
+
return outputFileName;
}