From 6b22b74280e37d8c51e579a89ec028738b899948 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 20 Oct 2023 01:17:35 +0200 Subject: [PATCH] build: fix duplicate building of host-tools Upstream introduced two different methods for determining the state of a package within the OpenWrt buildsystem. While both are based around the md5 hash-function, one taks filename & mtime into account while the other one uses the actual md5 hash of the file-content. Ever wondered why Gluon suddenly took considerably longer to build? The messy part is how the build-system chooses which method to use. This is based around the AUTOREMOVE configuration. Gluon sets this variable conditionally when built with GLUON_AUTOREMOVE set to 1. Enter the Gluon build-system. It first compiles Lua, without the AUTOREMOVE configuration passed to OpenWrt. This compiles the packages with the old hash-method based around filename & mtime. Afterwards, it builds with AUTOREMOVE enabled, changing the hash-function and rebuilding all host-packages. Fix this by setting AUTOREMOVE for both build-processes according to the setting of GLUON_AUTOREMOVE. Link: https://github.com/openwrt/openwrt/commit/53a08e37437972ba0a8fbf953a93a70a6b784ef4 Signed-off-by: David Bauer --- Makefile | 3 ++- scripts/basic_openwrt_config.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 scripts/basic_openwrt_config.sh diff --git a/Makefile b/Makefile index 695b1bc73c..758d9a93e2 100644 --- a/Makefile +++ b/Makefile @@ -170,7 +170,8 @@ $(LUA): scripts/module_check.sh - [ -e openwrt/.config ] || $(OPENWRTMAKE) defconfig + $(GLUON_ENV) scripts/basic_openwrt_config.sh > openwrt/.config + $(OPENWRTMAKE) defconfig $(OPENWRTMAKE) tools/install $(OPENWRTMAKE) package/lua/host/compile diff --git a/scripts/basic_openwrt_config.sh b/scripts/basic_openwrt_config.sh new file mode 100755 index 0000000000..105386febf --- /dev/null +++ b/scripts/basic_openwrt_config.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "CONFIG_DEVEL=y" +if [ "$GLUON_AUTOREMOVE" != "0" ]; then + echo "CONFIG_AUTOREMOVE=y" +else + echo "# CONFIG_AUTOREMOVE is not set" +fi