aboutsummaryrefslogtreecommitdiffstats
path: root/cc/config/x86_darwin_host.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-05-08 21:15:59 +0000
committerDan Willemsen <dwillemsen@google.com>2017-05-15 15:22:45 -0700
commit6606872bf6d40fd989fb63489c5313e208a1949c (patch)
treef8f1c505960159ffb37765df37b0a174bf24eb17 /cc/config/x86_darwin_host.go
parent02f3add3a33ce563fb1172923ca0b5321f0edce1 (diff)
downloadbuild_soong-6606872bf6d40fd989fb63489c5313e208a1949c.tar.gz
build_soong-6606872bf6d40fd989fb63489c5313e208a1949c.tar.bz2
build_soong-6606872bf6d40fd989fb63489c5313e208a1949c.zip
Revert "Revert "Ensure environment dependencies are correct""
This reverts commit 4068a5db6c60d890e4d49379d600fd34ee94fdec. Now the Mac xcode-select and xcrun goes through Config.HostSystemTool, which will grab $PATH through Config.Getenv Test: m -j (on mac) Change-Id: I2632c4fdb2ec961e59944cf02ff165e0fd3c869d
Diffstat (limited to 'cc/config/x86_darwin_host.go')
-rw-r--r--cc/config/x86_darwin_host.go24
1 files changed, 15 insertions, 9 deletions
diff --git a/cc/config/x86_darwin_host.go b/cc/config/x86_darwin_host.go
index b6b08fe1..65fa1edd 100644
--- a/cc/config/x86_darwin_host.go
+++ b/cc/config/x86_darwin_host.go
@@ -115,7 +115,8 @@ const (
func init() {
pctx.VariableFunc("macSdkPath", func(config interface{}) (string, error) {
- bytes, err := exec.Command("xcode-select", "--print-path").Output()
+ xcodeselect := config.(android.Config).HostSystemTool("xcode-select")
+ bytes, err := exec.Command(xcodeselect, "--print-path").Output()
return strings.TrimSpace(string(bytes)), err
})
pctx.VariableFunc("macSdkRoot", func(config interface{}) (string, error) {
@@ -123,18 +124,16 @@ func init() {
})
pctx.StaticVariable("macMinVersion", "10.8")
pctx.VariableFunc("MacArPath", func(config interface{}) (string, error) {
- bytes, err := exec.Command("xcrun", "--find", "ar").Output()
- return strings.TrimSpace(string(bytes)), err
+ return xcrun(config.(android.Config), "--find", "ar")
})
pctx.VariableFunc("MacStripPath", func(config interface{}) (string, error) {
- bytes, err := exec.Command("xcrun", "--find", "strip").Output()
- return strings.TrimSpace(string(bytes)), err
+ return xcrun(config.(android.Config), "--find", "strip")
})
pctx.VariableFunc("MacToolPath", func(config interface{}) (string, error) {
- bytes, err := exec.Command("xcrun", "--find", "ld").Output()
- return filepath.Dir(strings.TrimSpace(string(bytes))), err
+ path, err := xcrun(config.(android.Config), "--find", "ld")
+ return filepath.Dir(path), err
})
pctx.StaticVariable("DarwinGccVersion", darwinGccVersion)
@@ -162,13 +161,20 @@ func init() {
pctx.StaticVariable("DarwinX8664ClangLdflags", strings.Join(darwinX8664ClangLdflags, " "))
}
+func xcrun(config android.Config, args ...string) (string, error) {
+ xcrun := config.HostSystemTool("xcrun")
+ bytes, err := exec.Command(xcrun, args...).Output()
+ return strings.TrimSpace(string(bytes)), err
+}
+
func xcrunSdk(config android.Config, arg string) (string, error) {
+ xcrun := config.HostSystemTool("xcrun")
if selected := config.Getenv("MAC_SDK_VERSION"); selected != "" {
if !inList(selected, darwinSupportedSdkVersions) {
return "", fmt.Errorf("MAC_SDK_VERSION %s isn't supported: %q", selected, darwinSupportedSdkVersions)
}
- bytes, err := exec.Command("xcrun", "--sdk", "macosx"+selected, arg).Output()
+ bytes, err := exec.Command(xcrun, "--sdk", "macosx"+selected, arg).Output()
if err == nil {
return strings.TrimSpace(string(bytes)), err
}
@@ -176,7 +182,7 @@ func xcrunSdk(config android.Config, arg string) (string, error) {
}
for _, sdk := range darwinSupportedSdkVersions {
- bytes, err := exec.Command("xcrun", "--sdk", "macosx"+sdk, arg).Output()
+ bytes, err := exec.Command(xcrun, "--sdk", "macosx"+sdk, arg).Output()
if err == nil {
return strings.TrimSpace(string(bytes)), err
}