Expose real GccVersion
In order to validate that the NDK STL paths exists, we need to know
the full path, including the Gcc version during the go execution. So
instead of returning a ninja variable reference, just return the
contents of the variable.
This also fixes a few invalid uses of armGccVersion to the proper
variable.
Change-Id: I54398ba4aa4000235b7d537a2c4efe3ecbbeec8b
diff --git a/cc/arm64_device.go b/cc/arm64_device.go
index 9d58a80..055f948 100644
--- a/cc/arm64_device.go
+++ b/cc/arm64_device.go
@@ -71,8 +71,12 @@
}
)
+const (
+ arm64GccVersion = "4.9"
+)
+
func init() {
- pctx.StaticVariable("arm64GccVersion", "4.9")
+ pctx.StaticVariable("arm64GccVersion", arm64GccVersion)
pctx.StaticVariable("arm64GccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/aarch64/aarch64-linux-android-${arm64GccVersion}")
@@ -115,7 +119,7 @@
}
func (t *toolchainArm64) GccVersion() string {
- return "${arm64GccVersion}"
+ return arm64GccVersion
}
func (t *toolchainArm64) Cflags() string {
diff --git a/cc/arm_device.go b/cc/arm_device.go
index 2d6d38c..ccfefba 100644
--- a/cc/arm_device.go
+++ b/cc/arm_device.go
@@ -121,6 +121,10 @@
armClangArchVariantCflags = copyVariantFlags(armArchVariantCflags)
)
+const (
+ armGccVersion = "4.9"
+)
+
func copyVariantFlags(m map[string][]string) map[string][]string {
ret := make(map[string][]string, len(m))
for k, v := range m {
@@ -148,7 +152,7 @@
"-mfpu=neon-vfpv4",
}
- pctx.StaticVariable("armGccVersion", "4.9")
+ pctx.StaticVariable("armGccVersion", armGccVersion)
pctx.StaticVariable("armGccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/arm/arm-linux-androideabi-${armGccVersion}")
@@ -268,7 +272,7 @@
}
func (t *toolchainArm) GccVersion() string {
- return "${armGccVersion}"
+ return armGccVersion
}
func (t *toolchainArm) ToolchainCflags() string {
diff --git a/cc/mips64_device.go b/cc/mips64_device.go
index e0b6a89..5aa5bc3 100644
--- a/cc/mips64_device.go
+++ b/cc/mips64_device.go
@@ -80,14 +80,18 @@
}
)
+const (
+ mips64GccVersion = "4.9"
+)
+
func init() {
common.RegisterArchFeatures(common.Mips64, "mips64r6",
"rev6")
- pctx.StaticVariable("mips64GccVersion", "4.9")
+ pctx.StaticVariable("mips64GccVersion", mips64GccVersion)
pctx.StaticVariable("mips64GccRoot",
- "prebuilts/gcc/${HostPrebuiltTag}/mips/mips64el-linux-android-${armGccVersion}")
+ "prebuilts/gcc/${HostPrebuiltTag}/mips/mips64el-linux-android-${mips64GccVersion}")
pctx.StaticVariable("mips64GccTriple", "mips64el-linux-android")
@@ -138,7 +142,7 @@
}
func (t *toolchainMips64) GccVersion() string {
- return "${mips64GccVersion}"
+ return mips64GccVersion
}
func (t *toolchainMips64) ToolchainLdflags() string {
diff --git a/cc/mips_device.go b/cc/mips_device.go
index c3372fe..8b47f8a 100644
--- a/cc/mips_device.go
+++ b/cc/mips_device.go
@@ -111,14 +111,18 @@
}
)
+const (
+ mipsGccVersion = "4.9"
+)
+
func init() {
common.RegisterArchFeatures(common.Mips, "mips32r6",
"rev6")
- pctx.StaticVariable("mipsGccVersion", "4.9")
+ pctx.StaticVariable("mipsGccVersion", mipsGccVersion)
pctx.StaticVariable("mipsGccRoot",
- "prebuilts/gcc/${HostPrebuiltTag}/mips/mips64el-linux-android-${armGccVersion}")
+ "prebuilts/gcc/${HostPrebuiltTag}/mips/mips64el-linux-android-${mipsGccVersion}")
pctx.StaticVariable("mipsGccTriple", "mips64el-linux-android")
@@ -170,7 +174,7 @@
}
func (t *toolchainMips) GccVersion() string {
- return "${mipsGccVersion}"
+ return mipsGccVersion
}
func (t *toolchainMips) ToolchainLdflags() string {
diff --git a/cc/toolchain.go b/cc/toolchain.go
index 5e4d02f..ac51114 100644
--- a/cc/toolchain.go
+++ b/cc/toolchain.go
@@ -46,7 +46,9 @@
GccRoot() string
GccTriple() string
+ // GccVersion should return a real value, not a ninja reference
GccVersion() string
+
ToolchainCflags() string
ToolchainLdflags() string
Cflags() string
diff --git a/cc/x86_64_device.go b/cc/x86_64_device.go
index 728442c..ba190a0 100644
--- a/cc/x86_64_device.go
+++ b/cc/x86_64_device.go
@@ -92,6 +92,10 @@
}
)
+const (
+ x86_64GccVersion = "4.9"
+)
+
func init() {
common.RegisterArchFeatures(common.X86_64, "",
"ssse3",
@@ -131,10 +135,10 @@
"aes_ni",
"popcnt")
- pctx.StaticVariable("x86_64GccVersion", "4.9")
+ pctx.StaticVariable("x86_64GccVersion", x86_64GccVersion)
pctx.StaticVariable("x86_64GccRoot",
- "prebuilts/gcc/${HostPrebuiltTag}/x86/x86_64-linux-android-${armGccVersion}")
+ "prebuilts/gcc/${HostPrebuiltTag}/x86/x86_64-linux-android-${x86_64GccVersion}")
pctx.StaticVariable("x86_64GccTriple", "x86_64-linux-android")
@@ -186,7 +190,7 @@
}
func (t *toolchainX86_64) GccVersion() string {
- return "${x86_64GccVersion}"
+ return x86_64GccVersion
}
func (t *toolchainX86_64) ToolchainLdflags() string {
diff --git a/cc/x86_darwin_host.go b/cc/x86_darwin_host.go
index 9ca03ba..108bb85 100644
--- a/cc/x86_darwin_host.go
+++ b/cc/x86_darwin_host.go
@@ -74,11 +74,15 @@
darwinClangCppflags = clangFilterUnknownCflags(darwinCppflags)
)
+const (
+ darwinGccVersion = "4.2.1"
+)
+
func init() {
pctx.StaticVariable("macSdkPath", "/Applications/Xcode.app/Contents/Developer")
pctx.StaticVariable("macSdkRoot", "${macSdkPath}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")
- pctx.StaticVariable("darwinGccVersion", "4.2.1")
+ pctx.StaticVariable("darwinGccVersion", darwinGccVersion)
pctx.StaticVariable("darwinGccRoot",
"${SrcDir}/prebuilts/gcc/${HostPrebuiltTag}/host/i686-apple-darwin-${darwinGccVersion}")
@@ -137,7 +141,7 @@
}
func (t *toolchainDarwin) GccVersion() string {
- return "${darwinGccVersion}"
+ return darwinGccVersion
}
func (t *toolchainDarwin) Cflags() string {
diff --git a/cc/x86_device.go b/cc/x86_device.go
index 8543240..6dfbd6a 100644
--- a/cc/x86_device.go
+++ b/cc/x86_device.go
@@ -95,6 +95,10 @@
}
)
+const (
+ x86GccVersion = "4.9"
+)
+
func init() {
common.RegisterArchFeatures(common.X86, "atom",
"ssse3",
@@ -133,10 +137,10 @@
"popcnt",
"movbe")
- pctx.StaticVariable("x86GccVersion", "4.9")
+ pctx.StaticVariable("x86GccVersion", x86GccVersion)
pctx.StaticVariable("x86GccRoot",
- "prebuilts/gcc/${HostPrebuiltTag}/x86/x86_64-linux-android-${armGccVersion}")
+ "prebuilts/gcc/${HostPrebuiltTag}/x86/x86_64-linux-android-${x86GccVersion}")
pctx.StaticVariable("x86GccTriple", "x86_64-linux-android")
@@ -188,7 +192,7 @@
}
func (t *toolchainX86) GccVersion() string {
- return "${x86GccVersion}"
+ return x86GccVersion
}
func (t *toolchainX86) ToolchainLdflags() string {
diff --git a/cc/x86_linux_host.go b/cc/x86_linux_host.go
index 09a0803..98bceef 100644
--- a/cc/x86_linux_host.go
+++ b/cc/x86_linux_host.go
@@ -101,8 +101,12 @@
}
)
+const (
+ linuxGccVersion = "4.8"
+)
+
func init() {
- pctx.StaticVariable("linuxGccVersion", "4.8")
+ pctx.StaticVariable("linuxGccVersion", linuxGccVersion)
pctx.StaticVariable("linuxGccRoot",
"${SrcDir}/prebuilts/gcc/${HostPrebuiltTag}/host/x86_64-linux-glibc2.15-${linuxGccVersion}")
@@ -163,7 +167,7 @@
}
func (t *toolchainLinux) GccVersion() string {
- return "${linuxGccVersion}"
+ return linuxGccVersion
}
func (t *toolchainLinuxX86) Cflags() string {
diff --git a/cc/x86_windows_host.go b/cc/x86_windows_host.go
index 70ce74d..5f06bec 100644
--- a/cc/x86_windows_host.go
+++ b/cc/x86_windows_host.go
@@ -61,8 +61,12 @@
}
)
+const (
+ windowsGccVersion = "4.8"
+)
+
func init() {
- pctx.StaticVariable("windowsGccVersion", "4.8")
+ pctx.StaticVariable("windowsGccVersion", windowsGccVersion)
pctx.StaticVariable("windowsGccRoot",
"${SrcDir}/prebuilts/gcc/${HostPrebuiltTag}/host/x86_64-w64-mingw32-${windowsGccVersion}")
@@ -92,7 +96,7 @@
}
func (t *toolchainWindows) GccVersion() string {
- return "${windowsGccVersion}"
+ return windowsGccVersion
}
func (t *toolchainWindows) Cflags() string {