From c7557051a5f2cc77212afb5292212fb41b1469e0 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 21 Jan 2020 02:49:07 -0500 Subject: [PATCH] integrate cowpatch for preservation of original source trees this makes it far easier to iterate testing of patches, and sets the stage for enforcing re-patching with makefile-level dependencies. the pristine sources are kept in directories suffixed with ".orig", and the unsuffixed directory now contains the result of running cowpatch -- that is, a mix of symlinks to the original files, and modified copies of the files/directories affected by patches. --- Makefile | 36 ++++++++++++--------- cowpatch.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 15 deletions(-) create mode 100755 cowpatch.sh diff --git a/Makefile b/Makefile index 8681562..d8588a8 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,8 @@ LINUX_HEADERS_SITE = http://ftp.barfooze.de/pub/sabotage/tarballs/ DL_CMD = wget -c -O +COWPATCH = $(PWD)/cowpatch.sh + HOST = $(if $(NATIVE),$(TARGET)) BUILD_DIR = build/$(if $(HOST),$(HOST),local)/$(TARGET) OUTPUT = $(CURDIR)/output$(if $(HOST),-$(HOST)) @@ -97,39 +99,41 @@ musl-git-%: cd $@.tmp && git fsck mv $@.tmp $@ -%: $(SOURCES)/%.tar.gz | $(SOURCES)/config.sub +%.orig: $(SOURCES)/%.tar.gz | $(SOURCES)/config.sub rm -rf $@.tmp mkdir $@.tmp ( cd $@.tmp && tar zxvf - ) < $< - test ! -d patches/$@ || cat patches/$@/* | ( cd $@.tmp/$@ && patch -p1 ) - test ! -f $@.tmp/$@/config.sub || cp -f $(SOURCES)/config.sub $@.tmp/$@ rm -rf $@ - touch $@.tmp/$@ - mv $@.tmp/$@ $@ + touch $@.tmp/$(patsubst %.orig,%,$@) + mv $@.tmp/$(patsubst %.orig,%,$@) $@ rm -rf $@.tmp -%: $(SOURCES)/%.tar.bz2 | $(SOURCES)/config.sub +%.orig: $(SOURCES)/%.tar.bz2 | $(SOURCES)/config.sub rm -rf $@.tmp mkdir $@.tmp ( cd $@.tmp && tar jxvf - ) < $< - test ! -d patches/$@ || cat patches/$@/* | ( cd $@.tmp/$@ && patch -p1 ) - test ! -f $@.tmp/$@/config.sub || cp -f $(SOURCES)/config.sub $@.tmp/$@ rm -rf $@ - touch $@.tmp/$@ - mv $@.tmp/$@ $@ + touch $@.tmp/$(patsubst %.orig,%,$@) + mv $@.tmp/$(patsubst %.orig,%,$@) $@ rm -rf $@.tmp -%: $(SOURCES)/%.tar.xz | $(SOURCES)/config.sub +%.orig: $(SOURCES)/%.tar.xz | $(SOURCES)/config.sub rm -rf $@.tmp mkdir $@.tmp ( cd $@.tmp && tar Jxvf - ) < $< - test ! -d patches/$@ || cat patches/$@/* | ( cd $@.tmp/$@ && patch -p1 ) - test ! -f $@.tmp/$@/config.sub || cp -f $(SOURCES)/config.sub $@.tmp/$@ rm -rf $@ - touch $@.tmp/$@ - mv $@.tmp/$@ $@ + touch $@.tmp/$(patsubst %.orig,%,$@) + mv $@.tmp/$(patsubst %.orig,%,$@) $@ rm -rf $@.tmp +%: %.orig + rm -rf $@.tmp + mkdir $@.tmp + ( cd $@.tmp && ln -s ../$