1
0
mirror of https://github.com/golang/go synced 2024-11-26 20:01:19 -07:00

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

R=jas, lucio.dere, rsc
CC=golang-dev
https://golang.org/cl/14604047
This commit is contained in:
Anthony Martin 2013-12-09 18:39:58 -05:00 committed by Russ Cox
parent bc9691c465
commit 66c32384dd
7 changed files with 16 additions and 29 deletions

View File

@ -33,8 +33,6 @@ extern "C" {
AUTOLIB(bio)
#endif
#include <fcntl.h> /* for O_RDONLY, O_WRONLY */
typedef struct Biobuf Biobuf;
enum

8
include/plan9/bio.h Normal file
View File

@ -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

29
src/cmd/dist/build.c vendored
View 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.

View File

@ -26,7 +26,6 @@ THE SOFTWARE.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <utf.h>
long
Bgetrune(Biobuf *bp)

View 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;

View 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)

View 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();