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
This commit is contained in:
Dan Willemsen 2015-12-07 12:30:44 -08:00
parent 93c2831af1
commit 34fc3b1e84
10 changed files with 60 additions and 22 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {