Merge pull request #6373 from jefferyto/golang-compile-arguments-openwrt-18.06

[openwrt-18.06] golang: Makefile improvements
This commit is contained in:
Hannu Nyman 2018-06-29 18:11:13 +03:00 committed by GitHub
commit 38a224d3fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 23 deletions

View file

@ -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 \

View file

@ -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))