]> Cypherpunks repositories - gostls13.git/commitdiff
build: do not use the host's libbio on Plan 9
authorAnthony Martin <ality@pbrane.org>
Mon, 9 Dec 2013 23:39:58 +0000 (18:39 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 9 Dec 2013 23:39:58 +0000 (18:39 -0500)
R=jas, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/14604047

include/bio.h
include/plan9/bio.h [new file with mode: 0644]
src/cmd/dist/build.c
src/libbio/bgetrune.c
src/libbio/bprint.c
src/libbio/bputrune.c
src/libbio/bseek.c

index 5506c7c3284f3ca6b72806662fa0755717a174e8..c9c3332e82141dd695126cfb89861c55c6ba0abc 100644 (file)
@@ -33,8 +33,6 @@ extern "C" {
 AUTOLIB(bio)
 #endif
 
-#include <fcntl.h>     /* for O_RDONLY, O_WRONLY */
-
 typedef        struct  Biobuf  Biobuf;
 
 enum
diff --git a/include/plan9/bio.h b/include/plan9/bio.h
new file mode 100644 (file)
index 0000000..13d5e0e
--- /dev/null
@@ -0,0 +1,8 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "../bio.h"
+
+#define fmtcharstod charstod
+#define lseek seek
index 7834b30427fc8a69bb68697ea147076006344988..f199c6bf5c5d454545970dd18b468dfd5a5716bd 100644 (file)
@@ -626,7 +626,7 @@ install(char *dir)
        Buf b, b1, path;
        Vec compile, files, link, go, missing, clean, lib, extra;
        Time ttarg, t;
-       int i, j, k, n, doclean, targ, usecpp;
+       int i, j, k, n, doclean, targ;
 
        if(vflag) {
                if(!streq(goos, gohostos) || !streq(goarch, gohostarch))
@@ -778,8 +778,6 @@ install(char *dir)
                                bsubst(&b1, "$GOARCH", goarch);
                                p = bstr(&b1);
                                if(hassuffix(p, ".a")) {
-                                       if(streq(gohostos, "plan9") && hassuffix(p, "libbio.a"))
-                                               continue;
                                        vadd(&lib, bpathf(&b, "%s", p));
                                        continue;
                                }
@@ -933,20 +931,6 @@ install(char *dir)
                goto nobuild;
        }
 
-       // The files generated by GNU Bison use macros that aren't
-       // supported by the Plan 9 compilers so we have to use the
-       // external preprocessor when compiling.
-       usecpp = 0;
-       if(streq(gohostos, "plan9")) {
-               for(i=0; i<files.len; i++) {
-                       p = files.p[i];
-                       if(hassuffix(p, "y.tab.c") || hassuffix(p, "y.tab.h")){
-                               usecpp = 1;
-                               break;
-                       }
-               }
-       }
-
        // Compile the files.
        for(i=0; i<files.len; i++) {
                if(!hassuffix(files.p[i], ".c") && !hassuffix(files.p[i], ".s"))
@@ -958,13 +942,12 @@ install(char *dir)
                        // C library or tool.
                        if(streq(gohostos, "plan9")) {
                                vadd(&compile, bprintf(&b, "%sc", gohostchar));
-                               vadd(&compile, "-FTVw");
-                               if(usecpp)
-                                       vadd(&compile, "-Bp+");
+                               vadd(&compile, "-FTVwp");
+                               vadd(&compile, "-DPLAN9");
+                               vadd(&compile, "-D__STDC__=1");
+                               vadd(&compile, "-D__SIZE_TYPE__=ulong"); // for GNU Bison
                                vadd(&compile, bpathf(&b, "-I%s/include/plan9", goroot));
                                vadd(&compile, bpathf(&b, "-I%s/include/plan9/%s", goroot, gohostarch));
-                               // Work around Plan 9 C compiler's handling of #include with .. path.
-                               vadd(&compile, bpathf(&b, "-I%s/src/cmd/ld", goroot));
                        } else {
                                vcopy(&compile, gccargs.p, gccargs.len);
                                vadd(&compile, "-c");
@@ -1167,8 +1150,6 @@ shouldbuild(char *file, char *dir)
                        if(!contains(name, "plan9"))
                                return 0;
                }
-               if(streq(dir, "libbio"))
-                       return 0;
        }
        
        // Check file name for GOOS or GOARCH.
index 441c07991664a991c1c2e1170f5b8b8a37b4fa81..b5db3910617c45a8d3654e5e82857fb9c08fdc8c 100644 (file)
@@ -26,7 +26,6 @@ THE SOFTWARE.
 #include       <u.h>
 #include       <libc.h>
 #include       <bio.h>
-#include       <utf.h>
 
 long
 Bgetrune(Biobuf *bp)
index 301dc0c7f34c87a192db5cf9be2a9a8bdc23ec41..06748e7ac3c805defded1d48b1deaa1918a524d9 100644 (file)
@@ -67,7 +67,9 @@ Bvprint(Biobuf *bp, char *fmt, va_list arg)
        Fmt f;
        
        memset(&f, 0, sizeof f);
+#ifndef PLAN9
        fmtlocaleinit(&f, nil, nil, nil);
+#endif
        f.stop = bp->ebuf;
        f.to = (char*)f.stop + bp->ocount;
        f.flush = bflush;
index 7fe0e6569f95c09afdd568e55e114c44347b0213..0b4745ab4b044d2ebc74da883a68526fd7f05051 100644 (file)
@@ -26,7 +26,6 @@ THE SOFTWARE.
 #include       <u.h>
 #include       <libc.h>
 #include       <bio.h>
-#include       <utf.h>
 
 int
 Bputrune(Biobuf *bp, long c)
index eb426ccfc99e1336c29f991921af1f9ac1cbecfb..528958510634fc7c6c82d69ce599c4e4ace39d4a 100644 (file)
@@ -33,7 +33,7 @@ Bseek(Biobuf *bp, vlong offset, int base)
        vlong n, d;
        int bufsz;
 
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(PLAN9)
        if(sizeof(offset) != sizeof(off_t)) {
                fprint(2, "Bseek: libbio compiled with %d-byte offset\n", sizeof(off_t));
                abort();