]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: make textflag.h available in runtime, avoid android/linux conflicts
authorRuss Cox <rsc@golang.org>
Fri, 5 Sep 2014 01:22:18 +0000 (21:22 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 5 Sep 2014 01:22:18 +0000 (21:22 -0400)
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

src/cmd/dist/build.c
src/cmd/dist/buildruntime.c
src/cmd/dist/goc2c.c

index 11fecbfad698fbe0089c7d0d7d9f80173215b4be..70c2da432b8be56e19ee6dca1ba5ed8dfc32302a 100644 (file)
@@ -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);
        }
 
 
index ade91024dcc195c1ffaeea1f2571a1a82b98b6fa..751a83f5ac772a56c2713b82ec5480505067b119 100644 (file)
@@ -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"
index a24fbfe20444f4d385872a3f8ac0d9e599d91c7b..ddf70411c81259aa88fb90caeccdfa12f870d468 100644 (file)
@@ -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;