golang: Move module cache into DL_DIR

This also adds a config option GOLANG_MOD_CACHE_WORLD_READABLE; if
enabled, chmod is run after a Go package build to make all
files/directories in the module cache world-readable.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To
2020-08-19 05:39:41 +08:00
parent 4674564e42
commit 3dd55b504c
4 changed files with 80 additions and 6 deletions

View File

@@ -219,3 +219,20 @@ ifneq ($(filter $(GO_OS_ARCH),$(GO_PIE_SUPPORTED_OS_ARCH)),)
GO_TARGET_PIE_SUPPORTED:=1
GO_TARGET_PIE_INSTALL_SUFFIX:=$(call go_pie_install_suffix,$(GO_OS_ARCH))
endif
# General build info
GO_MOD_CACHE_DIR:=$(DL_DIR)/go-mod-cache
GO_MOD_ARGS= \
-modcacherw
GO_GENERAL_BUILD_CONFIG_VARS= \
CONFIG_GOLANG_MOD_CACHE_WORLD_READABLE="$(CONFIG_GOLANG_MOD_CACHE_WORLD_READABLE)" \
GO_MOD_CACHE_DIR="$(GO_MOD_CACHE_DIR)"
define Go/CacheCleanup
$(GENERAL_BUILD_CONFIG_VARS) \
$(SHELL) $(GO_INCLUDE_DIR)/golang-build.sh cache_cleanup
endef