[PATCH] llvm-go: Add flag for specifying path to go command.

Peter Collingbourne peter at pcc.me.uk
Fri Feb 13 17:48:01 PST 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7627

Files:
  llvm/trunk/tools/llvm-go/llvm-go.go

Index: llvm/trunk/tools/llvm-go/llvm-go.go
===================================================================
--- llvm/trunk/tools/llvm-go/llvm-go.go
+++ llvm/trunk/tools/llvm-go/llvm-go.go
@@ -137,7 +137,7 @@
 `, 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 @@
 		}
 	}
 
-	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 @@
 	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 @@
 		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 @@
 
 	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":

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7627.19954.patch
Type: text/x-patch
Size: 1695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150214/bb8a8ed1/attachment.bin>


More information about the llvm-commits mailing list