[dev.cc] cmd/dist, lib9: make GOHOSTARCH, GOHOSTOS available to C programs

Needed for invoking a Go subprocess in the C code.
The Go tools live in $GOROOT/pkg/tool/$GOHOSTARCH_$GOHOSTOS.

Change-Id: I961b6b8a07de912de174b758b2fb87d77080546d
Reviewed-on: https://go-review.googlesource.com/3042
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Russ Cox 2015-01-19 11:33:46 -05:00
parent 3b2de80309
commit c4dd7fac89
3 changed files with 17 additions and 1 deletions

View File

@ -292,6 +292,8 @@ extern char* getgoversion(void);
extern char* getgoarm(void);
extern char* getgo386(void);
extern char* getgoextlinkenabled(void);
extern char* getgohostos(void);
extern char* getgohostarch(void);
extern char* mktempdir(void);
extern void removeall(char*);

View File

@ -929,6 +929,8 @@ func install(dir string) {
compile = append(compile,
"-D", fmt.Sprintf("GOOS=%q", goos),
"-D", fmt.Sprintf("GOARCH=%q", goarch),
"-D", fmt.Sprintf("GOHOSTOS=%q", gohostos),
"-D", fmt.Sprintf("GOHOSTARCH=%q", gohostarch),
"-D", fmt.Sprintf("GOROOT=%q", goroot_final),
"-D", fmt.Sprintf("GOVERSION=%q", goversion),
"-D", fmt.Sprintf("GOARM=%q", goarm),

View File

@ -52,8 +52,20 @@ getgo386(void)
return defgetenv("GO386", GO386);
}
char *
char*
getgoextlinkenabled(void)
{
return GO_EXTLINK_ENABLED;
}
char*
getgohostarch(void)
{
return GOHOSTARCH;
}
char*
getgohostos(void)
{
return GOHOSTOS;
}