summaryrefslogtreecommitdiffstats
path: root/include/quilt.mk
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-06-03 06:16:08 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-06-03 06:16:08 +0000
commit140ef637ba039f40ca2c7c4e4c92ca22af5febea (patch)
treeeed2fdcff73a7374bac56a637ae02b5362877ec7 /include/quilt.mk
parent3fbf1e5df92ad504bb2200a7bd9f517d04a14b87 (diff)
Add quilt integration for packages
make package/<package>-prepare QUILT=1 will apply all patches using quilt Autorebuild will be disabled, so that you can edit all patches in the build dir. When you're done editing patches and everything works, you can call: make package/<package>-refresh That will copy the updated patches from quilt into package/<package>/patches, and remove all old patches. Before the patches are overwritten, the correct order of the patches is verified ('cat series' is compared against 'sort series'). git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7471 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'include/quilt.mk')
-rw-r--r--include/quilt.mk48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/quilt.mk b/include/quilt.mk
new file mode 100644
index 000000000..ec5acc507
--- /dev/null
+++ b/include/quilt.mk
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+QUILT?=$(strip $(shell test -f $(PKG_BUILD_DIR)/.quilt_patched && echo y))
+ifneq ($(QUILT),)
+ STAMP_PREPARED:=$(strip $(STAMP_PREPARED))_q
+ CONFIG_AUTOREBUILD=
+ PATCHES:=$(shell cd ./patches; ls)
+ define Build/Patch/Default
+ rm -rf $(PKG_BUILD_DIR)/patches
+ mkdir -p $(PKG_BUILD_DIR)/patches
+ for patch in $(PATCHES); do ( \
+ cp "./patches/$$$$patch" $(PKG_BUILD_DIR); \
+ cd $(PKG_BUILD_DIR); \
+ quilt import -p 1 "$$$$patch"; \
+ quilt push; \
+ quilt refresh; \
+ rm -f "$$$$patch"; \
+ ); done
+ touch $(PKG_BUILD_DIR)/.quilt_patched
+ endef
+else
+ define Build/Patch/Default
+ @if [ -d ./patches -a "$$$$(ls ./patches | wc -l)" -gt 0 ]; then \
+ $(PATCH) $(PKG_BUILD_DIR) ./patches; \
+ fi
+ endef
+endif
+
+refresh: $(STAMP_PREPARED)
+ @[ -f "$(PKG_BUILD_DIR)/patches/series" ] || { \
+ echo "The source directory was not unpacked using quilt. Please rebuild."; \
+ false; \
+ }
+ @[ "$$(cat $(PKG_BUILD_DIR)/patches/series | md5sum)" = "$$(sort $(PKG_BUILD_DIR)/patches/series | md5sum)" ] || { \
+ echo "The patches are not sorted in the right order. Please fix."; \
+ false; \
+ }
+ rm -f ./patches/* 2>/dev/null >/dev/null
+ @( \
+ for patch in $$(cat $(PKG_BUILD_DIR)/patches/series); do \
+ $(CP) -v "$(PKG_BUILD_DIR)/patches/$$patch" ./patches; \
+ done; \
+ )