mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
golang: Improve build isolation from user environment
* Set GOENV=off when building Go compiler and packages, to ignore user's
environment configuration file
* Set GOCACHE when building host Go
* Unset GOTMPDIR, to use the buildroot temp directory instead of temp
directories in build_dir
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
(cherry picked from 3b5f1c73fb)
This commit is contained in:
@@ -114,7 +114,6 @@ GO_PKG_WORK_DIR:=$(PKG_BUILD_DIR)/$(GO_PKG_WORK_DIR_NAME)
|
||||
|
||||
GO_PKG_BUILD_DIR:=$(GO_PKG_WORK_DIR)/build
|
||||
GO_PKG_CACHE_DIR:=$(GO_PKG_WORK_DIR)/cache
|
||||
GO_PKG_TMP_DIR:=$(GO_PKG_WORK_DIR)/tmp
|
||||
|
||||
GO_PKG_BUILD_BIN_DIR:=$(GO_PKG_BUILD_DIR)/bin$(if \
|
||||
$(GO_HOST_TARGET_DIFFERENT),/$(GO_OS)_$(GO_ARCH))
|
||||
@@ -170,8 +169,7 @@ GoPackage/has_binaries=$(call GoPackage/is_dir_not_empty,$(GO_PKG_BUILD_BIN_DIR)
|
||||
define GoPackage/Build/Configure
|
||||
( \
|
||||
cd $(PKG_BUILD_DIR) ; \
|
||||
mkdir -p $(GO_PKG_BUILD_DIR)/bin $(GO_PKG_BUILD_DIR)/src \
|
||||
$(GO_PKG_CACHE_DIR) $(GO_PKG_TMP_DIR) ; \
|
||||
mkdir -p $(GO_PKG_BUILD_DIR)/bin $(GO_PKG_BUILD_DIR)/src $(GO_PKG_CACHE_DIR) ; \
|
||||
\
|
||||
files=$$$$($(FIND) ./ \
|
||||
-type d -a \( -path './.git' -o -path './$(GO_PKG_WORK_DIR_NAME)' \) -prune -o \
|
||||
@@ -249,7 +247,7 @@ define GoPackage/Build/Compile
|
||||
cd $(GO_PKG_BUILD_DIR) ; \
|
||||
export GOPATH=$(GO_PKG_BUILD_DIR) \
|
||||
GOCACHE=$(GO_PKG_CACHE_DIR) \
|
||||
GOTMPDIR=$(GO_PKG_TMP_DIR) \
|
||||
GOENV=off \
|
||||
GOROOT_FINAL=$(GO_TARGET_ROOT) \
|
||||
CC=$(TARGET_CC) \
|
||||
CXX=$(TARGET_CXX) \
|
||||
|
||||
Reference in New Issue
Block a user