build: add support for git submodules with CONFIG_SRC_TREE_OVERRIDE
authorFelix Fietkau <nbd@nbd.name>
Wed, 25 Apr 2018 09:52:20 +0000 (11:52 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 27 Apr 2018 13:19:19 +0000 (15:19 +0200)
Also work around an issue where git would store the modified workdir in
the submodule git config files

Signed-off-by: Felix Fietkau <nbd@nbd.name>
include/package.mk

index 78ea5d0..9912c86 100644 (file)
@@ -120,7 +120,12 @@ ifdef USE_GIT_TREE
   define Build/Prepare/Default
        mkdir -p $(PKG_BUILD_DIR)
        ln -s $(CURDIR)/git-src $(PKG_BUILD_DIR)/.git
-       ( cd $(PKG_BUILD_DIR); git checkout .)
+       ( cd $(PKG_BUILD_DIR); \
+               git checkout .; \
+               git submodule update --recursive; \
+               git submodule foreach git config --unset core.worktree; \
+               git submodule foreach git checkout .; \
+       )
   endef
 endif
 ifdef USE_SOURCE_DIR