git: 37d2e25a2dc7 - stable/13 - Make sure MACHINE(_ARCH) are exported for depend-cleanup.sh
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 09 Dec 2024 21:48:56 UTC
The branch stable/13 has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=37d2e25a2dc7c9a12148b71dc6cf4a0c4bffdcd2
commit 37d2e25a2dc7c9a12148b71dc6cf4a0c4bffdcd2
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-07-11 00:53:04 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-12-09 21:46:43 +0000
Make sure MACHINE(_ARCH) are exported for depend-cleanup.sh
We run depend-cleanup.sh twice during the build. The second time is the
normal run, where we run it under WMAKEENV and thus have CROSSENV's
MACHINE(_ARCH)=${TARGET(_ARCH)} in the environment. However, the first
time is for bootstrap-tools, where it's run under BMAKEENV and we don't
have any assignments to MACHINE(_ARCH) in the environment, meaning the
script sees them as unset. In practice this doesn't matter since the
only use doesn't apply to bootstrap-tools, but it could be a future
issue. Thus, explicitly export them for depend-cleanup.sh and have the
script verify they're set.
Differential Revision: https://reviews.freebsd.org/D40968
(cherry picked from commit c70dd03a7ff649f832f1d29179b9094720392bce)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1543
---
Makefile.inc1 | 3 ++-
tools/build/depend-cleanup.sh | 10 ++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Makefile.inc1 b/Makefile.inc1
index 48cd0f1c772c..c8b5fc856dd5 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1029,7 +1029,8 @@ _sanity_check: .PHONY .MAKE
# replacing generated files. Handle these cases here in an ad-hoc fashion.
_cleanobj_fast_depend_hack: .PHONY
@echo ">>> Deleting stale dependencies...";
- sh ${.CURDIR}/tools/build/depend-cleanup.sh ${OBJTOP}
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \
+ sh ${.CURDIR}/tools/build/depend-cleanup.sh ${OBJTOP}
_worldtmp: .PHONY
@echo
diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index fd29c50593a5..385df785b426 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -22,6 +22,16 @@ if [ ! -d "$OBJTOP" ]; then
exit 1
fi
+if [ -z "${MACHINE+set}" ]; then
+ echo "$(basename "$0"): MACHINE not set" >&2
+ exit 1
+fi
+
+if [ -z "${MACHINE_ARCH+set}" ]; then
+ echo "$(basename "$0"): MACHINE_ARCH not set" >&2
+ exit 1
+fi
+
# $1 directory
# $2 source filename w/o extension
# $3 source extension