Skip to content

Commit 9e57b62

Browse files
committed
include/package.mk: Add support for src-checkout/ folder
This feature is similar to the SRC_TREE_OVERRIDE. However instead of having to manually create a symlink inside the package folder, the buildsystem will check if $(TOP_DIR)/src-checkout/$(PKG_NAME)/.git is present and use this instead. Signed-off-by: John Crispin <[email protected]>
1 parent 1174b94 commit 9e57b62

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

include/package.mk

+17-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ include $(INCLUDE_DIR)/prereq.mk
4040
include $(INCLUDE_DIR)/unpack.mk
4141
include $(INCLUDE_DIR)/depends.mk
4242

43+
ifneq ($(wildcard $(TOPDIR)/git-src/$(PKG_NAME)/.git),)
44+
USE_GIT_SRC_CHECKOUT:=1
45+
QUILT:=1
46+
endif
4347
ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),)
4448
USE_GIT_TREE:=1
4549
QUILT:=1
@@ -129,6 +133,18 @@ ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
129133
endif
130134
endif
131135

136+
ifdef USE_GIT_SRC_CHECKOUT
137+
define Build/Prepare/Default
138+
mkdir -p $(PKG_BUILD_DIR)
139+
ln -s $(TOPDIR)/git-src/$(PKG_NAME)/.git $(PKG_BUILD_DIR)/.git
140+
( cd $(PKG_BUILD_DIR); \
141+
git checkout .; \
142+
git submodule update --recursive; \
143+
git submodule foreach git config --unset core.worktree; \
144+
git submodule foreach git checkout .; \
145+
)
146+
endef
147+
endif
132148
ifdef USE_GIT_TREE
133149
define Build/Prepare/Default
134150
mkdir -p $(PKG_BUILD_DIR)
@@ -248,7 +264,7 @@ define Build/CoreTargets
248264
endef
249265

250266
define Build/DefaultTargets
251-
$(if $(USE_SOURCE_DIR)$(USE_GIT_TREE),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
267+
$(if $(USE_SOURCE_DIR)$(USE_GIT_TREE)$(USE_GIT_SRC_CHECKOUT),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
252268
$(if $(DUMP),,$(Build/CoreTargets))
253269

254270
define Build/DefaultTargets

0 commit comments

Comments
 (0)