]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.cc] cmd/dist, lib9: make GOHOSTARCH, GOHOSTOS available to C programs
authorRuss Cox <rsc@golang.org>
Mon, 19 Jan 2015 16:33:46 +0000 (11:33 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 21 Jan 2015 00:44:50 +0000 (00:44 +0000)
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>
include/libc.h
src/cmd/dist/build.go
src/lib9/goos.c

index e4d879907720ad3a874ff6c38eef77346069399d..d82a19ccce8f3b78f8fdb92e7f681484fffb5f81 100644 (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*);
index 9e4d1e3c22aef85b803a5baeb0deb6451369ebaa..366612cdd1ee439b365b0141105862ed39089a90 100644 (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),
index 2d4a800dd1930f028aa75232c4b3aa637b7c2b2a..68b94d6114ed3eccd5c639b3cf0da65b1320e075 100644 (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;
+}