include $(INCLUDE_DIR)/unpack.mk
include $(INCLUDE_DIR)/depends.mk
+
+# git-src is only honoured for the host build when a package opts in via
+# HOST_USE_GIT_SRC, since by default the host build keeps using the tarball.
+ifdef HOST_USE_GIT_SRC
+ ifneq ($(GIT_SRC_CHECKOUT_DIR),)
+ USE_HOST_GIT_SRC_CHECKOUT:=1
+ HOST_QUILT:=1
+ endif
+ ifneq ($(GIT_TREE_OVERRIDE_DIR),)
+ USE_HOST_GIT_TREE:=1
+ HOST_QUILT:=1
+ endif
+endif
+
include $(INCLUDE_DIR)/quilt.mk
BUILD_TYPES += host
$(Host/Patch)
endef
+ifdef USE_HOST_GIT_SRC_CHECKOUT
+ Host/Prepare/Default = $(call Prepare/git-src,$(HOST_BUILD_DIR),$(GIT_SRC_CHECKOUT_DIR))
+endif
+ifdef USE_HOST_GIT_TREE
+ Host/Prepare/Default = $(call Prepare/git-src,$(HOST_BUILD_DIR),$(CURDIR)/git-src)
+endif
+
define Host/Prepare
$(call Host/Prepare/Default)
endef
define HostBuild
$(HostBuild/Core)
- $(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),,
- $(if $(and $(CONFIG_AUTOREMOVE), $(wildcard $(HOST_STAMP_INSTALLED), $(wildcard $(HOST_STAMP_BUILT)))),,
- $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
+ $(if $(USE_HOST_GIT_SRC_CHECKOUT)$(USE_HOST_GIT_TREE),,
+ $(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),,
+ $(if $(and $(CONFIG_AUTOREMOVE), $(wildcard $(HOST_STAMP_INSTALLED), $(wildcard $(HOST_STAMP_BUILT)))),,
+ $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
+ )
)
)
endef
include $(INCLUDE_DIR)/unpack.mk
include $(INCLUDE_DIR)/depends.mk
-ifneq ($(wildcard $(TOPDIR)/git-src/$(PKG_NAME)/.git),)
+ifneq ($(GIT_SRC_CHECKOUT_DIR),)
USE_GIT_SRC_CHECKOUT:=1
QUILT:=1
endif
-ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),)
+ifneq ($(GIT_TREE_OVERRIDE_DIR),)
USE_GIT_TREE:=1
QUILT:=1
endif
endif
ifdef USE_GIT_SRC_CHECKOUT
- define Build/Prepare/Default
- mkdir -p $(PKG_BUILD_DIR)
- ln -s $(TOPDIR)/git-src/$(PKG_NAME)/.git $(PKG_BUILD_DIR)/.git
- ( cd $(PKG_BUILD_DIR); \
- git checkout .; \
- git submodule update --recursive; \
- git submodule foreach git config --unset core.worktree; \
- git submodule foreach git checkout .; \
- )
- endef
+ Build/Prepare/Default = $(call Prepare/git-src,$(PKG_BUILD_DIR),$(GIT_SRC_CHECKOUT_DIR))
endif
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 .; \
- git submodule update --recursive; \
- git submodule foreach git config --unset core.worktree; \
- git submodule foreach git checkout .; \
- )
- endef
+ Build/Prepare/Default = $(call Prepare/git-src,$(PKG_BUILD_DIR),$(CURDIR)/git-src)
endif
ifdef USE_SOURCE_DIR
define Build/Prepare/Default
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
+