aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2016-03-09 10:41:21 -0800
committerDan Willemsen <dwillemsen@google.com>2016-03-09 10:41:21 -0800
commit6fb8b8d39840d768314b33a0e222038b5fdb1ebc (patch)
tree2cd702096e15ddd4620c46cc613751e28a43157b
parent282a4b0dda2eea7c4bc8d277ab52e5fc24f234e8 (diff)
downloadbuild_soong-6fb8b8d39840d768314b33a0e222038b5fdb1ebc.tar.gz
build_soong-6fb8b8d39840d768314b33a0e222038b5fdb1ebc.tar.bz2
build_soong-6fb8b8d39840d768314b33a0e222038b5fdb1ebc.zip
OSX: Use the oldest SDK, but always set our target to 10.8
Build binaries usable on older machines even if older SDKs are not installed. Older SDKs can no longer be installed on newer Xcode versions. Port of https://android-review.googlesource.com/207242 Change-Id: If66f2eef7593bce9fb858fc7b71369f55dd362e4
-rw-r--r--cc/x86_darwin_host.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/cc/x86_darwin_host.go b/cc/x86_darwin_host.go
index 9a7b68a9..bff9a03f 100644
--- a/cc/x86_darwin_host.go
+++ b/cc/x86_darwin_host.go
@@ -79,10 +79,10 @@ var (
darwinX8664ClangLdflags = clangFilterUnknownCflags(darwinX8664Ldflags)
darwinSupportedSdkVersions = []string{
- "macosx10.8",
- "macosx10.9",
- "macosx10.10",
- "macosx10.11",
+ "10.8",
+ "10.9",
+ "10.10",
+ "10.11",
}
)
@@ -99,9 +99,7 @@ func init() {
pctx.VariableFunc("macSdkRoot", func(config interface{}) (string, error) {
return xcrunSdk(config.(common.Config), "--show-sdk-path")
})
- pctx.VariableFunc("macSdkVersion", func(config interface{}) (string, error) {
- return xcrunSdk(config.(common.Config), "--show-sdk-version")
- })
+ pctx.StaticVariable("macSdkVersion", darwinSupportedSdkVersions[0])
pctx.VariableFunc("macArPath", func(config interface{}) (string, error) {
bytes, err := exec.Command("xcrun", "--find", "ar").Output()
return strings.TrimSpace(string(bytes)), err
@@ -138,7 +136,7 @@ func init() {
func xcrunSdk(config common.Config, arg string) (string, error) {
if selected := config.Getenv("MAC_SDK_VERSION"); selected != "" {
- if !inList("macosx"+selected, darwinSupportedSdkVersions) {
+ if !inList(selected, darwinSupportedSdkVersions) {
return "", fmt.Errorf("MAC_SDK_VERSION %s isn't supported: %q", selected, darwinSupportedSdkVersions)
}
@@ -150,7 +148,7 @@ func xcrunSdk(config common.Config, arg string) (string, error) {
}
for _, sdk := range darwinSupportedSdkVersions {
- bytes, err := exec.Command("xcrun", "--sdk", sdk, arg).Output()
+ bytes, err := exec.Command("xcrun", "--sdk", "macosx"+sdk, arg).Output()
if err == nil {
return strings.TrimSpace(string(bytes)), err
}