Commit 66c32384 authored by Anthony Martin's avatar Anthony Martin Committed by Russ Cox

build: do not use the host's libbio on Plan 9

R=jas, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/14604047
parent bc9691c4
...@@ -33,8 +33,6 @@ extern "C" { ...@@ -33,8 +33,6 @@ extern "C" {
AUTOLIB(bio) AUTOLIB(bio)
#endif #endif
#include <fcntl.h> /* for O_RDONLY, O_WRONLY */
typedef struct Biobuf Biobuf; typedef struct Biobuf Biobuf;
enum enum
......
// 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
...@@ -626,7 +626,7 @@ install(char *dir) ...@@ -626,7 +626,7 @@ install(char *dir)
Buf b, b1, path; Buf b, b1, path;
Vec compile, files, link, go, missing, clean, lib, extra; Vec compile, files, link, go, missing, clean, lib, extra;
Time ttarg, t; Time ttarg, t;
int i, j, k, n, doclean, targ, usecpp; int i, j, k, n, doclean, targ;
if(vflag) { if(vflag) {
if(!streq(goos, gohostos) || !streq(goarch, gohostarch)) if(!streq(goos, gohostos) || !streq(goarch, gohostarch))
...@@ -778,8 +778,6 @@ install(char *dir) ...@@ -778,8 +778,6 @@ install(char *dir)
bsubst(&b1, "$GOARCH", goarch); bsubst(&b1, "$GOARCH", goarch);
p = bstr(&b1); p = bstr(&b1);
if(hassuffix(p, ".a")) { if(hassuffix(p, ".a")) {
if(streq(gohostos, "plan9") && hassuffix(p, "libbio.a"))
continue;
vadd(&lib, bpathf(&b, "%s", p)); vadd(&lib, bpathf(&b, "%s", p));
continue; continue;
} }
...@@ -933,20 +931,6 @@ install(char *dir) ...@@ -933,20 +931,6 @@ install(char *dir)
goto nobuild; 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. // Compile the files.
for(i=0; i<files.len; i++) { for(i=0; i<files.len; i++) {
if(!hassuffix(files.p[i], ".c") && !hassuffix(files.p[i], ".s")) if(!hassuffix(files.p[i], ".c") && !hassuffix(files.p[i], ".s"))
...@@ -958,13 +942,12 @@ install(char *dir) ...@@ -958,13 +942,12 @@ install(char *dir)
// C library or tool. // C library or tool.
if(streq(gohostos, "plan9")) { if(streq(gohostos, "plan9")) {
vadd(&compile, bprintf(&b, "%sc", gohostchar)); vadd(&compile, bprintf(&b, "%sc", gohostchar));
vadd(&compile, "-FTVw"); vadd(&compile, "-FTVwp");
if(usecpp) vadd(&compile, "-DPLAN9");
vadd(&compile, "-Bp+"); 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", goroot));
vadd(&compile, bpathf(&b, "-I%s/include/plan9/%s", goroot, gohostarch)); 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 { } else {
vcopy(&compile, gccargs.p, gccargs.len); vcopy(&compile, gccargs.p, gccargs.len);
vadd(&compile, "-c"); vadd(&compile, "-c");
...@@ -1167,8 +1150,6 @@ shouldbuild(char *file, char *dir) ...@@ -1167,8 +1150,6 @@ shouldbuild(char *file, char *dir)
if(!contains(name, "plan9")) if(!contains(name, "plan9"))
return 0; return 0;
} }
if(streq(dir, "libbio"))
return 0;
} }
// Check file name for GOOS or GOARCH. // Check file name for GOOS or GOARCH.
......
...@@ -26,7 +26,6 @@ THE SOFTWARE. ...@@ -26,7 +26,6 @@ THE SOFTWARE.
#include <u.h> #include <u.h>
#include <libc.h> #include <libc.h>
#include <bio.h> #include <bio.h>
#include <utf.h>
long long
Bgetrune(Biobuf *bp) Bgetrune(Biobuf *bp)
......
...@@ -67,7 +67,9 @@ Bvprint(Biobuf *bp, char *fmt, va_list arg) ...@@ -67,7 +67,9 @@ Bvprint(Biobuf *bp, char *fmt, va_list arg)
Fmt f; Fmt f;
memset(&f, 0, sizeof f); memset(&f, 0, sizeof f);
#ifndef PLAN9
fmtlocaleinit(&f, nil, nil, nil); fmtlocaleinit(&f, nil, nil, nil);
#endif
f.stop = bp->ebuf; f.stop = bp->ebuf;
f.to = (char*)f.stop + bp->ocount; f.to = (char*)f.stop + bp->ocount;
f.flush = bflush; f.flush = bflush;
......
...@@ -26,7 +26,6 @@ THE SOFTWARE. ...@@ -26,7 +26,6 @@ THE SOFTWARE.
#include <u.h> #include <u.h>
#include <libc.h> #include <libc.h>
#include <bio.h> #include <bio.h>
#include <utf.h>
int int
Bputrune(Biobuf *bp, long c) Bputrune(Biobuf *bp, long c)
......
...@@ -33,7 +33,7 @@ Bseek(Biobuf *bp, vlong offset, int base) ...@@ -33,7 +33,7 @@ Bseek(Biobuf *bp, vlong offset, int base)
vlong n, d; vlong n, d;
int bufsz; int bufsz;
#ifndef _WIN32 #if !defined(_WIN32) && !defined(PLAN9)
if(sizeof(offset) != sizeof(off_t)) { if(sizeof(offset) != sizeof(off_t)) {
fprint(2, "Bseek: libbio compiled with %d-byte offset\n", sizeof(off_t)); fprint(2, "Bseek: libbio compiled with %d-byte offset\n", sizeof(off_t));
abort(); abort();
......
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