diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2015-02-14 01:45:56 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-02-14 01:45:56 +0000 |
commit | 5570708ca56a86111c25d2962dd208b837dccdad (patch) | |
tree | b1ec6f52aab87bcb13025ab1a8491f3941a42846 /llvm/tools/llvm-go | |
parent | 70eb9c5ae59b739b31245ef18f84eeb2a4a68ffa (diff) | |
download | bcm5719-llvm-5570708ca56a86111c25d2962dd208b837dccdad.tar.gz bcm5719-llvm-5570708ca56a86111c25d2962dd208b837dccdad.zip |
llvm-go: Add flag for specifying path to go command.
Differential Revision: http://reviews.llvm.org/D7627
llvm-svn: 229209
Diffstat (limited to 'llvm/tools/llvm-go')
-rw-r--r-- | llvm/tools/llvm-go/llvm-go.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/tools/llvm-go/llvm-go.go b/llvm/tools/llvm-go/llvm-go.go index 70d91d83893..55f20315ded 100644 --- a/llvm/tools/llvm-go/llvm-go.go +++ b/llvm/tools/llvm-go/llvm-go.go @@ -137,7 +137,7 @@ type (run_build_sh int) `, flags.cpp, flags.cxx, flags.ld) } -func runGoWithLLVMEnv(args []string, cc, cxx, llgo, cppflags, cxxflags, ldflags string) { +func runGoWithLLVMEnv(args []string, cc, cxx, gocmd, llgo, cppflags, cxxflags, ldflags string) { args = addTag(args, "byollvm") srcdir := llvmConfig("--src-root") @@ -209,12 +209,12 @@ func runGoWithLLVMEnv(args []string, cc, cxx, llgo, cppflags, cxxflags, ldflags } } - gocmdpath, err := exec.LookPath("go") + gocmdpath, err := exec.LookPath(gocmd) if err != nil { panic(err.Error()) } - proc, err := os.StartProcess(gocmdpath, append([]string{"go"}, args...), + proc, err := os.StartProcess(gocmdpath, append([]string{gocmd}, args...), &os.ProcAttr{ Env: newenv, Files: []*os.File{os.Stdin, os.Stdout, os.Stderr}, @@ -247,6 +247,7 @@ func main() { cppflags := os.Getenv("CGO_CPPFLAGS") cxxflags := os.Getenv("CGO_CXXFLAGS") ldflags := os.Getenv("CGO_LDFLAGS") + gocmd := "go" llgo := "" args := os.Args[1:] @@ -260,6 +261,9 @@ func main() { case strings.HasPrefix(args[0], "cxx="): cxx = args[0][4:] args = args[1:] + case strings.HasPrefix(args[0], "go="): + gocmd = args[0][3:] + args = args[1:] case strings.HasPrefix(args[0], "llgo="): llgo = args[0][5:] args = args[1:] @@ -279,7 +283,7 @@ func main() { switch args[0] { case "build", "get", "install", "run", "test": - runGoWithLLVMEnv(args, cc, cxx, llgo, cppflags, cxxflags, ldflags) + runGoWithLLVMEnv(args, cc, cxx, gocmd, llgo, cppflags, cxxflags, ldflags) case "print-components": printComponents() case "print-config": |