aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2017-08-22 10:07:30 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2017-08-22 09:27:16 +0000
commit98e41e45b4220de69bdb66e3c6560f8be0a4797c (patch)
tree9cdfe151ee5aa9ad84bc16a26fc9a33160c37c10
parente7bc695dbe0c13bb06952683893076bfe633edba (diff)
Android: Do not modify libraries in the NDK
They don't belong to us, and they may not even be writable. Instead, make the strip command create a new file. Task-number: QBS-1176 Change-Id: Ifd387d3fbcf475e662344ceefa6d289b45c4ae16 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r--share/qbs/modules/cpp/android-gcc.qbs34
1 files changed, 26 insertions, 8 deletions
diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs
index 5307c06a4..a21f56f2a 100644
--- a/share/qbs/modules/cpp/android-gcc.qbs
+++ b/share/qbs/modules/cpp/android-gcc.qbs
@@ -85,6 +85,13 @@ LinuxGCC {
? FileInfo.joinPaths(stlLibsDir, staticLibraryPrefix + Android.ndk.appStl + staticLibrarySuffix)
: undefined
+ Group {
+ name: "Android STL"
+ condition: product.cpp.sharedStlFilePath
+ files: product.cpp.sharedStlFilePath ? [product.cpp.sharedStlFilePath] : []
+ fileTags: ["android.unstripped-stl"]
+ }
+
toolchainInstallPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains",
toolchainDir, "prebuilt",
Android.ndk.hostArch, "bin")
@@ -203,7 +210,22 @@ LinuxGCC {
endianness: "little"
Rule {
+ inputs: ["android.unstripped-stl"]
+ Artifact {
+ filePath: FileInfo.joinPaths("stripped-libs", input.fileName);
+ fileTags: ["android.stripped-stl"]
+ }
+ prepare: {
+ var args = ["--strip-unneeded", "-o", output.filePath, input.filePath];
+ var cmd = new Command(product.cpp.stripPath, args);
+ cmd.description = "stripping " + input.fileName;
+ return [cmd];
+ }
+ }
+
+ Rule {
inputs: ["dynamiclibrary"]
+ explicitlyDependsOn: ["android.stripped-stl"];
outputFileTags: ["android.nativelibrary", "android.gdbserver-info", "android.stl-info"]
outputArtifacts: {
var artifacts = [{
@@ -217,17 +239,14 @@ LinuxGCC {
fileTags: ["android.gdbserver-info"]
});
}
- var stlFilePath = product.moduleProperty("cpp", "sharedStlFilePath");
- if (stlFilePath)
+ if (explicitlyDependsOn["android.stripped-stl"])
artifacts.push({filePath: "android.stl-info.txt", fileTags: ["android.stl-info"]});
return artifacts;
}
prepare: {
- var stlFilePath = product.moduleProperty("cpp", "sharedStlFilePath");
var copyCmd = new JavaScriptCommand();
copyCmd.silent = true;
- copyCmd.stlFilePath = stlFilePath;
copyCmd.sourceCode = function() {
File.copy(inputs["dynamiclibrary"][0].filePath,
outputs["android.nativelibrary"][0].filePath);
@@ -246,8 +265,9 @@ LinuxGCC {
infoFile.writeLine(targetPath);
infoFile.close();
}
- if (stlFilePath) {
- var srcPath = stlFilePath;
+ var strippedStlList = explicitlyDependsOn["android.stripped-stl"];
+ if (strippedStlList) {
+ var srcPath = strippedStlList[0].filePath;
var targetPath = FileInfo.joinPaths(destDir, FileInfo.fileName(srcPath));
var infoFile = new TextFile(outputs["android.stl-info"][0].filePath,
TextFile.WriteOnly);
@@ -257,8 +277,6 @@ LinuxGCC {
}
}
var stripArgs = ["--strip-unneeded", outputs["android.nativelibrary"][0].filePath];
- if (stlFilePath)
- stripArgs.push(stlFilePath);
var stripCmd = new Command(product.moduleProperty("cpp", "stripPath"), stripArgs);
stripCmd.description = "Stripping unneeded symbols from "
+ outputs["android.nativelibrary"][0].fileName;