Fix stripping on Darwin
The strip tool is different on Darwin, use a separate darwinStrip rule
instead of calling strip.sh for host builds on Darwin.
Change-Id: I6d421cba0dcea04367d5bc638a03f64c81e2ead0
diff --git a/cc/builder.go b/cc/builder.go
index 10c8508..b97f29b 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -79,19 +79,26 @@
darwinAr = pctx.StaticRule("darwinAr",
blueprint.RuleParams{
- Command: "rm -f ${out} && $arCmd $arFlags $out $in",
- CommandDeps: []string{"$arCmd"},
+ Command: "rm -f ${out} && ${macArPath} $arFlags $out $in",
+ CommandDeps: []string{"${macArPath}"},
Description: "ar $out",
},
- "arCmd", "arFlags")
+ "arFlags")
darwinAppendAr = pctx.StaticRule("darwinAppendAr",
blueprint.RuleParams{
- Command: "cp -f ${inAr} ${out}.tmp && $arCmd $arFlags ${out}.tmp $in && mv ${out}.tmp ${out}",
- CommandDeps: []string{"$arCmd"},
+ Command: "cp -f ${inAr} ${out}.tmp && ${macArPath} $arFlags ${out}.tmp $in && mv ${out}.tmp ${out}",
+ CommandDeps: []string{"${macArPath}"},
Description: "ar $out",
},
- "arCmd", "arFlags", "inAr")
+ "arFlags", "inAr")
+
+ darwinStrip = pctx.StaticRule("darwinStrip",
+ blueprint.RuleParams{
+ Command: "${macStripPath} -u -r -o $out $in",
+ CommandDeps: []string{"${macStripPath}"},
+ Description: "strip $out",
+ })
prefixSymbols = pctx.StaticRule("prefixSymbols",
blueprint.RuleParams{
@@ -252,7 +259,6 @@
func TransformDarwinObjToStaticLib(ctx common.AndroidModuleContext, objFiles common.Paths,
flags builderFlags, outputPath common.ModuleOutPath) {
- arCmd := "${macArPath}"
arFlags := "cqs"
// ARG_MAX on darwin is 262144, use half that to be safe
@@ -278,7 +284,6 @@
Inputs: l,
Args: map[string]string{
"arFlags": arFlags,
- "arCmd": arCmd,
},
})
} else {
@@ -289,7 +294,6 @@
Implicits: []string{in},
Args: map[string]string{
"arFlags": arFlags,
- "arCmd": arCmd,
"inAr": in,
},
})
@@ -439,6 +443,16 @@
})
}
+func TransformDarwinStrip(ctx common.AndroidModuleContext, inputFile common.Path,
+ outputFile common.WritablePath) {
+
+ ctx.ModuleBuild(pctx, common.ModuleBuildParams{
+ Rule: darwinStrip,
+ Output: outputFile,
+ Input: inputFile,
+ })
+}
+
func CopyGccLib(ctx common.AndroidModuleContext, libName string,
flags builderFlags, outputFile common.WritablePath) {