From 665f3d2bbc9b97b752f447133ced5fa86cabd022 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 27 Jun 2018 03:05:11 +0800 Subject: [PATCH 1/2] golang: Allow additional arguments when compiling Go packages This updates GoPackage/Build/Compile in golang-package.mk to accept additional arguments that are passed to the go command line. Signed-off-by: Jeffery To --- lang/golang/golang-package.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lang/golang/golang-package.mk b/lang/golang/golang-package.mk index a42bc6417..3c4aeab14 100644 --- a/lang/golang/golang-package.mk +++ b/lang/golang/golang-package.mk @@ -211,6 +211,7 @@ define GoPackage/Build/Configure ) endef +# $(1) additional arguments for go command line (optional) define GoPackage/Build/Compile ( \ cd $(GO_PKG_BUILD_DIR) ; \ @@ -228,7 +229,7 @@ define GoPackage/Build/Compile done ; \ \ if [ "$(GO_PKG_GO_GENERATE)" = 1 ]; then \ - go generate -v $$$$targets ; \ + go generate -v $(1) $$$$targets ; \ fi ; \ \ if [ "$(GO_PKG_SOURCE_ONLY)" != 1 ]; then \ @@ -238,7 +239,14 @@ define GoPackage/Build/Compile esac ; \ trimpath="all=-trimpath=$(GO_PKG_BUILD_DIR)" ; \ ldflags="all=-linkmode external -extldflags '$(TARGET_LDFLAGS)'" ; \ - go install $$$$installsuffix -gcflags "$$$$trimpath" -asmflags "$$$$trimpath" -ldflags "$$$$ldflags" -v $$$$targets ; \ + go install \ + $$$$installsuffix \ + -gcflags "$$$$trimpath" \ + -asmflags "$$$$trimpath" \ + -ldflags "$$$$ldflags" \ + -v \ + $(1) \ + $$$$targets ; \ retval=$$$$? ; \ \ if [ "$$$$retval" -eq 0 ] && [ -z "$(call GoPackage/has_binaries)" ]; then \ From 5d289ccd6a0c868def203088996255a85a0d290d Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 29 Jun 2018 14:57:50 +0800 Subject: [PATCH 2/2] golang: Download bootstrap source directly, use golang-specific mirrors These changes are a result of this conversation: https://github.com/openwrt/packages/commit/19292650241de44b4f12fb02f0e11127f069d2b4#r29531922 Signed-off-by: Jeffery To --- lang/golang/golang/Makefile | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index 7bbce4fc5..898b1db9a 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -10,15 +10,14 @@ include ../golang-version.mk PKG_NAME:=golang PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH)) -PKG_RELEASE:=1 +PKG_RELEASE:=2 + +GO_SOURCE_URLS:=https://dl.google.com/go/ \ + https://mirrors.ustc.edu.cn/golang/ \ + https://mirrors.nju.edu.cn/golang/ PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz -PKG_SOURCE_URL:=https://golang.org/dl/ \ - https://dl.google.com/go/ \ - https://fossies.org/linux/misc/ \ - http://distfiles.gentoo.org/distfiles/ \ - https://ftp.netbsd.org/pub/pkgsrc/distfiles/ \ - https://distfiles.macports.org/go/ +PKG_SOURCE_URL:=$(GO_SOURCE_URLS) PKG_HASH:=567b1cc66c9704d1c019c50bef946272e911ec6baf244310f87f4e678be155f2 PKG_LICENSE:=BSD-3-Clause @@ -56,15 +55,9 @@ HOST_GO_VALID_OS_ARCH:= \ \ linux_ppc64 linux_ppc64le linux_mips linux_mipsle linux_mips64 linux_mips64le -BOOTSTRAP_SOURCE_PROTO:=git -BOOTSTRAP_SOURCE_URL:=https://github.com/golang/go.git -BOOTSTRAP_SOURCE_VERSION:=4d5426a570c2820c5894a61b52e3dc147e4e7925 -BOOTSTRAP_SOURCE_DATE:=20170926 -BOOTSTRAP_MIRROR_HASH:=a3e26ee7c96486c841d29cbea3bf548ce2d999b9235275091cbe60ae6efa4cb1 - -BOOTSTRAP_VERSION:=$(BOOTSTRAP_SOURCE_DATE)-$(call version_abbrev,$(BOOTSTRAP_SOURCE_VERSION)) -BOOTSTRAP_SOURCE_SUBDIR:=golang-bootstrap-$(BOOTSTRAP_VERSION) -BOOTSTRAP_SOURCE:=$(BOOTSTRAP_SOURCE_SUBDIR).tar.xz +BOOTSTRAP_SOURCE:=go1.4-bootstrap-20171003.tar.gz +BOOTSTRAP_SOURCE_URL:=$(GO_SOURCE_URLS) +BOOTSTRAP_HASH:=f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52 BOOTSTRAP_BUILD_DIR:=$(HOST_BUILD_DIR)/.go_bootstrap @@ -86,7 +79,7 @@ include ../golang-package.mk PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) HOST_UNPACK:=$(HOST_TAR) -C $(HOST_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) -BOOTSTRAP_UNPACK:=$(HOST_TAR) -C $(BOOTSTRAP_BUILD_DIR) --strip-components=1 -xJf $(DL_DIR)/$(BOOTSTRAP_SOURCE) +BOOTSTRAP_UNPACK:=$(HOST_TAR) -C $(BOOTSTRAP_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(BOOTSTRAP_SOURCE) # don't strip ELF executables in test data (and go itself) RSTRIP:=: @@ -153,10 +146,7 @@ endef define Download/golang-bootstrap FILE:=$(BOOTSTRAP_SOURCE) URL:=$(BOOTSTRAP_SOURCE_URL) - SUBDIR:=$(BOOTSTRAP_SOURCE_SUBDIR) - PROTO:=$(BOOTSTRAP_SOURCE_PROTO) - MIRROR_HASH:=$(BOOTSTRAP_MIRROR_HASH) - VERSION:=$(BOOTSTRAP_SOURCE_VERSION) + HASH:=$(BOOTSTRAP_HASH) endef $(eval $(call Download,golang-bootstrap))