diff --git a/cc/arm64_device.go b/cc/arm64_device.go index 9d58a809b..055f948e6 100644 --- a/cc/arm64_device.go +++ b/cc/arm64_device.go @@ -71,8 +71,12 @@ var ( } ) +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) GccTriple() string { } 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 2d6d38c59..ccfefba87 100644 --- a/cc/arm_device.go +++ b/cc/arm_device.go @@ -121,6 +121,10 @@ var ( 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 @@ func init() { "-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) GccTriple() string { } 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 e0b6a89f2..5aa5bc3f5 100644 --- a/cc/mips64_device.go +++ b/cc/mips64_device.go @@ -80,14 +80,18 @@ var ( } ) +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) GccTriple() string { } 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 c3372fe6f..8b47f8a6b 100644 --- a/cc/mips_device.go +++ b/cc/mips_device.go @@ -111,14 +111,18 @@ var ( } ) +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) GccTriple() string { } 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 5e4d02ff3..ac5111433 100644 --- a/cc/toolchain.go +++ b/cc/toolchain.go @@ -46,7 +46,9 @@ type Toolchain interface { 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 728442cc3..ba190a02b 100644 --- a/cc/x86_64_device.go +++ b/cc/x86_64_device.go @@ -92,6 +92,10 @@ var ( } ) +const ( + x86_64GccVersion = "4.9" +) + func init() { common.RegisterArchFeatures(common.X86_64, "", "ssse3", @@ -131,10 +135,10 @@ func init() { "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) GccTriple() string { } 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 9ca03bac8..108bb85e3 100644 --- a/cc/x86_darwin_host.go +++ b/cc/x86_darwin_host.go @@ -74,11 +74,15 @@ var ( 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) GccTriple() string { } 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 8543240c6..6dfbd6ade 100644 --- a/cc/x86_device.go +++ b/cc/x86_device.go @@ -95,6 +95,10 @@ var ( } ) +const ( + x86GccVersion = "4.9" +) + func init() { common.RegisterArchFeatures(common.X86, "atom", "ssse3", @@ -133,10 +137,10 @@ func init() { "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) GccTriple() string { } 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 09a080334..98bceef47 100644 --- a/cc/x86_linux_host.go +++ b/cc/x86_linux_host.go @@ -101,8 +101,12 @@ var ( } ) +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) GccTriple() string { } 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 70ce74d5b..5f06bec20 100644 --- a/cc/x86_windows_host.go +++ b/cc/x86_windows_host.go @@ -61,8 +61,12 @@ var ( } ) +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) GccTriple() string { } func (t *toolchainWindows) GccVersion() string { - return "${windowsGccVersion}" + return windowsGccVersion } func (t *toolchainWindows) Cflags() string {