diff options
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 1 | ||||
-rw-r--r-- | solenv/gbuild/UnpackedTarball.mk | 31 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.mk | 8 |
3 files changed, 39 insertions, 1 deletions
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index be268ba3e25d..28c7dd4d4e80 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -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 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: diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index 91bb68b39c8e..02f8998de1e1 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -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)),) |