summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Martin <ality@pbrane.org>2013-12-09 18:39:58 -0500
committerAnthony Martin <ality@pbrane.org>2013-12-09 18:39:58 -0500
commitbc034b7d63040f413568495b7f82dd509b0d9e18 (patch)
tree21abea74d64e37072aab3053f2be620f2f0150ea
parent356e4e5ee3fb5e48f50047b8212234777410aebc (diff)
downloadgo-bc034b7d63040f413568495b7f82dd509b0d9e18.tar.gz
build: do not use the host's libbio on Plan 9
R=jas, lucio.dere, rsc CC=golang-dev https://codereview.appspot.com/14604047 Committer: Russ Cox <rsc@golang.org>
-rw-r--r--include/bio.h2
-rw-r--r--include/plan9/bio.h8
-rw-r--r--src/cmd/dist/build.c29
-rw-r--r--src/libbio/bgetrune.c1
-rw-r--r--src/libbio/bprint.c2
-rw-r--r--src/libbio/bputrune.c1
-rw-r--r--src/libbio/bseek.c2
7 files changed, 16 insertions, 29 deletions
diff --git a/include/bio.h b/include/bio.h
index 5506c7c32..c9c3332e8 100644
--- a/include/bio.h
+++ b/include/bio.h
@@ -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
index 000000000..13d5e0ef2
--- /dev/null
+++ b/include/plan9/bio.h
@@ -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
diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c
index 7834b3042..f199c6bf5 100644
--- a/src/cmd/dist/build.c
+++ b/src/cmd/dist/build.c
@@ -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.
diff --git a/src/libbio/bgetrune.c b/src/libbio/bgetrune.c
index 441c07991..b5db39106 100644
--- a/src/libbio/bgetrune.c
+++ b/src/libbio/bgetrune.c
@@ -26,7 +26,6 @@ THE SOFTWARE.
#include <u.h>
#include <libc.h>
#include <bio.h>
-#include <utf.h>
long
Bgetrune(Biobuf *bp)
diff --git a/src/libbio/bprint.c b/src/libbio/bprint.c
index 301dc0c7f..06748e7ac 100644
--- a/src/libbio/bprint.c
+++ b/src/libbio/bprint.c
@@ -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;
diff --git a/src/libbio/bputrune.c b/src/libbio/bputrune.c
index 7fe0e6569..0b4745ab4 100644
--- a/src/libbio/bputrune.c
+++ b/src/libbio/bputrune.c
@@ -26,7 +26,6 @@ THE SOFTWARE.
#include <u.h>
#include <libc.h>
#include <bio.h>
-#include <utf.h>
int
Bputrune(Biobuf *bp, long c)
diff --git a/src/libbio/bseek.c b/src/libbio/bseek.c
index eb426ccfc..528958510 100644
--- a/src/libbio/bseek.c
+++ b/src/libbio/bseek.c
@@ -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();