To make it easier to use gotools go and gofmt, add -static-libgo when linking them. This makes it nicer in all cases since it eliminates the dependency on libgo.so for these tools, but it is mostly helpful for the cross compiled case. When building for use in the cross compiled case, this allows for go and gofmt to be built with a gccgo that is available during the build but then libgo.so is not a dependency when using go
or gofmt once the build is finished.

The cgo tool is also built here but since that is needed during compiling with gccgo I left that as is.

2015-10-16    Lynn Boger <labo...@linux.vnet.ibm.com>

gotools/
                    Makefile.am:  Add -static-libgo to the link for
                    go and gofmt tools.
                    Makefile.in:  Regenerate.


Index: gotools/Makefile.am
===================================================================
--- gotools/Makefile.am	(revision 228851)
+++ gotools/Makefile.am	(working copy)
@@ -109,10 +109,12 @@ bin_PROGRAMS = go$(EXEEXT) gofmt$(EXEEXT)
 noinst_PROGRAMS = cgo$(EXEEXT)
 man_MANS = go.1 gofmt.1
 
+# Add -static-libgo to the link for go and gofmt to avoid the libgo.so  
+# dependency.
 go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP)
-	$(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
+	$(GOLINK) -static-libgo $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
 gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP)
-	$(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS)
+	$(GOLINK) -static-libgo $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS)
 cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP)
 	$(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
 
Index: gotools/Makefile.in
===================================================================
--- gotools/Makefile.in	(revision 228851)
+++ gotools/Makefile.in	(working copy)
@@ -663,10 +663,12 @@ s-zdefaultcc: Makefile
 	$(SHELL) $(srcdir)/../move-if-change zdefaultcc.go.tmp zdefaultcc.go
 	$(STAMP) $@ 
 
+# Add -static-libgo to the link for go and gofmt to avoid the libgo.so  
+# dependency.
 @NATIVE_TRUE@go$(EXEEXT): $(go_cmd_go_files) zdefaultcc.go $(LIBGODEP)
-@NATIVE_TRUE@	$(GOLINK) $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
+@NATIVE_TRUE@	$(GOLINK) -static-libgo $(go_cmd_go_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
 @NATIVE_TRUE@gofmt$(EXEEXT): $(go_cmd_gofmt_files) $(LIBGODEP)
-@NATIVE_TRUE@	$(GOLINK) $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS)
+@NATIVE_TRUE@	$(GOLINK) -static-libgo $(go_cmd_gofmt_files) $(LIBS) $(NET_LIBS)
 @NATIVE_TRUE@cgo$(EXEEXT): $(go_cmd_cgo_files) zdefaultcc.go $(LIBGODEP)
 @NATIVE_TRUE@	$(GOLINK) $(go_cmd_cgo_files) zdefaultcc.go $(LIBS) $(NET_LIBS)
 

Reply via email to