1
0
mirror of https://github.com/golang/go synced 2024-11-12 04:50:21 -07:00

misc/cgo/testcarchive: fix C include path for darwin/arm

After CL 22461, c-archive build on darwin/arm is by default compiled
with -shared and installed in pkg/darwin_arm_shared.

Fix build (2nd time...)

Change-Id: Ia2bb09bb6e1ebc9bc74f7570dd80c81d05eaf744
Reviewed-on: https://go-review.googlesource.com/22534
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Cherry Zhang 2016-04-27 18:03:49 -04:00 committed by David Crawshaw
parent d8b7bd6a1f
commit 94e523cb52

View File

@ -31,6 +31,7 @@ var gopathEnv []string
var exeSuffix string
var GOOS, GOARCH string
var libgodir string
func init() {
bin = []string{"./testp"}
@ -84,7 +85,11 @@ func init() {
// TODO(crawshaw): can we do better?
cc = append(cc, []string{"-framework", "CoreFoundation", "-framework", "Foundation"}...)
}
cc = append(cc, "-I", filepath.Join("pkg", GOOS+"_"+GOARCH))
libgodir = GOOS + "_" + GOARCH
if GOOS == "darwin" && GOARCH == "arm" {
libgodir = GOOS + "_" + GOARCH + "_shared"
}
cc = append(cc, "-I", filepath.Join("pkg", libgodir))
// Build an environment with GOPATH=$(pwd)
env := os.Environ()
@ -147,11 +152,7 @@ func TestInstall(t *testing.T) {
t.Fatal(err)
}
libgopath := filepath.Join("pkg", GOOS+"_"+GOARCH, "libgo.a")
if GOOS == "darwin" && GOARCH == "arm" {
libgopath = filepath.Join("pkg", GOOS+"_"+GOARCH+"_shared", "libgo.a")
}
compilemain(t, libgopath)
compilemain(t, filepath.Join("pkg", libgodir, "libgo.a"))
binArgs := append(bin, "arg1", "arg2")
if out, err := exec.Command(binArgs[0], binArgs[1:]...).CombinedOutput(); err != nil {