diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-09-27 16:19:14 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-09-29 07:54:31 +0000 |
commit | 363e0b67e9ce5de317603a76a5ffc159fc964722 (patch) | |
tree | f84870ef941f63bc033e3a5b268b1ceb93812b13 /solenv/gbuild/UnpackedTarball.mk | |
parent | 26c8848639537f9b4d7921c04f8747c992a643c2 (diff) |
add supporting target and options to generate patches for ExternalProjects
also add the support for the convention that a patch filename
encode the -p value if it end with .[0-9]
for instance foo.patch.2 indicate a -p2 patch
usage:
generate a 'reference' copy of the expanded and patched file structure
$> make clucene.clean
$> patches=t make clucene
go to the module
$> cd clucene
edit files in $WORKDIR/UnpackedTarball/clucene
force a rebuild of things that depend on that UnpackedTarball
$> make clucene.rebuild
create a -p1 patch named clucene.new.patch.1 in the module's directory
$> make clucene.genpatch
you can then rename it, place it where appropriate in the module
hierarchy, update the UnpackedTarball_lucene.mk to apply it.
rinse and repeat from the top (yes the make lucene.clean is needed
to regenerate a 'reference' expanded and patched tarball)
Change-Id: I419c54a5981cffa385521596ba5016d2ca7ef52a
Reviewed-on: https://gerrit.libreoffice.org/712
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'solenv/gbuild/UnpackedTarball.mk')
-rw-r--r-- | solenv/gbuild/UnpackedTarball.mk | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/solenv/gbuild/UnpackedTarball.mk b/solenv/gbuild/UnpackedTarball.mk index a9cf53e09764..c96d4ced7cc2 100644 --- a/solenv/gbuild/UnpackedTarball.mk +++ b/solenv/gbuild/UnpackedTarball.mk @@ -131,7 +131,9 @@ $(call gb_Helper_abbreviate_dirs,\ $(foreach file,$(UNPACKED_FIX_EOL),$(call gb_UnpackedTarball_CONVERTTOUNIX,$(file)) && ) \ $(if $(UNPACKED_PATCHES),\ for p in $(UNPACKED_PATCHES); do \ - $(GNUPATCH) -s -p$(UNPACKED_PATCHLEVEL) < "$$p" || exit 1;\ + pl=$(UNPACKED_PATCHLEVEL); \ + s=$${p##*.}; case "$$s" in [0-9]$(CLOSE_PAREN) pl="$$s"; ;; esac ; \ + $(GNUPATCH) -s -p$$pl < "$$p" || exit 1;\ done && \ ) \ $(foreach file,$(UNPACKED_FIX_EOL),$(call gb_UnpackedTarball_CONVERTTODOS,$(file)) && ) \ @@ -145,6 +147,10 @@ $(call gb_Helper_abbreviate_dirs,\ $(if $(UNPACKED_POST_ACTION),\ $(UNPACKED_POST_ACTION) && \ ) \ + $(if $(gb_KEEP_PRISTINE), \ + rm -fr $(call gb_UnpackedTarball_get_pristine_dir,$(2)) && \ + cp -r $(call gb_UnpackedTarball_get_dir,$(2)) $(call gb_UnpackedTarball_get_pristine_dir,$(2)) && \ + ) \ touch $(1) \ ) || \ ( \ @@ -174,6 +180,7 @@ $(call gb_UnpackedTarball_get_clean_target,%) : $(call gb_UnpackedTarball_get_target,$*) \ $(call gb_UnpackedTarball_get_preparation_target,$*) \ $(call gb_UnpackedTarball_get_dir,$*) \ + $(call gb_UnpackedTarball_get_pristine_dir,$*) \ $(foreach subdir,$(UNPACKED_SUBDIRS),$(gb_EXTERNAL_HEADERS_DIR)/$(subdir)) \ ) @@ -365,4 +372,26 @@ $(foreach file,$(2),$(call gb_UnpackedTarball_mark_output_file,$(1),$(file))) endef +# force the rebuild of an external target +# this only works when running as partial build. +# +%.rebuild : + if [ -f $(call gb_UnpackedTarball_get_target,$*) ] ; then \ + touch $(call gb_UnpackedTarball_get_target,$*) ; \ + make ;\ + fi + +%.genpatch : + if [ -d $(call gb_UnpackedTarball_get_dir,$*) -a -d $(call gb_UnpackedTarball_get_pristine_dir,$*) ] ; then \ + ( \ + patch_file=$$(pwd)/$*.new.patch.1; \ + cd $(call gb_UnpackedTarball_get_dir,) ; \ + diff -ur $*.org $* > $$patch_file; \ + echo "Patch $$patch_file generated" ; \ + ); \ + else \ + echo "Error: No pristine tarball avaialable for $*" 1>&2 ; \ + fi + + # vim: set noet sw=4 ts=4: |