diff --git a/lang/golang/golang-package.mk b/lang/golang/golang-package.mk index 2e4679b34..303ae0eb3 100644 --- a/lang/golang/golang-package.mk +++ b/lang/golang/golang-package.mk @@ -165,7 +165,7 @@ define GoPackage/GoSubMenu CATEGORY:=Languages endef -define GoPackage/Environment/Default +define GoPackage/Environment/Target GOOS=$(GO_OS) \ GOARCH=$(GO_ARCH) \ GO386=$(GO_386) \ @@ -173,9 +173,23 @@ define GoPackage/Environment/Default GOMIPS=$(GO_MIPS) \ GOMIPS64=$(GO_MIPS64) \ CGO_ENABLED=1 \ + CC=$(TARGET_CC) \ + CXX=$(TARGET_CXX) \ CGO_CFLAGS="$(filter-out $(GO_CFLAGS_TO_REMOVE),$(TARGET_CFLAGS))" \ CGO_CPPFLAGS="$(TARGET_CPPFLAGS)" \ - CGO_CXXFLAGS="$(filter-out $(GO_CFLAGS_TO_REMOVE),$(TARGET_CXXFLAGS))" + CGO_CXXFLAGS="$(filter-out $(GO_CFLAGS_TO_REMOVE),$(TARGET_CXXFLAGS))" \ + CGO_LDFLAGS="$(TARGET_LDFLAGS)" +endef + +define GoPackage/Environment/Build + GOPATH=$(GO_PKG_BUILD_DIR) \ + GOCACHE=$(GO_PKG_CACHE_DIR) \ + GOENV=off +endef + +define GoPackage/Environment/Default + $(call GoPackage/Environment/Target) \ + $(call GoPackage/Environment/Build) endef GoPackage/Environment=$(call GoPackage/Environment/Default) @@ -264,13 +278,7 @@ endef define GoPackage/Build/Compile ( \ cd $(GO_PKG_BUILD_DIR) ; \ - export GOPATH=$(GO_PKG_BUILD_DIR) \ - GOCACHE=$(GO_PKG_CACHE_DIR) \ - GOENV=off \ - GOROOT_FINAL=$(GO_TARGET_ROOT) \ - CC=$(TARGET_CC) \ - CXX=$(TARGET_CXX) \ - $(call GoPackage/Environment) ; \ + export $(call GoPackage/Environment) ; \ \ echo "Finding targets" ; \ targets=$$$$(go list $(GO_PKG_BUILD_PKG)) ; \ diff --git a/lang/golang/golang-values.mk b/lang/golang/golang-values.mk index aa13a8791..0b0c0c18d 100644 --- a/lang/golang/golang-values.mk +++ b/lang/golang/golang-values.mk @@ -9,8 +9,6 @@ ifeq ($(origin GO_INCLUDE_DIR),undefined) GO_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST))) endif -include $(GO_INCLUDE_DIR)/golang-version.mk - # Unset environment variables # There are more magic variables to track down, but ain't nobody got time for that @@ -209,10 +207,6 @@ endif GO_ARCH_DEPENDS:=@(aarch64||arm||i386||i686||mips||mips64||mips64el||mipsel||powerpc64||x86_64) -GO_TARGET_PREFIX:=/usr -GO_TARGET_VERSION_ID:=$(GO_VERSION_MAJOR_MINOR) -GO_TARGET_ROOT:=$(GO_TARGET_PREFIX)/lib/go-$(GO_TARGET_VERSION_ID) - # ASLR/PIE diff --git a/lang/golang/golang-version.mk b/lang/golang/golang-version.mk deleted file mode 100644 index cc430d707..000000000 --- a/lang/golang/golang-version.mk +++ /dev/null @@ -1,14 +0,0 @@ -# -# Copyright (C) 2018 Jeffery To -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -ifeq ($(origin GO_INCLUDE_DIR),undefined) - GO_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST))) -endif - - -GO_VERSION_MAJOR_MINOR:=1.13 -GO_VERSION_PATCH:=7 diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index 1fe8790df..ca4d76fa7 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -6,7 +6,9 @@ # include $(TOPDIR)/rules.mk -include ../golang-version.mk + +GO_VERSION_MAJOR_MINOR:=1.13 +GO_VERSION_PATCH:=7 PKG_NAME:=golang PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH)) @@ -34,6 +36,10 @@ PKG_GO_WORK_DIR:=$(PKG_BUILD_DIR)/.go_work PKG_GO_HOST_CACHE_DIR:=$(PKG_GO_WORK_DIR)/host_cache PKG_GO_TARGET_CACHE_DIR:=$(PKG_GO_WORK_DIR)/target_cache +PKG_GO_PREFIX:=/usr +PKG_GO_VERSION_ID:=$(GO_VERSION_MAJOR_MINOR) +PKG_GO_ROOT:=$(PKG_GO_PREFIX)/lib/go-$(PKG_GO_VERSION_ID) + HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/go-$(PKG_VERSION) HOST_BUILD_PARALLEL:=1 @@ -178,7 +184,7 @@ $(eval $(call Download,golang-bootstrap)) $(eval $(call GoCompiler/AddProfile,Bootstrap,$(BOOTSTRAP_BUILD_DIR),,bootstrap,$(GO_HOST_OS_ARCH))) $(eval $(call GoCompiler/AddProfile,Host,$(HOST_BUILD_DIR),$(HOST_GO_PREFIX),$(HOST_GO_VERSION_ID),$(GO_HOST_OS_ARCH),$(HOST_GO_INSTALL_SUFFIX))) -$(eval $(call GoCompiler/AddProfile,Package,$(PKG_BUILD_DIR),$(GO_TARGET_PREFIX),$(GO_TARGET_VERSION_ID),$(GO_OS_ARCH),$(PKG_GO_INSTALL_SUFFIX))) +$(eval $(call GoCompiler/AddProfile,Package,$(PKG_BUILD_DIR),$(PKG_GO_PREFIX),$(PKG_GO_VERSION_ID),$(GO_OS_ARCH),$(PKG_GO_INSTALL_SUFFIX))) define Host/Prepare $(call Host/Prepare/Default) @@ -278,8 +284,9 @@ define Build/Compile ( \ cd $(PKG_BUILD_DIR)/bin ; \ + export $(call GoPackage/Environment/Target) ; \ $(CP) go go-host ; \ - GOROOT_FINAL=$(GO_TARGET_ROOT) \ + GOROOT_FINAL=$(PKG_GO_ROOT) \ GOCACHE=$(PKG_GO_TARGET_CACHE_DIR) \ GOENV=off \ GO_GCC_HELPER_CC="$(TARGET_CC)" \ @@ -289,7 +296,6 @@ define Build/Compile CXX=g++ \ PKG_CONFIG=pkg-config \ PATH=$(HOST_GO_ROOT)/openwrt:$$$$PATH \ - $(call GoPackage/Environment) \ ./go-host install -a $(if $(PKG_GO_ENABLE_PIE),-buildmode=pie) std cmd ; \ retval=$$$$? ; \ rm -f go-host ; \ @@ -298,16 +304,16 @@ define Build/Compile endef define Package/golang/install - $(call GoCompiler/Package/Install/Bin,$(1)$(GO_TARGET_PREFIX)) - $(call GoCompiler/Package/Install/BinLinks,$(1)$(GO_TARGET_PREFIX)) + $(call GoCompiler/Package/Install/Bin,$(1)$(PKG_GO_PREFIX)) + $(call GoCompiler/Package/Install/BinLinks,$(1)$(PKG_GO_PREFIX)) endef define Package/golang-doc/install - $(call GoCompiler/Package/Install/Doc,$(1)$(GO_TARGET_PREFIX)) + $(call GoCompiler/Package/Install/Doc,$(1)$(PKG_GO_PREFIX)) endef define Package/golang-src/install - $(call GoCompiler/Package/Install/Src,$(1)$(GO_TARGET_PREFIX)) + $(call GoCompiler/Package/Install/Src,$(1)$(PKG_GO_PREFIX)) endef # src/debug contains ELF executables as test data diff --git a/utils/containerd/Makefile b/utils/containerd/Makefile index b8cc09b8e..fe2b5f810 100644 --- a/utils/containerd/Makefile +++ b/utils/containerd/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=containerd PKG_VERSION:=1.2.10 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE @@ -49,14 +49,7 @@ endef GO_PKG_INSTALL_ALL:=1 MAKE_PATH:=$(GO_PKG_WORK_DIR_NAME)/build/src/$(GO_PKG) -MAKE_VARS += \ - GOPATH=$(GO_PKG_BUILD_DIR) \ - GOCACHE=$(GO_PKG_CACHE_DIR) \ - GOTMPDIR=$(GO_PKG_TMP_DIR) \ - GOROOT_FINAL=$(GO_TARGET_ROOT) \ - CC=$(TARGET_CC) \ - CXX=$(TARGET_CXX) \ - $(call GoPackage/Environment) +MAKE_VARS += $(call GoPackage/Environment) MAKE_FLAGS += \ DESTDIR="$(PKG_INSTALL_DIR)" \ VERSION=$(PKG_VERSION) \ diff --git a/utils/docker-ce/Makefile b/utils/docker-ce/Makefile index 4464cba59..6d4acc2a6 100644 --- a/utils/docker-ce/Makefile +++ b/utils/docker-ce/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=docker-ce PKG_VERSION:=19.03.5 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=components/cli/LICENSE components/engine/LICENSE @@ -78,13 +78,7 @@ endif define Build/Compile ( \ - export GOPATH=$(GO_PKG_BUILD_DIR) \ - GOCACHE=$(GO_PKG_CACHE_DIR) \ - GOTMPDIR=$(GO_PKG_TMP_DIR) \ - GOROOT_FINAL=$(GO_TARGET_ROOT) \ - CC=$(TARGET_CC) \ - CXX=$(TARGET_CXX) \ - $(call GoPackage/Environment) \ + export $(call GoPackage/Environment) \ GITCOMMIT=$(PKG_SOURCE_VERSION) \ DOCKER_GITCOMMIT=$(PKG_SOURCE_VERSION) \ DOCKER_BUILDTAGS='$(BUILDTAGS)' \ diff --git a/utils/runc/Makefile b/utils/runc/Makefile index 43fb53355..e4c2756d7 100644 --- a/utils/runc/Makefile +++ b/utils/runc/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=runc PKG_VERSION:=1.0.0-rc8+91-3e425f80 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE @@ -51,14 +51,7 @@ endef GO_PKG_INSTALL_ALL:=1 MAKE_PATH:=$(GO_PKG_WORK_DIR_NAME)/build/src/$(GO_PKG) -MAKE_VARS += \ - GOPATH=$(GO_PKG_BUILD_DIR) \ - GOCACHE=$(GO_PKG_CACHE_DIR) \ - GOTMPDIR=$(GO_PKG_TMP_DIR) \ - GOROOT_FINAL=$(GO_TARGET_ROOT) \ - CC=$(TARGET_CC) \ - CXX=$(TARGET_CXX) \ - $(call GoPackage/Environment) +MAKE_VARS += $(call GoPackage/Environment) MAKE_FLAGS += \ COMMIT=$(PKG_SOURCE_VERSION)