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" {
AUTOLIB(bio)
#endif
#include <fcntl.h> /* for O_RDONLY, O_WRONLY */
typedef struct Biobuf Biobuf;
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)
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.
......
......@@ -26,7 +26,6 @@ THE SOFTWARE.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <utf.h>
long
Bgetrune(Biobuf *bp)
......
......@@ -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;
......
......@@ -26,7 +26,6 @@ THE SOFTWARE.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <utf.h>
int
Bputrune(Biobuf *bp, long 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();
......
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