From 66c32384dda82752deb3db8ba45acb073e9c4c1e Mon Sep 17 00:00:00 2001 From: Anthony Martin Date: Mon, 9 Dec 2013 18:39:58 -0500 Subject: [PATCH] build: do not use the host's libbio on Plan 9 R=jas, lucio.dere, rsc CC=golang-dev https://golang.org/cl/14604047 --- include/bio.h | 2 -- include/plan9/bio.h | 8 ++++++++ src/cmd/dist/build.c | 29 +++++------------------------ src/libbio/bgetrune.c | 1 - src/libbio/bprint.c | 2 ++ src/libbio/bputrune.c | 1 - src/libbio/bseek.c | 2 +- 7 files changed, 16 insertions(+), 29 deletions(-) create mode 100644 include/plan9/bio.h diff --git a/include/bio.h b/include/bio.h index 5506c7c328..c9c3332e82 100644 --- a/include/bio.h +++ b/include/bio.h @@ -33,8 +33,6 @@ extern "C" { AUTOLIB(bio) #endif -#include /* 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 0000000000..13d5e0ef20 --- /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 7834b30427..f199c6bf5c 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 #include #include -#include long Bgetrune(Biobuf *bp) diff --git a/src/libbio/bprint.c b/src/libbio/bprint.c index 301dc0c7f3..06748e7ac3 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 7fe0e6569f..0b4745ab4b 100644 --- a/src/libbio/bputrune.c +++ b/src/libbio/bputrune.c @@ -26,7 +26,6 @@ THE SOFTWARE. #include #include #include -#include int Bputrune(Biobuf *bp, long c) diff --git a/src/libbio/bseek.c b/src/libbio/bseek.c index eb426ccfc9..5289585106 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(); -- 2.50.0