Commit 73a6d36d authored by Russ Cox's avatar Russ Cox

cmd/dist: make textflag.h available in runtime, avoid android/linux conflicts

1) cmd/dist was copying textflag.h to the build include directory,
but only after compiling package runtime. So other packages could
use it, just not runtime. Copy earlier, so that runtime can use it too.

2) We decided for android that anything marked linux is also included
in the build. The generated linux-specific files in cmd/dist must therefore
have explicit +build !android tags, or else you can't have simultaneous
linux/arm and android/arm builds in a single client. The tag was already
there for at least one file, but it was missing from many others.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/134500043
parent 99a08262
......@@ -897,6 +897,8 @@ install(char *dir)
bpathf(&b1, "%s/os_%s.h", bstr(&path), goos), 0);
copy(bpathf(&b, "%s/signals_GOOS.h", workdir),
bpathf(&b1, "%s/signals_%s.h", bstr(&path), goos), 0);
copy(bpathf(&b, "%s/pkg/%s_%s/textflag.h", goroot, goos, goarch),
bpathf(&b1, "%s/src/cmd/ld/textflag.h", goroot), 0);
}
// Generate any missing files; regenerate existing ones.
......@@ -1119,15 +1121,12 @@ install(char *dir)
nobuild:
// In package runtime, we install runtime.h and cgocall.h too,
// for use by cgo compilation. For assembler source, we also
// copy cmd/ld/textflag.h.
// for use by cgo compilation.
if(streq(dir, "pkg/runtime")) {
copy(bpathf(&b, "%s/pkg/%s_%s/cgocall.h", goroot, goos, goarch),
bpathf(&b1, "%s/src/pkg/runtime/cgocall.h", goroot), 0);
copy(bpathf(&b, "%s/pkg/%s_%s/runtime.h", goroot, goos, goarch),
bpathf(&b1, "%s/src/pkg/runtime/runtime.h", goroot), 0);
copy(bpathf(&b, "%s/pkg/%s_%s/textflag.h", goroot, goos, goarch),
bpathf(&b1, "%s/src/cmd/ld/textflag.h", goroot), 0);
}
......
......@@ -112,7 +112,7 @@ mkzgoos(char *dir, char *file)
bwritestr(&out, "// auto generated by go tool dist\n\n");
if (streq(goos, "linux")) {
if(streq(goos, "linux")) {
bwritestr(&out, "// +build !android\n\n");
}
......@@ -174,6 +174,10 @@ mkzasm(char *dir, char *file)
vinit(&fields);
bwritestr(&out, "// auto generated by go tool dist\n\n");
if(streq(goos, "linux")) {
bwritestr(&out, "// +build !android\n\n");
}
for(i=0; i<nelem(zasmhdr); i++) {
if(hasprefix(goarch, zasmhdr[i].goarch) && hasprefix(goos, zasmhdr[i].goos)) {
bwritestr(&out, zasmhdr[i].hdr);
......@@ -287,6 +291,10 @@ mkzsys(char *dir, char *file)
binit(&out);
bwritestr(&out, "// auto generated by go tool dist\n\n");
if(streq(goos, "linux")) {
bwritestr(&out, "// +build !android\n\n");
}
if(streq(goos, "windows")) {
bwritef(&out,
"// runtime·callbackasm is called by external code to\n"
......@@ -339,7 +347,13 @@ mkzruntimedefs(char *dir, char *file)
vinit(&seen);
bwritestr(&out, "// auto generated by go tool dist\n"
"\n"
"\n");
if(streq(goos, "linux")) {
bwritestr(&out, "// +build !android\n\n");
}
bwritestr(&out,
"package runtime\n"
"import \"unsafe\"\n"
"var _ unsafe.Pointer\n"
......
......@@ -825,6 +825,10 @@ goc2c(char *goc, char *goc_final, char *c)
}
bprintf(&out, "// auto generated by go tool dist\n// goos=%s goarch=%s\n\n", goos, goarch);
if(streq(goos, "linux")) {
bwritestr(&out, "// +build !android\n\n");
}
input = bstr(&in);
output = &out;
......
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