mirror of
https://github.com/golang/go
synced 2024-11-18 18:14:43 -07:00
cmd/dist: another attempt at textflag.h
The old change worked fine in my client, but my client must not have been in a completely clean state. TBR=r CC=golang-codereviews https://golang.org/cl/138100043
This commit is contained in:
parent
73a6d36d87
commit
cf3fd0a55f
1
src/cmd/dist/a.h
vendored
1
src/cmd/dist/a.h
vendored
@ -129,6 +129,7 @@ bool isfile(char *p);
|
|||||||
char* lastelem(char*);
|
char* lastelem(char*);
|
||||||
Time mtime(char*);
|
Time mtime(char*);
|
||||||
void readfile(Buf*, char*);
|
void readfile(Buf*, char*);
|
||||||
|
void copyfile(char*, char*, int);
|
||||||
void run(Buf *b, char *dir, int mode, char *cmd, ...);
|
void run(Buf *b, char *dir, int mode, char *cmd, ...);
|
||||||
void runv(Buf *b, char *dir, int mode, Vec *argv);
|
void runv(Buf *b, char *dir, int mode, Vec *argv);
|
||||||
void bgrunv(char *dir, int mode, Vec *argv);
|
void bgrunv(char *dir, int mode, Vec *argv);
|
||||||
|
25
src/cmd/dist/build.c
vendored
25
src/cmd/dist/build.c
vendored
@ -35,7 +35,6 @@ bool rebuildall;
|
|||||||
bool defaultclang;
|
bool defaultclang;
|
||||||
|
|
||||||
static bool shouldbuild(char*, char*);
|
static bool shouldbuild(char*, char*);
|
||||||
static void copy(char*, char*, int);
|
|
||||||
static void dopack(char*, char*, char**, int);
|
static void dopack(char*, char*, char**, int);
|
||||||
static char *findgoversion(void);
|
static char *findgoversion(void);
|
||||||
|
|
||||||
@ -674,7 +673,7 @@ install(char *dir)
|
|||||||
|
|
||||||
// For misc/prof, copy into the tool directory and we're done.
|
// For misc/prof, copy into the tool directory and we're done.
|
||||||
if(hasprefix(dir, "misc/")) {
|
if(hasprefix(dir, "misc/")) {
|
||||||
copy(bpathf(&b, "%s/%s", tooldir, name),
|
copyfile(bpathf(&b, "%s/%s", tooldir, name),
|
||||||
bpathf(&b1, "%s/misc/%s", goroot, name), 1);
|
bpathf(&b1, "%s/misc/%s", goroot, name), 1);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -886,18 +885,18 @@ install(char *dir)
|
|||||||
|
|
||||||
// For package runtime, copy some files into the work space.
|
// For package runtime, copy some files into the work space.
|
||||||
if(streq(dir, "pkg/runtime")) {
|
if(streq(dir, "pkg/runtime")) {
|
||||||
copy(bpathf(&b, "%s/arch_GOARCH.h", workdir),
|
copyfile(bpathf(&b, "%s/arch_GOARCH.h", workdir),
|
||||||
bpathf(&b1, "%s/arch_%s.h", bstr(&path), goarch), 0);
|
bpathf(&b1, "%s/arch_%s.h", bstr(&path), goarch), 0);
|
||||||
copy(bpathf(&b, "%s/defs_GOOS_GOARCH.h", workdir),
|
copyfile(bpathf(&b, "%s/defs_GOOS_GOARCH.h", workdir),
|
||||||
bpathf(&b1, "%s/defs_%s_%s.h", bstr(&path), goos, goarch), 0);
|
bpathf(&b1, "%s/defs_%s_%s.h", bstr(&path), goos, goarch), 0);
|
||||||
p = bpathf(&b1, "%s/signal_%s_%s.h", bstr(&path), goos, goarch);
|
p = bpathf(&b1, "%s/signal_%s_%s.h", bstr(&path), goos, goarch);
|
||||||
if(isfile(p))
|
if(isfile(p))
|
||||||
copy(bpathf(&b, "%s/signal_GOOS_GOARCH.h", workdir), p, 0);
|
copyfile(bpathf(&b, "%s/signal_GOOS_GOARCH.h", workdir), p, 0);
|
||||||
copy(bpathf(&b, "%s/os_GOOS.h", workdir),
|
copyfile(bpathf(&b, "%s/os_GOOS.h", workdir),
|
||||||
bpathf(&b1, "%s/os_%s.h", bstr(&path), goos), 0);
|
bpathf(&b1, "%s/os_%s.h", bstr(&path), goos), 0);
|
||||||
copy(bpathf(&b, "%s/signals_GOOS.h", workdir),
|
copyfile(bpathf(&b, "%s/signals_GOOS.h", workdir),
|
||||||
bpathf(&b1, "%s/signals_%s.h", bstr(&path), goos), 0);
|
bpathf(&b1, "%s/signals_%s.h", bstr(&path), goos), 0);
|
||||||
copy(bpathf(&b, "%s/pkg/%s_%s/textflag.h", goroot, goos, goarch),
|
copyfile(bpathf(&b, "%s/pkg/%s_%s/textflag.h", goroot, goos, goarch),
|
||||||
bpathf(&b1, "%s/src/cmd/ld/textflag.h", goroot), 0);
|
bpathf(&b1, "%s/src/cmd/ld/textflag.h", goroot), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,7 +931,7 @@ install(char *dir)
|
|||||||
// The last batch was required for the generators.
|
// The last batch was required for the generators.
|
||||||
// This one is generated.
|
// This one is generated.
|
||||||
if(streq(dir, "pkg/runtime")) {
|
if(streq(dir, "pkg/runtime")) {
|
||||||
copy(bpathf(&b, "%s/zasm_GOOS_GOARCH.h", workdir),
|
copyfile(bpathf(&b, "%s/zasm_GOOS_GOARCH.h", workdir),
|
||||||
bpathf(&b1, "%s/zasm_%s_%s.h", bstr(&path), goos, goarch), 0);
|
bpathf(&b1, "%s/zasm_%s_%s.h", bstr(&path), goos, goarch), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,9 +1122,9 @@ nobuild:
|
|||||||
// In package runtime, we install runtime.h and cgocall.h too,
|
// In package runtime, we install runtime.h and cgocall.h too,
|
||||||
// for use by cgo compilation.
|
// for use by cgo compilation.
|
||||||
if(streq(dir, "pkg/runtime")) {
|
if(streq(dir, "pkg/runtime")) {
|
||||||
copy(bpathf(&b, "%s/pkg/%s_%s/cgocall.h", goroot, goos, goarch),
|
copyfile(bpathf(&b, "%s/pkg/%s_%s/cgocall.h", goroot, goos, goarch),
|
||||||
bpathf(&b1, "%s/src/pkg/runtime/cgocall.h", goroot), 0);
|
bpathf(&b1, "%s/src/pkg/runtime/cgocall.h", goroot), 0);
|
||||||
copy(bpathf(&b, "%s/pkg/%s_%s/runtime.h", goroot, goos, goarch),
|
copyfile(bpathf(&b, "%s/pkg/%s_%s/runtime.h", goroot, goos, goarch),
|
||||||
bpathf(&b1, "%s/src/pkg/runtime/runtime.h", goroot), 0);
|
bpathf(&b1, "%s/src/pkg/runtime/runtime.h", goroot), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1248,8 +1247,8 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// copy copies the file src to dst, via memory (so only good for small files).
|
// copy copies the file src to dst, via memory (so only good for small files).
|
||||||
static void
|
void
|
||||||
copy(char *dst, char *src, int exec)
|
copyfile(char *dst, char *src, int exec)
|
||||||
{
|
{
|
||||||
Buf b;
|
Buf b;
|
||||||
|
|
||||||
|
11
src/cmd/dist/buildruntime.c
vendored
11
src/cmd/dist/buildruntime.c
vendored
@ -162,11 +162,12 @@ mkzasm(char *dir, char *file)
|
|||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
char *aggr, *p;
|
char *aggr, *p;
|
||||||
Buf in, b, out, exp;
|
Buf in, b, b1, out, exp;
|
||||||
Vec argv, lines, fields;
|
Vec argv, lines, fields;
|
||||||
|
|
||||||
binit(&in);
|
binit(&in);
|
||||||
binit(&b);
|
binit(&b);
|
||||||
|
binit(&b1);
|
||||||
binit(&out);
|
binit(&out);
|
||||||
binit(&exp);
|
binit(&exp);
|
||||||
vinit(&argv);
|
vinit(&argv);
|
||||||
@ -187,6 +188,9 @@ mkzasm(char *dir, char *file)
|
|||||||
fatal("unknown $GOOS/$GOARCH in mkzasm");
|
fatal("unknown $GOOS/$GOARCH in mkzasm");
|
||||||
ok:
|
ok:
|
||||||
|
|
||||||
|
copyfile(bpathf(&b, "%s/pkg/%s_%s/textflag.h", goroot, goos, goarch),
|
||||||
|
bpathf(&b1, "%s/src/cmd/ld/textflag.h", goroot), 0);
|
||||||
|
|
||||||
// Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -a -n -o workdir/proc.acid proc.c
|
// Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -a -n -o workdir/proc.acid proc.c
|
||||||
// to get acid [sic] output. Run once without the -a -o workdir/proc.acid in order to
|
// to get acid [sic] output. Run once without the -a -o workdir/proc.acid in order to
|
||||||
// report compilation failures (the -o redirects all messages, unfortunately).
|
// report compilation failures (the -o redirects all messages, unfortunately).
|
||||||
@ -198,6 +202,8 @@ ok:
|
|||||||
vadd(&argv, bprintf(&b, "GOARCH_%s", goarch));
|
vadd(&argv, bprintf(&b, "GOARCH_%s", goarch));
|
||||||
vadd(&argv, "-I");
|
vadd(&argv, "-I");
|
||||||
vadd(&argv, bprintf(&b, "%s", workdir));
|
vadd(&argv, bprintf(&b, "%s", workdir));
|
||||||
|
vadd(&argv, "-I");
|
||||||
|
vadd(&argv, bprintf(&b, "%s/pkg/%s_%s", goroot, goos, goarch));
|
||||||
vadd(&argv, "-n");
|
vadd(&argv, "-n");
|
||||||
vadd(&argv, "-a");
|
vadd(&argv, "-a");
|
||||||
vadd(&argv, "-o");
|
vadd(&argv, "-o");
|
||||||
@ -270,6 +276,7 @@ ok:
|
|||||||
|
|
||||||
bfree(&in);
|
bfree(&in);
|
||||||
bfree(&b);
|
bfree(&b);
|
||||||
|
bfree(&b1);
|
||||||
bfree(&out);
|
bfree(&out);
|
||||||
bfree(&exp);
|
bfree(&exp);
|
||||||
vfree(&argv);
|
vfree(&argv);
|
||||||
@ -375,6 +382,8 @@ mkzruntimedefs(char *dir, char *file)
|
|||||||
vadd(&argv, bprintf(&b, "GOARCH_%s", goarch));
|
vadd(&argv, bprintf(&b, "GOARCH_%s", goarch));
|
||||||
vadd(&argv, "-I");
|
vadd(&argv, "-I");
|
||||||
vadd(&argv, bprintf(&b, "%s", workdir));
|
vadd(&argv, bprintf(&b, "%s", workdir));
|
||||||
|
vadd(&argv, "-I");
|
||||||
|
vadd(&argv, bprintf(&b, "%s/pkg/%s_%s", goroot, goos, goarch));
|
||||||
vadd(&argv, "-q");
|
vadd(&argv, "-q");
|
||||||
vadd(&argv, "-n");
|
vadd(&argv, "-n");
|
||||||
vadd(&argv, "-o");
|
vadd(&argv, "-o");
|
||||||
|
Loading…
Reference in New Issue
Block a user