From abf28899a0484216e070476c1eb016525c6d6d7d Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 20 May 2022 04:38:41 -0400 Subject: [PATCH 1/3] golang: split compile recipe into configure and compile the default Configure recipe for packages assumes that there is a "configure" script in the source tree directory Go does not have such a script, configure and compile is done with the same script so split the current Compile recipe into both Configure and Compile recipes Signed-off-by: Michael Pratt --- lang/golang/golang/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index 30457910a..c13025cfe 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -207,12 +207,14 @@ HOST_GO_VARS= \ CC="$(HOSTCC_NOCACHE)" \ CXX="$(HOSTCXX_NOCACHE)" -define Host/Compile +define Host/Configure $(call GoCompiler/Bootstrap/CheckHost,$(BOOTSTRAP_GO_VALID_OS_ARCH)) $(call GoCompiler/Host/CheckHost,$(HOST_GO_VALID_OS_ARCH)) mkdir -p "$(GO_BUILD_CACHE_DIR)" +endef +define Host/Compile $(call GoCompiler/Bootstrap/Make, \ $(HOST_GO_VARS) \ ) @@ -300,9 +302,11 @@ PKG_GO_INSTALL_ARGS= \ $(if $(PKG_GO_ASMFLAGS),-asmflags "all=$(PKG_GO_ASMFLAGS)") \ $(if $(filter $(GO_PKG_ENABLE_PIE),1),-buildmode pie) -define Build/Compile +define Build/Configure mkdir -p "$(GO_BUILD_CACHE_DIR)" +endef +define Build/Compile @echo "Building target Go first stage" $(call GoCompiler/Package/Make, \ From b99164aff453fbb084b6ab94b78805a4ca6b2e3d Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 20 May 2022 05:09:40 -0400 Subject: [PATCH 2/3] golang: enable verbose output allow the building script of Go to output verbose when make is executed with "V=s..." Signed-off-by: Michael Pratt --- lang/golang/golang-compiler.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lang/golang/golang-compiler.mk b/lang/golang/golang-compiler.mk index c6c836017..8f9c9a380 100644 --- a/lang/golang/golang-compiler.mk +++ b/lang/golang/golang-compiler.mk @@ -27,7 +27,10 @@ define GoCompiler/Default/Make cd "$(1)/src" ; \ $(if $(2),GOROOT_FINAL="$(2)/lib/go-$(3)") \ $(4) \ - $(BASH) make.bash --no-banner ; \ + $(BASH) make.bash \ + $(if $(findstring s,$(OPENWRT_VERBOSE)),-v) \ + --no-banner \ + ; \ ) endef From bb7c596028807bca6d9bc4c87e110560f2491a41 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 27 May 2022 02:25:52 -0400 Subject: [PATCH 3/3] golang: do not rely on Go script host detection for some use cases, for example: a system with 64 bit kernel and 32 bit userspace programs the local Go installation is "detected" using the kernel "uname", causing build failure if they happen to differ by adding the argument GOHOSTARCH using the corresponding make variable it would be fully controlled in the openwrt git tree based on the HOST_ARCH make variable. Signed-off-by: Michael Pratt --- lang/golang/golang/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index c13025cfe..ad75dd165 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -202,6 +202,7 @@ endif $(eval $(call GoCompiler/AddProfile,Host,$(HOST_BUILD_DIR),$(HOST_GO_PREFIX),$(HOST_GO_VERSION_ID),$(GO_HOST_OS_ARCH),$(HOST_GO_INSTALL_SUFFIX))) HOST_GO_VARS= \ + GOHOSTARCH="$(GO_HOST_ARCH)" \ GOCACHE="$(GO_BUILD_CACHE_DIR)" \ GOENV=off \ CC="$(HOSTCC_NOCACHE)" \ @@ -273,6 +274,7 @@ PKG_GO_ZBOOTSTRAP_MODS:= \ PKG_GO_ZBOOTSTRAP_PATH:=$(PKG_BUILD_DIR)/src/internal/buildcfg/zbootstrap.go PKG_GO_VARS= \ + GOHOSTARCH="$(GO_HOST_ARCH)" \ GOCACHE="$(GO_BUILD_CACHE_DIR)" \ GOENV=off \ GO_GCC_HELPER_PATH="$$$$PATH" \