diff options
Diffstat (limited to 'share/qbs')
-rw-r--r-- | share/qbs/module-providers/Qt/provider.qbs | 2 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/setup-qt.js | 20 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/QtModule.qbs | 1 | ||||
-rw-r--r-- | share/qbs/module-providers/qbspkgconfig.qbs | 7 | ||||
-rw-r--r-- | share/qbs/modules/bundle/BundleModule.qbs | 86 | ||||
-rw-r--r-- | share/qbs/modules/cpp/GenericGCC.qbs | 2 | ||||
-rw-r--r-- | share/qbs/modules/qbs/common.qbs | 2 |
7 files changed, 62 insertions, 58 deletions
diff --git a/share/qbs/module-providers/Qt/provider.qbs b/share/qbs/module-providers/Qt/provider.qbs index 33083c51d..be026b1e0 100644 --- a/share/qbs/module-providers/Qt/provider.qbs +++ b/share/qbs/module-providers/Qt/provider.qbs @@ -2,5 +2,5 @@ import "setup-qt.js" as SetupQt ModuleProvider { property stringList qmakeFilePaths - relativeSearchPaths: SetupQt.doSetup(qmakeFilePaths, outputBaseDir, path, qbs) + relativeSearchPaths: SetupQt.doSetup(qmakeFilePaths, outputBaseDir, path) } diff --git a/share/qbs/module-providers/Qt/setup-qt.js b/share/qbs/module-providers/Qt/setup-qt.js index 70051172c..9fcef7897 100644 --- a/share/qbs/module-providers/Qt/setup-qt.js +++ b/share/qbs/module-providers/Qt/setup-qt.js @@ -48,9 +48,8 @@ var Utilities = require("qbs.Utilities"); function splitNonEmpty(s, c) { return s.split(c).filter(function(e) { return e; }); } function toNative(p) { return FileInfo.toNativeSeparators(p); } -function exeSuffix(qbs) { return FileInfo.executableSuffix(); } -function getQmakeFilePaths(qmakeFilePaths, qbs) { +function getQmakeFilePaths(qmakeFilePaths) { if (qmakeFilePaths && qmakeFilePaths.length > 0) return qmakeFilePaths; console.info("Detecting Qt installations..."); @@ -58,9 +57,8 @@ function getQmakeFilePaths(qmakeFilePaths, qbs) { var pathValue = Environment.getEnv("PATH"); if (pathValue) { var dirs = splitNonEmpty(pathValue, FileInfo.pathListSeparator()); - var suffix = exeSuffix(qbs); for (var i = 0; i < dirs.length; ++i) { - var candidate = FileInfo.joinPaths(dirs[i], "qmake" + suffix); + var candidate = FileInfo.joinPaths(dirs[i], "qmake" + FileInfo.executableSuffix()); var canonicalCandidate = FileInfo.canonicalPath(candidate); if (!canonicalCandidate || !File.exists(canonicalCandidate)) continue; @@ -248,7 +246,7 @@ function abiToArchitecture(abi) { } } -function getQtProperties(qmakeFilePath, qbs) { +function getQtProperties(qmakeFilePath) { var queryResult = queryQmake(qmakeFilePath); var qtProps = {}; qtProps.installPrefixPath = pathQueryValue(queryResult, "QT_INSTALL_PREFIX"); @@ -1581,10 +1579,10 @@ function copyTemplateFile(fileName, targetDirectory, qtProps, abi, location, all targetFile.close(); } -function setupOneQt(qmakeFilePath, outputBaseDir, uniquify, location, qbs) { +function setupOneQt(qmakeFilePath, outputBaseDir, uniquify, location) { if (!File.exists(qmakeFilePath)) throw "The specified qmake file path '" + toNative(qmakeFilePath) + "' does not exist."; - var qtProps = getQtProperties(qmakeFilePath, qbs); + var qtProps = getQtProperties(qmakeFilePath); var androidAbis = []; if (qtProps.androidAbis !== undefined) // Multiple androidAbis detected: Qt >= 5.14 @@ -1657,7 +1655,7 @@ function setupOneQt(qmakeFilePath, outputBaseDir, uniquify, location, qbs) { allFiles); var qmlcacheStr = "qmlcache"; if (File.exists(FileInfo.joinPaths(qtProps.qmlLibExecPath, - "qmlcachegen" + exeSuffix(qbs)))) { + "qmlcachegen" + FileInfo.executableSuffix()))) { copyTemplateFile(qmlcacheStr + ".qbs", FileInfo.joinPaths(qbsQtModuleBaseDir, qmlcacheStr), qtProps, androidAbis[a], location, allFiles); @@ -1687,8 +1685,8 @@ function setupOneQt(qmakeFilePath, outputBaseDir, uniquify, location, qbs) { return relativeSearchPaths; } -function doSetup(qmakeFilePaths, outputBaseDir, location, qbs) { - qmakeFilePaths = getQmakeFilePaths(qmakeFilePaths, qbs); +function doSetup(qmakeFilePaths, outputBaseDir, location) { + qmakeFilePaths = getQmakeFilePaths(qmakeFilePaths); if (!qmakeFilePaths || qmakeFilePaths.length === 0) return []; var uniquifySearchPath = qmakeFilePaths.length > 1; @@ -1697,7 +1695,7 @@ function doSetup(qmakeFilePaths, outputBaseDir, location, qbs) { try { console.info("Setting up Qt at '" + toNative(qmakeFilePaths[i]) + "'..."); var searchPaths = setupOneQt(qmakeFilePaths[i], outputBaseDir, uniquifySearchPath, - location, qbs); + location); if (searchPaths.length > 0) { for (var j = 0; j < searchPaths.length; ++j ) allSearchPaths.push(searchPaths[j]); diff --git a/share/qbs/module-providers/Qt/templates/QtModule.qbs b/share/qbs/module-providers/Qt/templates/QtModule.qbs index 62e05327b..35421436f 100644 --- a/share/qbs/module-providers/Qt/templates/QtModule.qbs +++ b/share/qbs/module-providers/Qt/templates/QtModule.qbs @@ -23,6 +23,7 @@ Module { // We have to pull in all plugins here, because dependency resolving happens // before module merging, and we don't know yet if someone set // Qt.pluginSupport.pluginsByType in the product. + // TODO: We might be able to use Qt.pluginSupport.pluginsByType now. // The real filtering is done later by the plugin module files themselves. var list = []; var allPlugins = Qt.plugin_support.allPluginsByType; diff --git a/share/qbs/module-providers/qbspkgconfig.qbs b/share/qbs/module-providers/qbspkgconfig.qbs index 92d5fda71..599f76d33 100644 --- a/share/qbs/module-providers/qbspkgconfig.qbs +++ b/share/qbs/module-providers/qbspkgconfig.qbs @@ -52,7 +52,12 @@ ModuleProvider { property stringList extraPaths property stringList libDirs property bool staticMode: false - property path sysroot: qbs.sysroot + + // We take the sysroot default from qbs.sysroot, except for Xcode toolchains, where + // the sysroot points into the Xcode installation and does not contain .pc files. + property path sysroot: qbs.toolchain && qbs.toolchain.includes("xcode") + ? undefined : qbs.sysroot + property bool mergeDependencies: true relativeSearchPaths: { diff --git a/share/qbs/modules/bundle/BundleModule.qbs b/share/qbs/modules/bundle/BundleModule.qbs index 0d8452a7e..0c2d7ba6a 100644 --- a/share/qbs/modules/bundle/BundleModule.qbs +++ b/share/qbs/modules/bundle/BundleModule.qbs @@ -281,8 +281,8 @@ Module { outputFileTags: ["bundle.input", "aggregate_infoplist"] outputArtifacts: { var artifacts = []; - var embed = ModUtils.moduleProperty(product, "embedInfoPlist"); - if (ModUtils.moduleProperty(product, "isBundle") || embed) { + var embed = product.bundle.embedInfoPlist; + if (product.bundle.isBundle || embed) { artifacts.push({ filePath: FileInfo.joinPaths( product.destinationDirectory, product.name + "-Info.plist"), @@ -290,7 +290,7 @@ Module { bundle: { _bundleFilePath: FileInfo.joinPaths( product.destinationDirectory, - ModUtils.moduleProperty(product, "infoPlistPath")), + product.bundle.infoPlistPath), } }); } @@ -301,20 +301,21 @@ Module { var cmd = new JavaScriptCommand(); cmd.description = "generating Info.plist for " + product.name; cmd.highlight = "codegen"; - cmd.infoPlist = ModUtils.moduleProperty(product, "infoPlist") || {}; - cmd.processInfoPlist = ModUtils.moduleProperty(product, "processInfoPlist"); - cmd.infoPlistFormat = ModUtils.moduleProperty(product, "infoPlistFormat"); - cmd.extraEnv = ModUtils.moduleProperty(product, "extraEnv"); - cmd.qmakeEnv = ModUtils.moduleProperty(product, "qmakeEnv"); + cmd.infoPlist = product.bundle.infoPlist || {}; + cmd.processInfoPlist = product.bundle.processInfoPlist; + cmd.infoPlistFormat = product.bundle.infoPlistFormat; + cmd.extraEnv = product.bundle.extraEnv; + cmd.qmakeEnv = product.bundle.qmakeEnv; + // TODO: bundle module should know nothing about cpp module cmd.buildEnv = product.moduleProperty("cpp", "buildEnv"); - cmd.developerPath = product.moduleProperty("xcode", "developerPath"); - cmd.platformInfoPlist = product.moduleProperty("xcode", "platformInfoPlist"); - cmd.sdkSettingsPlist = product.moduleProperty("xcode", "sdkSettingsPlist"); - cmd.toolchainInfoPlist = product.moduleProperty("xcode", "toolchainInfoPlist"); + cmd.developerPath = product.xcode.developerPath; + cmd.platformInfoPlist = product.xcode.platformInfoPlist; + cmd.sdkSettingsPlist = product.xcode.sdkSettingsPlist; + cmd.toolchainInfoPlist = product.xcode.toolchainInfoPlist; - cmd.osBuildVersion = product.moduleProperty("qbs", "hostOSBuildVersion"); + cmd.osBuildVersion = product.qbs.hostOSBuildVersion; cmd.sourceCode = function() { var plist, process, key, i; @@ -343,7 +344,7 @@ Module { if (processInfoPlist) { // Add default values to the aggregate plist if the corresponding keys // for those values are not already present - var defaultValues = ModUtils.moduleProperty(product, "defaultInfoPlist"); + var defaultValues = product.bundle.defaultInfoPlist; for (key in defaultValues) { if (defaultValues.hasOwnProperty(key) && !(key in aggregatePlist)) aggregatePlist[key] = defaultValues[key]; @@ -480,11 +481,11 @@ Module { outputFileTags: ["bundle.input", "pkginfo"] outputArtifacts: { var artifacts = []; - if (ModUtils.moduleProperty(product, "isBundle") && ModUtils.moduleProperty(product, "generatePackageInfo")) { + if (product.bundle.isBundle && product.bundle.generatePackageInfo) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, "PkgInfo"), fileTags: ["bundle.input", "pkginfo"], - bundle: { _bundleFilePath: FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, "pkgInfoPath")) } + bundle: { _bundleFilePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.pkgInfoPath) } }); } return artifacts; @@ -535,9 +536,9 @@ Module { "bundle.code-signature"] outputArtifacts: { var i, artifacts = []; - if (ModUtils.moduleProperty(product, "isBundle")) { + if (product.bundle.isBundle) { for (i in inputs["bundle.input"]) { - var fp = inputs["bundle.input"][i].moduleProperty("bundle", "_bundleFilePath"); + var fp = inputs["bundle.input"][i].bundle._bundleFilePath; if (!fp) throw("Artifact " + inputs["bundle.input"][i].filePath + " has no associated bundle file path"); var extraTags = inputs["bundle.input"][i].fileTags.includes("application") @@ -552,20 +553,19 @@ Module { for (i in provprofiles) { artifacts.push({ filePath: FileInfo.joinPaths(product.destinationDirectory, - ModUtils.moduleProperty(product, - "contentsFolderPath"), + product.bundle.contentsFolderPath, provprofiles[i].fileName), fileTags: ["bundle.provisioningprofile", "bundle.content"] }); } - var packageType = ModUtils.moduleProperty(product, "packageType"); - var isShallow = ModUtils.moduleProperty(product, "isShallow"); + var packageType = product.bundle.packageType; + var isShallow = product.bundle.isShallow; if (packageType === "FMWK" && !isShallow) { - var publicHeaders = ModUtils.moduleProperty(product, "publicHeaders"); + var publicHeaders = product.bundle.publicHeaders; if (publicHeaders && publicHeaders.length) { artifacts.push({ - filePath: FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, "bundleName"), "Headers"), + filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "Headers"), fileTags: ["bundle.symlink.headers", "bundle.content"] }); } @@ -573,23 +573,23 @@ Module { var privateHeaders = ModUtils.moduleProperty(product, "privateHeaders"); if (privateHeaders && privateHeaders.length) { artifacts.push({ - filePath: FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, "bundleName"), "PrivateHeaders"), + filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "PrivateHeaders"), fileTags: ["bundle.symlink.private-headers", "bundle.content"] }); } artifacts.push({ - filePath: FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, "bundleName"), "Resources"), + filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "Resources"), fileTags: ["bundle.symlink.resources", "bundle.content"] }); artifacts.push({ - filePath: FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, "bundleName"), product.targetName), + filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, product.targetName), fileTags: ["bundle.symlink.executable", "bundle.content"] }); artifacts.push({ - filePath: FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, "versionsFolderPath"), "Current"), + filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.versionsFolderPath, "Current"), fileTags: ["bundle.symlink.version", "bundle.content"] }); } @@ -606,7 +606,7 @@ Module { } } - sources = ModUtils.moduleProperty(product, "resources"); + sources = product.bundle.resources; for (i in sources) { destination = BundleTools.destinationDirectoryForResource(product, {baseDir: FileInfo.path(sources[i]), fileName: FileInfo.fileName(sources[i])}); artifacts.push({ @@ -617,7 +617,7 @@ Module { var wrapperPath = FileInfo.joinPaths( product.destinationDirectory, - ModUtils.moduleProperty(product, "bundleName")); + product.bundle.bundleName); for (var i = 0; i < artifacts.length; ++i) artifacts[i].bundle = { wrapperPath: wrapperPath }; @@ -634,7 +634,7 @@ Module { prepare: { var i, cmd, commands = []; - var packageType = ModUtils.moduleProperty(product, "packageType"); + var packageType = product.bundle.packageType; var bundleType = "bundle"; if (packageType === "APPL") @@ -652,7 +652,7 @@ Module { var symlinks = outputs["bundle.symlink.version"]; for (i in symlinks) { - cmd = new Command("ln", ["-sfn", ModUtils.moduleProperty(product, "frameworkVersion"), + cmd = new Command("ln", ["-sfn", product.bundle.frameworkVersion, symlinks[i].filePath]); cmd.silent = true; commands.push(cmd); @@ -699,8 +699,8 @@ Module { } var bundleInputs = sortedArtifactList(inputs["bundle.input"], function (a, b) { - return a.moduleProperty("bundle", "_bundleFilePath").localeCompare( - b.moduleProperty("bundle", "_bundleFilePath")); + return a.bundle._bundleFilePath.localeCompare( + b.bundle._bundleFilePath); }); var bundleContents = sortedArtifactList(outputs["bundle.content.copied"]); for (i in bundleContents) { @@ -733,8 +733,8 @@ Module { cmd = new JavaScriptCommand(); cmd.description = "copying public headers"; cmd.highlight = "filegen"; - cmd.sources = ModUtils.moduleProperty(product, "publicHeaders"); - cmd.destination = FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, "publicHeadersFolderPath")); + cmd.sources = product.bundle.publicHeaders; + cmd.destination = FileInfo.joinPaths(product.destinationDirectory, product.bundle.publicHeadersFolderPath); cmd.sourceCode = function() { var i; for (var i in sources) { @@ -747,8 +747,8 @@ Module { cmd = new JavaScriptCommand(); cmd.description = "copying private headers"; cmd.highlight = "filegen"; - cmd.sources = ModUtils.moduleProperty(product, "privateHeaders"); - cmd.destination = FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, "privateHeadersFolderPath")); + cmd.sources = product.bundle.privateHeaders; + cmd.destination = FileInfo.joinPaths(product.destinationDirectory, product.bundle.privateHeadersFolderPath); cmd.sourceCode = function() { var i; for (var i in sources) { @@ -761,7 +761,7 @@ Module { cmd = new JavaScriptCommand(); cmd.description = "copying resources"; cmd.highlight = "filegen"; - cmd.sources = ModUtils.moduleProperty(product, "resources"); + cmd.sources = product.bundle.resources; cmd.sourceCode = function() { var i; for (var i in sources) { @@ -772,17 +772,17 @@ Module { if (cmd.sources && cmd.sources.length) commands.push(cmd); - if (product.moduleProperty("qbs", "hostOS").includes("darwin")) { + if (product.qbs.hostOS.includes("darwin")) { Array.prototype.push.apply(commands, Codesign.prepareSign( project, product, inputs, outputs, input, output)); if (bundleType === "application" - && product.moduleProperty("qbs", "targetOS").includes("macos")) { + && product.qbs.targetOS.includes("macos")) { var bundlePath = FileInfo.joinPaths( product.destinationDirectory, product.bundle.bundleName); - cmd = new Command(ModUtils.moduleProperty(product, "lsregisterPath"), + cmd = new Command(product.bundle.lsregisterPath, ["-f", bundlePath]); - cmd.description = "registering " + ModUtils.moduleProperty(product, "bundleName"); + cmd.description = "registering " + product.bundle.bundleName; commands.push(cmd); } } diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index 22a98ad57..05ceccf5f 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -216,7 +216,7 @@ CppModule { linkerScriptFlag: "-T" readonly property bool shouldCreateSymlinks: { - return createSymlinks && internalVersion && ["macho", "elf"].includes(cpp.imageFormat); + return createSymlinks && internalVersion && ["macho", "elf"].includes(imageFormat); } readonly property bool shouldSignArtifacts: codesign._canSignArtifacts diff --git a/share/qbs/modules/qbs/common.qbs b/share/qbs/modules/qbs/common.qbs index 7723c6050..8b31092a9 100644 --- a/share/qbs/modules/qbs/common.qbs +++ b/share/qbs/modules/qbs/common.qbs @@ -102,7 +102,7 @@ Module { property path installSourceBase property string installRoot: project.buildDirectory + "/install-root" property string installDir - property string installPrefix: qbs.targetOS.includes("unix") ? "/usr/local" : "" + property string installPrefix: targetOS.includes("unix") ? "/usr/local" : "" property path sysroot PropertyOptions { |