Hi,

Previous thread: 
https://lists.openwrt.org/pipermail/openwrt-devel/2014-January/023210.html

I have made some changes to add the gccgo frontend to the crosscompiler and o 
add libgo to the target image. The source for both is in gcc 4.7.x+ so the 
patch only changes makefiles and menuconfig files to add both as option.
I hope this patch will make it upstream. If there are any changes required 
please let me know.

I've attached the patch because alpine wraps the lines and I haven't figuredout 
how to fix that yet. Sorry.

Signed-off-by: Geert-Johan Riemer <geertjo...@geertjohan.net>

Best regards,
Geert-Johan Riemer

Attachment: signature.asc
Description: PGP signature

diff --git a/package/libs/toolchain/Makefile b/package/libs/toolchain/Makefile
index 202e9d0..74a4e2c 100644
--- a/package/libs/toolchain/Makefile
+++ b/package/libs/toolchain/Makefile
@@ -228,6 +228,35 @@ define Package/libgfortran/config
 	endmenu
 endef
 
+
+define Package/libgo
+$(call Package/gcc/Default)
+  TITLE:=Go support library
+  DEPENDS+=@INSTALL_GCCGO
+  DEPENDS+=@USE_EGLIBC
+endef
+
+define Package/libgo/config
+       menu "Configuration"
+               depends EXTERNAL_TOOLCHAIN && PACKAGE_libgo
+
+       config LIBGO_ROOT_DIR
+               string
+               prompt "libgo shared library base directory"
+               depends EXTERNAL_TOOLCHAIN && PACKAGE_libgo
+               default TOOLCHAIN_ROOT  if !NATIVE_TOOLCHAIN
+               default "/"  if NATIVE_TOOLCHAIN
+
+       config LIBGO_FILE_SPEC
+               string
+               prompt "libgo shared library files (use wildcards)"
+               depends EXTERNAL_TOOLCHAIN && PACKAGE_libgo
+               default "./usr/lib/libgo.so.*"
+
+       endmenu
+endef
+
+
 define Package/ldd
 $(call Package/libc/Default)
   DEPENDS:=@!USE_MUSL
@@ -372,11 +401,24 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
 	$(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgfortran.so.* $(1)/usr/lib/)
   endef
 
+  define Package/libgo/install
+    $(INSTALL_DIR) $(1)/usr/lib
+    $(if $(CONFIG_TARGET_avr32)$(CONFIG_TARGET_coldfire),,$(CP) $(TOOLCHAIN_DIR)/lib/libgo.so.* $(1)/usr/lib/)
+  endef
+
   define Package/libssp/install
 	$(INSTALL_DIR) $(1)/lib
 	$(CP) $(TOOLCHAIN_DIR)/lib/libssp.so.* $(1)/lib/
   endef
 
+  define Package/libgo/install
+    for file in $(call qstrip,$(CONFIG_LIBGO_FILE_SPEC)); do \
+        dir=`dirname $$$$file` ; \
+        $(INSTALL_DIR) $(1)/$$$$dir ; \
+        $(CP) $(call qstrip,$(CONFIG_LIBGO_ROOT_DIR))/$$$$file $(1)/$$$$dir/ ; \
+    done
+  endef
+
   define Package/libstdcpp/install
 	$(INSTALL_DIR) $(1)/usr/lib
 	$(CP) $(TOOLCHAIN_DIR)/lib/libstdc++.so.* $(1)/usr/lib/
@@ -591,5 +633,6 @@ $(eval $(call BuildPackage,libpthread))
 $(eval $(call BuildPackage,libthread-db))
 $(eval $(call BuildPackage,librt))
 $(eval $(call BuildPackage,libgfortran))
+$(eval $(call BuildPackage,libgo))
 $(eval $(call BuildPackage,ldd))
 $(eval $(call BuildPackage,ldconfig))
diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
index 737164a..bf63018 100644
--- a/toolchain/gcc/Config.in
+++ b/toolchain/gcc/Config.in
@@ -73,3 +73,10 @@ config INSTALL_GFORTRAN
 	default n
 	help
 	    Build/install GNU fortran compiler ?
+
+config INSTALL_GCCGO
+	bool
+	prompt "Build/install gccgo compiler?" if TOOLCHAINOPTS && !(GCC_VERSION_4_6 || GCC_VERSION_4_6_LINARO)
+	default n
+	help
+	    Build/install GNU gccgo compiler ?
\ No newline at end of file
diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index ec324ea..7f3b369 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -86,7 +86,7 @@ HOST_STAMP_CONFIGURED:=$(GCC_BUILD_DIR)/.configured
 HOST_STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.gcc_$(GCC_VARIANT)_installed
 
 SEP:=,
-TARGET_LANGUAGES:="c,c++$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)$(if $(CONFIG_INSTALL_GFORTRAN),$(SEP)fortran)"
+TARGET_LANGUAGES:="c,c++$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)$(if $(CONFIG_INSTALL_GFORTRAN),$(SEP)fortran)$(if $(CONFIG_INSTALL_GCCGO),$(SEP)go)"
 
 export libgcc_cv_fixed_point=no
 ifdef CONFIG_USE_UCLIBC

Attachment: add-gccgo-and-libgo.patch.sig
Description: PGP signature

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to