Commit 94e523cb authored by Cherry Zhang's avatar Cherry Zhang Committed by David Crawshaw

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/22534Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent d8b7bd6a
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment