llvm.org GIT mirror llvm / e887b2e
llvm-go: Add flag for specifying path to go command. Differential Revision: http://reviews.llvm.org/D7627 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229209 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 5 years ago
1 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
136136 `, flags.cpp, flags.cxx, flags.ld)
137137 }
138138
139 func runGoWithLLVMEnv(args []string, cc, cxx, llgo, cppflags, cxxflags, ldflags string) {
139 func runGoWithLLVMEnv(args []string, cc, cxx, gocmd, llgo, cppflags, cxxflags, ldflags string) {
140140 args = addTag(args, "byollvm")
141141
142142 srcdir := llvmConfig("--src-root")
208208 }
209209 }
210210
211 gocmdpath, err := exec.LookPath("go")
212 if err != nil {
213 panic(err.Error())
214 }
215
216 proc, err := os.StartProcess(gocmdpath, append([]string{"go"}, args...),
211 gocmdpath, err := exec.LookPath(gocmd)
212 if err != nil {
213 panic(err.Error())
214 }
215
216 proc, err := os.StartProcess(gocmdpath, append([]string{gocmd}, args...),
217217 &os.ProcAttr{
218218 Env: newenv,
219219 Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
246246 cppflags := os.Getenv("CGO_CPPFLAGS")
247247 cxxflags := os.Getenv("CGO_CXXFLAGS")
248248 ldflags := os.Getenv("CGO_LDFLAGS")
249 gocmd := "go"
249250 llgo := ""
250251
251252 args := os.Args[1:]
259260 case strings.HasPrefix(args[0], "cxx="):
260261 cxx = args[0][4:]
261262 args = args[1:]
263 case strings.HasPrefix(args[0], "go="):
264 gocmd = args[0][3:]
265 args = args[1:]
262266 case strings.HasPrefix(args[0], "llgo="):
263267 llgo = args[0][5:]
264268 args = args[1:]
278282
279283 switch args[0] {
280284 case "build", "get", "install", "run", "test":
281 runGoWithLLVMEnv(args, cc, cxx, llgo, cppflags, cxxflags, ldflags)
285 runGoWithLLVMEnv(args, cc, cxx, gocmd, llgo, cppflags, cxxflags, ldflags)
282286 case "print-components":
283287 printComponents()
284288 case "print-config":