Add proper use of LLVM_RELEASE_VERSION for locating libraries.
Bug: http://b/31532493
As I have been updating to LLVM ~4.0, there are numerous locations where
3.8 is hard-coded, and unable to be overridden. This change adds a new
function for getting the ClangShortVersion(), which can look at
environment variables that override this value (particularly useful for
two-stage compilation, where version numbers change between builds).
Change-Id: Iaec19908cf47b3b2317844d6e1329f7bcd81f022
diff --git a/cc/config/global.go b/cc/config/global.go
index 438ad82..e454c16 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -136,7 +136,13 @@
pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}")
pctx.StaticVariable("ClangBin", "${ClangPath}/bin")
- pctx.StaticVariable("ClangAsanLibDir", "${ClangPath}/lib64/clang/3.8/lib/linux")
+ pctx.VariableFunc("ClangShortVersion", func(config interface{}) (string, error) {
+ if override := config.(android.Config).Getenv("LLVM_RELEASE_VERSION"); override != "" {
+ return override, nil
+ }
+ return "3.8", nil
+ })
+ pctx.StaticVariable("ClangAsanLibDir", "${ClangPath}/lib64/clang/${ClangShortVersion}/lib/linux")
pctx.VariableFunc("CcWrapper", func(config interface{}) (string, error) {
if override := config.(android.Config).Getenv("CC_WRAPPER"); override != "" {