remove cache/make.env recursion insanity. It breaks too many things

This commit is contained in:
Lance Vick 2023-06-18 15:04:53 -07:00
parent 78376e2094
commit cb72be053f
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
2 changed files with 13 additions and 27 deletions

View File

@ -47,21 +47,10 @@ KEY_DIR := keys
OUT_DIR := out OUT_DIR := out
docker = docker docker = docker
include $(CONFIG_DIR)/toolchain.env
export $(shell sed 's/=.*//' $(CONFIG_DIR)/toolchain.env)
export export
AUTOBUILD_TOOLCHAIN := true include $(CONFIG_DIR)/make.env
ifeq ($(AUTOBUILD_TOOLCHAIN),true) export $(shell sed 's/=.*//' $(CONFIG_DIR)/make.env)
ifeq ("$(wildcard $(CACHE_DIR_ROOT)/make.env)","")
echo := $(info $(shell echo "Initializing toolchain."))
build_env := $(shell $(MAKE) AUTOBUILD_TOOLCHAIN=false toolchain )
endif
endif
ifneq (,$(wildcard $(CACHE_DIR_ROOT)/make.env))
include $(CACHE_DIR_ROOT)/make.env
export $(shell sed 's/=.*//' $(CACHE_DIR_ROOT)/make.env)
endif
## Use env vars from existing release if present ## Use env vars from existing release if present
ifneq (,$(wildcard $(DIST_DIR)/release.env)) ifneq (,$(wildcard $(DIST_DIR)/release.env))
@ -78,8 +67,7 @@ toolchain: \
$(BIN_DIR) \ $(BIN_DIR) \
$(OUT_DIR) \ $(OUT_DIR) \
$(CACHE_DIR_ROOT)/toolchain.state \ $(CACHE_DIR_ROOT)/toolchain.state \
$(CACHE_DIR_ROOT)/container.env \ $(CACHE_DIR_ROOT)/container.env
$(CACHE_DIR_ROOT)/make.env
# Launch a shell inside the toolchain container # Launch a shell inside the toolchain container
.PHONY: toolchain-shell .PHONY: toolchain-shell
@ -93,7 +81,7 @@ toolchain-update:
$(CONFIG_DIR)/apt-sources-x86_64.list \ $(CONFIG_DIR)/apt-sources-x86_64.list \
$(CONFIG_DIR)/apt-hashes-x86_64.list \ $(CONFIG_DIR)/apt-hashes-x86_64.list \
$(FETCH_DIR)/apt $(FETCH_DIR)/apt
$(MAKE) AUTOBUILD_TOOLCHAIN=false $(CONFIG_DIR)/apt-hashes-x86_64.list $(MAKE) $(CONFIG_DIR)/apt-hashes-x86_64.list
$(CONFIG_DIR)/apt-base.list: $(CONFIG_DIR)/apt-base.list:
touch $(CONFIG_DIR)/apt-base.list touch $(CONFIG_DIR)/apt-base.list
@ -173,9 +161,8 @@ $(FETCH_DIR):
$(OUT_DIR): $(OUT_DIR):
mkdir -p $@ mkdir -p $@
$(CACHE_DIR_ROOT)/make.env $(CACHE_DIR_ROOT)/container.env: \ $(CACHE_DIR_ROOT)/container.env: \
$(CONFIG_DIR)/global.env \ $(CONFIG_DIR)/make.env \
$(CONFIG_DIR)/toolchain.env \
$(CACHE_DIR_ROOT)/toolchain.state $(CACHE_DIR_ROOT)/toolchain.state
docker run \ docker run \
--rm \ --rm \
@ -211,10 +198,10 @@ $(CACHE_DIR_ROOT)/make.env $(CACHE_DIR_ROOT)/container.env: \
--volume $(TOOLCHAIN_VOLUME) \ --volume $(TOOLCHAIN_VOLUME) \
--workdir $(TOOLCHAIN_WORKDIR) \ --workdir $(TOOLCHAIN_WORKDIR) \
$(shell cat cache/toolchain.state 2> /dev/null) \ $(shell cat cache/toolchain.state 2> /dev/null) \
$(SRC_DIR)/toolchain/scripts/environment $(CACHE_DIR_ROOT) $(SRC_DIR)/toolchain/scripts/environment > $@
$(CACHE_DIR_ROOT)/toolchain.tar: \ $(CACHE_DIR_ROOT)/toolchain.tar: \
$(CONFIG_DIR)/toolchain.env \ $(CONFIG_DIR)/make.env \
$(SRC_DIR)/toolchain/Dockerfile \ $(SRC_DIR)/toolchain/Dockerfile \
$(CONFIG_DIR)/apt-base.list \ $(CONFIG_DIR)/apt-base.list \
$(CONFIG_DIR)/apt-sources-$(ARCH).list \ $(CONFIG_DIR)/apt-sources-$(ARCH).list \

View File

@ -1,12 +1,11 @@
#!/bin/sh #!/bin/sh
CACHE_DIR_ROOT=${1?}
HOME=/home/build HOME=/home/build
CONFIG_DIR=/home/build/config CONFIG_DIR=/home/build/config
cat ${CONFIG_DIR}/toolchain.env > ${CACHE_DIR_ROOT}/container.env cat ${CONFIG_DIR}/make.env
cat <<- EOF >> ${CACHE_DIR_ROOT}/container.env cat <<- EOF
HOME=${HOME} HOME=${HOME}
PATH=${HOME}/${BIN_DIR}:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH=${HOME}/${BIN_DIR}:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
TZ=UTC TZ=UTC
@ -39,6 +38,6 @@ cat <<- EOF >> ${CACHE_DIR_ROOT}/container.env
FETCH_DIR=${HOME}/${FETCH_DIR} FETCH_DIR=${HOME}/${FETCH_DIR}
EOF EOF
envsubst < ${CONFIG_DIR}/global.env > ${CACHE_DIR_ROOT}/make.env if [ -f "${CONFIG_DIR}/container.env" ]; then
envsubst < ${CONFIG_DIR}/container.env
cat ${CACHE_DIR_ROOT}/make.env >> ${CACHE_DIR_ROOT}/container.env fi