summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-09 16:33:59 +0000
committerFelix Fietkau <nbd@openwrt.org>2011-10-09 16:33:59 +0000
commit874622d0040d09ddd569fe9d889a52109df83e48 (patch)
treecac37e4d01d3b2355595860d8dd3a618df85b29a
parent58151667a811645e04c99742266e2f2803a2f572 (diff)
downloadmtk-20170518-874622d0040d09ddd569fe9d889a52109df83e48.zip
mtk-20170518-874622d0040d09ddd569fe9d889a52109df83e48.tar.gz
mtk-20170518-874622d0040d09ddd569fe9d889a52109df83e48.tar.bz2
build system: add a feature that allows you to pull sources from a git tree instead of the usual tarball
SVN-Revision: 28394
-rw-r--r--Config.in8
-rw-r--r--include/package.mk14
2 files changed, 21 insertions, 1 deletions
diff --git a/Config.in b/Config.in
index f36221c..4fc0d1a 100644
--- a/Config.in
+++ b/Config.in
@@ -430,6 +430,14 @@ menuconfig DEVEL
help
If enabled log files will be written to the ./log directory
+ config SRC_TREE_OVERRIDE
+ bool "Enable package source tree override" if DEVEL
+ help
+ If enabled, you can force a package to use a git tree as source
+ code instead of the normal tarball. Create a symlink 'git-src'
+ in the package directory, pointing to the .git tree that you want
+ to pull the source code from
+
menuconfig TARGET_OPTIONS
bool "Target Options" if DEVEL
diff --git a/include/package.mk b/include/package.mk
index cfb39da..2ad0f11 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -37,6 +37,10 @@ STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_NAME)_installed
STAGING_FILES_LIST:=$(PKG_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).list
+ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),)
+ USE_GIT_TREE:=1
+ QUILT:=1
+endif
include $(INCLUDE_DIR)/download.mk
include $(INCLUDE_DIR)/quilt.mk
@@ -84,6 +88,14 @@ define Download/default
MD5SUM:=$(PKG_MD5SUM)
endef
+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 .)
+ endef
+endif
+
define Build/Exports/Default
$(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR)/usr/share/aclocal $$(STAGING_DIR)/usr/share/aclocal-* $$(STAGING_DIR)/host/share/aclocal $$(STAGING_DIR)/host/share/aclocal-*),-I $$(p))
$(1) : export STAGING_PREFIX=$$(STAGING_DIR)/usr
@@ -97,7 +109,7 @@ Build/Exports=$(Build/Exports/Default)
define Build/DefaultTargets
$(if $(QUILT),$(Build/Quilt))
- $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))
+ $(if $(USE_GIT_TREE),$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
$(call Build/Autoclean)
download: