make.go: specify GOROOT for gopherjs where needed

GOROOT needs to be specified when building gopherjs itself, and for
gopherjs, when building the go part of the web UI.

Fixes #935

Change-Id: I7f83cefa9fd44019e8f75f8a0de70e198c905fd8
This commit is contained in:
mpl 2017-07-17 13:30:29 +02:00
parent 83a35501ed
commit f1733b2162
1 changed files with 6 additions and 1 deletions

View File

@ -370,7 +370,6 @@ func buildGopherjs() (string, error) {
log.Printf("Now rebuilding gopherjs at %v", bin)
goBin := "go"
if gopherjsGoroot != "" {
// CAMLI_GOPHERJS_GOROOT was specified
goBin = filepath.Join(gopherjsGoroot, "bin", "go")
}
cmd := exec.Command(goBin, "install")
@ -382,6 +381,9 @@ func buildGopherjs() (string, error) {
// current (host) platform.
cmd.Env = setEnv(cmd.Env, "GOOS", runtime.GOOS)
cmd.Env = setEnv(cmd.Env, "GOARCH", runtime.GOARCH)
if gopherjsGoroot != "" {
cmd.Env = setEnv(cmd.Env, "GOROOT", gopherjsGoroot)
}
if out, err := cmd.CombinedOutput(); err != nil {
return "", fmt.Errorf("error while building gopherjs: %v, %v", err, string(out))
}
@ -564,6 +566,9 @@ func genWebUIJS(gopherjsBin string) error {
// Pretend we're on linux regardless of the actual host, because recommended
// hack to work around https://github.com/gopherjs/gopherjs/issues/511
cmd.Env = setEnv(cmd.Env, "GOOS", "linux")
if gopherjsGoroot != "" {
cmd.Env = setEnv(cmd.Env, "GOROOT", gopherjsGoroot)
}
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("gopherjs for web UI error: %v, %v", err, string(out))
}