mirror of
https://github.com/golang/go
synced 2024-11-21 23:24:41 -07:00
cmd/dist: fix build
TBR=golang-dev CC=golang-dev https://golang.org/cl/5630049
This commit is contained in:
parent
961f96b5d2
commit
b8b2253ac7
15
src/cmd/dist/build.c
vendored
15
src/cmd/dist/build.c
vendored
@ -21,7 +21,7 @@ char *gochar;
|
||||
char *goroot_final;
|
||||
char *goversion;
|
||||
char *slash; // / for unix, \ for windows
|
||||
char *default_goroot;
|
||||
char *default_goroot = DEFAULT_GOROOT;
|
||||
|
||||
static bool shouldbuild(char*, char*);
|
||||
static void copy(char*, char*);
|
||||
@ -487,7 +487,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;
|
||||
int i, j, k, n, doclean;
|
||||
|
||||
binit(&b);
|
||||
binit(&b1);
|
||||
@ -747,6 +747,8 @@ install(char *dir)
|
||||
vadd(&compile, bprintf(&b, "-DGOARCH_%s", goos));
|
||||
}
|
||||
|
||||
bpathf(&b, "%s/%s", workdir, lastelem(files.p[i]));
|
||||
doclean = 1;
|
||||
if(!isgo && streq(gohostos, "darwin")) {
|
||||
// To debug C programs on OS X, it is not enough to say -ggdb
|
||||
// on the command line. You have to leave the object files
|
||||
@ -755,8 +757,8 @@ install(char *dir)
|
||||
bpathf(&b1, "%s/pkg/obj/%s", goroot, dir);
|
||||
xmkdirall(bstr(&b1));
|
||||
bpathf(&b, "%s/%s", bstr(&b1), lastelem(files.p[i]));
|
||||
} else
|
||||
bpathf(&b, "%s/%s", workdir, lastelem(files.p[i]));
|
||||
doclean = 0;
|
||||
}
|
||||
|
||||
b.p[b.len-1] = 'o'; // was c or s
|
||||
vadd(&compile, "-o");
|
||||
@ -765,7 +767,8 @@ install(char *dir)
|
||||
bgrunv(bstr(&path), CheckExit, &compile);
|
||||
|
||||
vadd(&link, bstr(&b));
|
||||
vadd(&clean, bstr(&b));
|
||||
if(doclean)
|
||||
vadd(&clean, bstr(&b));
|
||||
}
|
||||
bgwait();
|
||||
|
||||
@ -1144,7 +1147,7 @@ cmdenv(int argc, char **argv)
|
||||
binit(&b);
|
||||
binit(&b1);
|
||||
|
||||
format = "%s=\"%s\"";
|
||||
format = "%s=\"%s\"\n";
|
||||
pflag = 0;
|
||||
ARGBEGIN{
|
||||
case 'p':
|
||||
|
8
src/cmd/dist/unix.c
vendored
8
src/cmd/dist/unix.c
vendored
@ -475,6 +475,8 @@ fatal(char *msg, ...)
|
||||
vfprintf(stderr, msg, arg);
|
||||
va_end(arg);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
bgwait();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -624,16 +626,10 @@ xsetenv(char *name, char *value)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
char *p;
|
||||
Buf b;
|
||||
struct utsname u;
|
||||
|
||||
binit(&b);
|
||||
p = argv[0];
|
||||
if(hassuffix(p, "bin/tool/dist")) {
|
||||
default_goroot = xstrdup(p);
|
||||
default_goroot[strlen(p)-strlen("bin/tool/dist")] = '\0';
|
||||
}
|
||||
|
||||
slash = "/";
|
||||
|
||||
|
6
src/cmd/dist/windows.c
vendored
6
src/cmd/dist/windows.c
vendored
@ -688,6 +688,8 @@ fatal(char *msg, ...)
|
||||
va_end(arg);
|
||||
|
||||
xprintf("go tool dist: %s\n", buf1);
|
||||
|
||||
bgwait();
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
@ -800,7 +802,7 @@ xstrlen(char *p)
|
||||
void
|
||||
xexit(int n)
|
||||
{
|
||||
exit(n);
|
||||
ExitProcess(n);
|
||||
}
|
||||
|
||||
void
|
||||
@ -831,8 +833,6 @@ main(int argc, char **argv)
|
||||
setvbuf(stdout, nil, _IOLBF, 0);
|
||||
setvbuf(stderr, nil, _IOLBF, 0);
|
||||
|
||||
default_goroot = DEFAULT_GOROOT;
|
||||
|
||||
slash = "\\";
|
||||
gohostos = "windows";
|
||||
|
||||
|
@ -47,7 +47,8 @@ done
|
||||
|
||||
echo '# Building C bootstrap tool.'
|
||||
mkdir -p ../bin/tool
|
||||
gcc -O2 -Wall -Werror -o ../bin/tool/dist -Icmd/dist cmd/dist/*.c
|
||||
DEFGOROOT='-DDEFAULT_GOROOT="'"$(cd .. && pwd)"'"'
|
||||
gcc -O2 -Wall -Werror -o ../bin/tool/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c
|
||||
echo
|
||||
|
||||
echo '# Building compilers and Go bootstrap tool.'
|
||||
|
Loading…
Reference in New Issue
Block a user