Kaydet (Commit) 363e0b67 authored tarafından Norbert Thiebaud's avatar Norbert Thiebaud

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/712Reviewed-by: 's avatarNorbert Thiebaud <nthiebaud@gmail.com>
Tested-by: 's avatarNorbert Thiebaud <nthiebaud@gmail.com>
üst 26c88486
......@@ -171,6 +171,7 @@ gb_UnoApiHeadersTarget_get_comprehensive_target = $(WORKDIR)/UnoApiHeadersTarget
gb_UnoApiHeadersTarget_get_target = $(WORKDIR)/UnoApiHeadersTarget/$(1)/normal.done
gb_UnoApiPartTarget_get_target = $(WORKDIR)/UnoApiPartTarget/$(1)
gb_UnpackedTarball_get_dir = $(WORKDIR)/UnpackedTarball/$(1)
gb_UnpackedTarball_get_pristine_dir = $(WORKDIR)/UnpackedTarball/$(1).org
gb_UnpackedTarball_get_final_target = $(WORKDIR)/UnpackedTarball/$(1).update
gb_UnpackedTarball_get_target = $(WORKDIR)/UnpackedTarball/$(1).done
gb_UnpackedTarball_get_preparation_target = $(WORKDIR)/UnpackedTarball/$(1).prepare
......
......@@ -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:
......@@ -71,6 +71,8 @@ endef
COMMA :=,
CLOSE_PAREN :=)
# optional extensions that should never be essential
ifneq ($(wildcard $(GBUILDDIR)/extensions/pre_*.mk),)
include $(wildcard $(GBUILDDIR)/extensions/pre_*.mk)
......@@ -145,6 +147,12 @@ gb_FULLDEPS := $(true)
endif
endif
ifneq ($(strip $(patches)$(PATCHES)),)
gb_KEEP_PRISTINE := $(true)
else
gb_KEEP_PRISTINE := $(false)
endif
# save user-supplied flags for latter use
# TODO remove after the old build system is abolished
ifneq ($(strip $(ENVCFLAGS)),)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment