Skip to content

Instantly share code, notes, and snippets.

@conoro
Created November 15, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conoro/887362ebdbbada2cfbc6 to your computer and use it in GitHub Desktop.
Save conoro/887362ebdbbada2cfbc6 to your computer and use it in GitHub Desktop.
Diff to add Go 1.1.2 support to OpenWRT (as of 15/11/2015)
diff -ur orig/package/libs/toolchain/Makefile new/package/libs/toolchain/Makefile
--- orig/package/libs/toolchain/Makefile 2015-11-10 08:09:30.086903500 +0000
+++ new/package/libs/toolchain/Makefile 2015-11-15 14:02:44.125873000 +0000
@@ -254,6 +254,33 @@
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
@@ -410,11 +437,24 @@
$(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/
@@ -642,5 +682,6 @@
$(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 -ur orig/toolchain/gcc/Config.in new/toolchain/gcc/Config.in
--- orig/toolchain/gcc/Config.in 2015-11-10 08:10:42.251585900 +0000
+++ new/toolchain/gcc/Config.in 2015-11-15 14:02:44.121873000 +0000
@@ -69,3 +69,10 @@
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 -ur orig/toolchain/gcc/common.mk new/toolchain/gcc/common.mk
--- orig/toolchain/gcc/common.mk 2015-11-10 08:10:42.254522700 +0000
+++ new/toolchain/gcc/common.mk 2015-11-15 14:02:44.129873000 +0000
@@ -88,7 +88,7 @@
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment