build: support git-src override for host builds

Extend the git-src source tree override to host builds. It is opt-in via
HOST_USE_GIT_SRC, since by default the host build keeps using the tarball.

Move the git-src detection and checkout recipe into unpack.mk so both the
target and host build reuse the same code.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau
2026-07-06 11:55:09 +02:00
parent 37fad8b07e
commit 8bbaad10e0
3 changed files with 45 additions and 25 deletions
+15
View File
@@ -70,3 +70,18 @@ endif
endif # PKG_SOURCE
GIT_SRC_CHECKOUT_DIR = $(wildcard $(TOPDIR)/git-src/$(PKG_NAME)/.git)
GIT_TREE_OVERRIDE_DIR = $(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src))
# $1=build directory, $2=.git directory to link into it
define Prepare/git-src
mkdir -p $(1)
ln -s $(2) $(1)/.git
( cd $(1); \
git checkout .; \
git submodule update --recursive; \
git submodule foreach git config --unset core.worktree; \
git submodule foreach git checkout .; \
)
endef