Allow overriding of Clang prebuilts
These are the environment variables used by make to override the
llvm/clang prebuilts. As far as I know, these should only be used when
building or testing a new clang drop.
I would have this handled by make and put in soong.variables, but I
expect this to be one of the first options removed from make and
exported from Soong to Kati.
Change-Id: I7a3a70ee44fc4b1e56a5e200e2a7ced77d4c5692
diff --git a/cc/cc.go b/cc/cc.go
index e091be3..4105811 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -153,7 +153,20 @@
pctx.PrefixedPathsForOptionalSourceVariable("commonNativehelperInclude", "-I",
[]string{"libnativehelper/include/nativehelper"})
- pctx.SourcePathVariable("clangPath", "prebuilts/clang/host/${HostPrebuiltTag}/clang-2658975/bin")
+ pctx.SourcePathVariable("clangDefaultBase", "prebuilts/clang/host")
+ pctx.VariableFunc("clangBase", func(config interface{}) (string, error) {
+ if override := config.(common.Config).Getenv("LLVM_PREBUILTS_BASE"); override != "" {
+ return override, nil
+ }
+ return "${clangDefaultBase}", nil
+ })
+ pctx.VariableFunc("clangVersion", func(config interface{}) (string, error) {
+ if override := config.(common.Config).Getenv("LLVM_PREBUILTS_VERSION"); override != "" {
+ return override, nil
+ }
+ return "clang-2658975", nil
+ })
+ pctx.StaticVariable("clangPath", "${clangBase}/${HostPrebuiltTag}/${clangVersion}/bin")
}
type CCModuleContext common.AndroidBaseContext