mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
golang: Refactor vars common to each host compile stage into variable
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
+13
-10
@@ -187,11 +187,20 @@ endif
|
|||||||
|
|
||||||
ifeq ($(GO_HOST_PIE_SUPPORTED),1)
|
ifeq ($(GO_HOST_PIE_SUPPORTED),1)
|
||||||
HOST_GO_ENABLE_PIE:=1
|
HOST_GO_ENABLE_PIE:=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HOST_GO_ENABLE_PIE),1)
|
||||||
HOST_GO_INSTALL_SUFFIX:=$(GO_HOST_PIE_INSTALL_SUFFIX)
|
HOST_GO_INSTALL_SUFFIX:=$(GO_HOST_PIE_INSTALL_SUFFIX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(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,Host,$(HOST_BUILD_DIR),$(HOST_GO_PREFIX),$(HOST_GO_VERSION_ID),$(GO_HOST_OS_ARCH),$(HOST_GO_INSTALL_SUFFIX)))
|
||||||
|
|
||||||
|
HOST_GO_VARS= \
|
||||||
|
GOCACHE=$(GO_BUILD_CACHE_DIR) \
|
||||||
|
GOENV=off \
|
||||||
|
CC=$(HOSTCC_NOCACHE) \
|
||||||
|
CXX=$(HOSTCXX_NOCACHE)
|
||||||
|
|
||||||
# when https://github.com/golang/go/issues/31544 is fixed,
|
# when https://github.com/golang/go/issues/31544 is fixed,
|
||||||
# we should be able to set GO_LDFLAGS=-buildmode=pie for host make
|
# we should be able to set GO_LDFLAGS=-buildmode=pie for host make
|
||||||
# instead of doing a rebuild for pie
|
# instead of doing a rebuild for pie
|
||||||
@@ -202,15 +211,12 @@ define Host/Compile
|
|||||||
mkdir -p $(GO_BUILD_CACHE_DIR)
|
mkdir -p $(GO_BUILD_CACHE_DIR)
|
||||||
|
|
||||||
$(call GoCompiler/Bootstrap/Make, \
|
$(call GoCompiler/Bootstrap/Make, \
|
||||||
CC=$(HOSTCC_NOCACHE) \
|
$(HOST_GO_VARS) \
|
||||||
CXX=$(HOSTCXX_NOCACHE) \
|
|
||||||
)
|
)
|
||||||
|
|
||||||
$(call GoCompiler/Host/Make, \
|
$(call GoCompiler/Host/Make, \
|
||||||
GOROOT_BOOTSTRAP=$(BOOTSTRAP_ROOT_DIR) \
|
GOROOT_BOOTSTRAP=$(BOOTSTRAP_ROOT_DIR) \
|
||||||
GOCACHE=$(GO_BUILD_CACHE_DIR) \
|
$(HOST_GO_VARS) \
|
||||||
CC=$(HOSTCC_NOCACHE) \
|
|
||||||
CXX=$(HOSTCXX_NOCACHE) \
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ifneq ($(HOST_GO_ENABLE_PIE),)
|
ifneq ($(HOST_GO_ENABLE_PIE),)
|
||||||
@@ -219,11 +225,8 @@ define Host/Compile
|
|||||||
( \
|
( \
|
||||||
cd $(HOST_BUILD_DIR)/bin ; \
|
cd $(HOST_BUILD_DIR)/bin ; \
|
||||||
$(CP) go go-nopie ; \
|
$(CP) go go-nopie ; \
|
||||||
GOCACHE=$(GO_BUILD_CACHE_DIR) \
|
$(HOST_GO_VARS) \
|
||||||
GOENV=off \
|
./go-nopie install -a -buildmode pie std cmd ; \
|
||||||
CC=$(HOSTCC_NOCACHE) \
|
|
||||||
CXX=$(HOSTCXX_NOCACHE) \
|
|
||||||
./go-nopie install -a -buildmode=pie std cmd ; \
|
|
||||||
retval=$$$$? ; \
|
retval=$$$$? ; \
|
||||||
rm -f go-nopie ; \
|
rm -f go-nopie ; \
|
||||||
exit $$$$retval ; \
|
exit $$$$retval ; \
|
||||||
|
|||||||
Reference in New Issue
Block a user