--- a/make-rules/prep.mk Mon Apr 13 09:25:17 2015 -0500
+++ b/make-rules/prep.mk Mon Apr 27 10:19:50 2015 -0500
@@ -23,134 +23,28 @@
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
#
-# One must do all unpack and patch in sequence.
-.NOTPARALLEL: (SOURCE_DIR)/.prep
-
-UNPACK = $(WS_TOOLS)/userland-unpack
-FETCH = $(WS_TOOLS)/userland-fetch
-
-ARCHIVES += $(COMPONENT_ARCHIVE)
-CLEAN_PATHS += $(SOURCE_DIR)
-
-# In order to override PATCH_DIR and PATCH_PATTERN in component makefiles, they
-# need to be conditionally set here. This means that the override needs to
-# happen prior to including prep.mk. Otherwise other variables set here which
-# are based on those will be expanded too early for the override to take
-# effect.
-# You also can't override PATCHES after including prep.mk; if you want to
-# append filenames to PATCHES, you'll have to set $(EXTRA_PATCHES) prior to
-# inclusion.
-PATCH_DIR ?= patches
-
-# we may need patches only for use with parfait
-ifeq ($(strip $(PARFAIT_BUILD)),yes)
-PARFAIT_PATCH_DIR = parfait
-endif
-PATCH_PATTERN ?= *.patch
-PATCHES = $(shell find $(PATCH_DIR) $(PARFAIT_PATCH_DIR) -type f -name '$(PATCH_PATTERN)' \
- 2>/dev/null | sort) $(EXTRA_PATCHES)
-
-# Rule to perform the patching.
-$(SOURCE_DIR)/.%ed: $(PATCH_DIR)/%
- $(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
- $(TOUCH) [email protected]
-
-# Parfait patches rule: TODO - Integrate with other patch rules
-ifeq ($(strip $(PARFAIT_BUILD)),yes)
-$(SOURCE_DIR)/.%ed: $(PARFAIT_PATCH_DIR)/%
- $(GPATCH) -d $(@D) $(GPATCH_FLAGS) < $<
- $(TOUCH) [email protected]
-endif
-
-# Template for download rules.
-define download-rule
-ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
-CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
-$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ)
- $$(FETCH) --file [email protected] \
- $$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \
- $$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) \
- $$(COMPONENT_SIG_URL$(1):%=--sigurl %)
- $$(TOUCH) [email protected]
-endef
+include $(WS_MAKE_RULES)/prep-download.mk
+include $(WS_MAKE_RULES)/prep-hg.mk
+include $(WS_MAKE_RULES)/prep-git.mk
+include $(WS_MAKE_RULES)/prep-svn.mk
+include $(WS_MAKE_RULES)/prep-unpack.mk
+include $(WS_MAKE_RULES)/prep-patch.mk
-# Template for patching rules, note that patching is actually done by the
-# %.ed pattern rule above.
-# To maintain backwards compatibility, the flag PATCH_EACH_ARCHIVE must
-# be non-empty in order to activate individual archive patching.
-define patch-rule
-ifneq ($(strip $$(PATCH_EACH_ARCHIVE)),)
-# Prepend the patch directory to each archive patch.
-#$$(COMPONENT_PATCHES$(1):%=$$(PATCH_DIR)/%)
-#PATCHDIR_PATCHES$(1) += $$(COMPONENT_PATCHES)
-PATCHDIR_PATCHES$(1) += $$(foreach patch,$$(COMPONENT_PATCHES$(1)), \
- $$(PATCH_DIR)/$$(patch))
-else
-PATCHDIR_PATCHES = $$(PATCHES)
-endif
-# Substitute the patch dir for the source dir on the patches
-STAMPS$(1)+= $$(PATCHDIR_PATCHES$(1):$$(PATCH_DIR)/%=$$(SOURCE_DIR)/.%ed)
-ifeq ($(strip $(PARFAIT_BUILD)),yes)
-STAMPS$(1)+= $$(PATCHDIR_PATCHES$(1):$$(PARFAIT_PATCH_DIR)/%=$$(SOURCE_DIR)/.%ed)
-endif
-$$(SOURCE_DIR)/.patched$(1): $$(SOURCE_DIR)/.unpacked$(1) $$(STAMPS$(1))
- $$(TOUCH) [email protected]
-endef
+download::
+
+unpack:: download
-# Template for unpacking rules.
-define unpack-rule
-$$(SOURCE_DIR)/.unpacked$(1): download $(MAKEFILE_PREREQ) $$(PATCHDIR_PATCHES$(1))
- $$(RM) -r $$(COMPONENT_SRC$(1))
- $$(UNPACK) $$(UNPACK_ARGS$(1)) \
- $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
- $$(COMPONENT_POST_UNPACK_ACTION$(1))
- $$(TOUCH) [email protected]
-endef
+patch:: unpack
-# If an archive is defined, create a download, unpack and patch rule.
-define archive-rule
-ifneq ($(strip $$(COMPONENT_ARCHIVE$(1))),)
-$(eval $(call download-rule,$(1)))
-$(eval $(call unpack-rule,$(1)))
-$(eval $(call patch-rule,$(1)))
-ARCHIVE_STAMPS +=$$(SOURCE_DIR)/.patched$(1)
-endif
-endef
-
-# Calculate the number of defined archives.
-# Always generate at least the basic prep rules.
-# Work out if there are any other archives to be downloaded and patched.
-NUM_EXTRA_ARCHIVES ?= 1 2 3 4 5 6 7 8 9
-$(eval $(call archive-rule,))
-ifneq ($(strip $(PATCH_EACH_ARCHIVE)),)
-$(foreach suffix,$(NUM_EXTRA_ARCHIVES), \
- $(eval $(call archive-rule,_$(suffix))))
-else
-# Backwards compatibility - only download, do not unpack or patch automatically
-$(foreach suffix,$(NUM_EXTRA_ARCHIVES), \
- $(eval $(call download-rule,_$(suffix))))
-endif
-
-$(SOURCE_DIR)/.prep: $(ARCHIVE_STAMPS)
+$(SOURCE_DIR)/.prep: download unpack patch
$(COMPONENT_PREP_ACTION)
$(TOUCH) [email protected]
prep:: $(SOURCE_DIR)/.prep
-download:: $(ARCHIVES:%=$(USERLAND_ARCHIVES)%)
-
clean::
$(RM) -r $(CLEAN_PATHS)
clobber:: clean
$(RM) -r $(CLOBBER_PATHS)
-REQUIRED_PACKAGES += archiver/gnu-tar
-REQUIRED_PACKAGES += compress/bzip2
-REQUIRED_PACKAGES += compress/gzip
-REQUIRED_PACKAGES += compress/p7zip
-REQUIRED_PACKAGES += compress/unzip
-REQUIRED_PACKAGES += compress/xz
-REQUIRED_PACKAGES += developer/java/jdk
-REQUIRED_PACKAGES += runtime/ruby
-REQUIRED_PACKAGES += text/gnu-patch