24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
24662696 gmake clobber in ftp-proxy doesn't remove tarball
--- a/components/apache2-modules/mod_dtrace/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/apache2-modules/mod_dtrace/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -29,6 +29,7 @@
COMPONENT_VERSION= 0.3.1
COMPONENT_SRC= src
COMPONENT_ARCHIVE=
+COMPONENT_ARCHIVE_SRC= none
COMPONENT_PROJECT_URL= http://prefetch.net/projects/apache_modtrace/
TPNO= 8876
--- a/components/cackey/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/cackey/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -45,6 +45,10 @@
COMPONENT_NAME= CACKey
COMPONENT_VERSION= 0.7.4
+# The new form includes the commit as a disambiguator, but the current archive
+# wasn't created with that in its name, so we use the old form until the next
+# update.
+COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_PROJECT_URL= http://www.rkeene.org/projects/info/wiki/161
COMPONENT_ARCHIVE_SRC= git
--- a/components/desktop/os-welcome/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/desktop/os-welcome/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -29,6 +29,7 @@
COMPONENT_NAME= os-welcome
COMPONENT_VERSION= 1.2.0
COMPONENT_SRC= files
+COMPONENT_ARCHIVE_SRC= none
COMPONENT_BUGDB= gnome/applications
# nothing to download ; just build & package
--- a/components/ftp-proxy/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/ftp-proxy/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -28,7 +28,10 @@
IPS_COMPONENT_VERSION= 5.5
COMPONENT_PROJECT_URL= http://www.openbsd.org
COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
+# The archive exists only in the userland cache. In order to update the cache,
+# we have to get the sources via CVS manually and ask the gatekeepers to add it.
COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.bz2
+COMPONENT_ARCHIVE_URL=
COMPONENT_ARCHIVE_SRC= cache
COMPONENT_ARCHIVE_HASH= sha256:372dbe0ca8c6b090842a9f0fbdd13b320dc37883137d3dc674d588448aa2d5e9
COMPONENT_BUGDB= service/ftp-proxy
@@ -55,15 +58,6 @@
COMPONENT_INSTALL_ARGS += MANDIR=$(PROTOUSRSHAREMANDIR)
COMPONENT_INSTALL_ARGS += INSTALL=$(INSTALL)
-# Here we just download the cached source archive. In order to update
-# the cache, we have to get the sources via CVS manually and ask gatekeepers
-# to place it into the cache. There is no archive available at openbsd.org.
-download:: $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE)
-
-$(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE): $(MAKEFILE_PREREQ)
- $(FETCH) --file [email protected] --hash $(COMPONENT_ARCHIVE_HASH)
- $(TOUCH) [email protected]
-
REQUIRED_PACKAGES += library/libevent
REQUIRED_PACKAGES += network/firewall
REQUIRED_PACKAGES += shell/ksh93
--- a/components/gnome/gtk-engines/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/gnome/gtk-engines/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -31,7 +31,6 @@
COMPONENT_VERSION= 2.20.2
COMPONENT_PROJECT_URL= http://www.gtk.org/
COMPONENT_ARCHIVE= gtk-engines-2.20.2.tar.bz2
-COMPONENT_ARCHIVE_OVERRIDE= true
COMPONENT_ARCHIVE_HASH= \
sha256:15b680abca6c773ecb85253521fa100dd3b8549befeecc7595b10209d62d66b5
COMPONENT_BUGDB= gnome/libraries
--- a/components/gnome/pygtk2/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/gnome/pygtk2/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -33,7 +33,6 @@
COMPONENT_VERSION= 2.24.0
COMPONENT_PROJECT_URL= http://www.pygtk.org/
COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.bz2
-COMPONENT_ARCHIVE_OVERRIDE= true # override gnome-component.mk default of *.xz
COMPONENT_ARCHIVE_HASH= \
sha256:cd1c1ea265bd63ff669e92a2d3c2a88eb26bcd9e5363e0f82c896e649f206912
COMPONENT_BUGDB= gnome/libraries
--- a/components/golang/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/golang/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -67,6 +67,7 @@
define supp-rules
COMPONENT_NAME_$(1)= $(1)
COMPONENT_VERSION_$(1)= $(COMPONENT_VERSION)
+COMPONENT_LABEL_$(1)=
COMPONENT_IMPORT_SRC_$(1)= golang.org/x
GIT_REPO_$(1)= https://github.com/golang/$(1).git
TPNO_$(1)= $(TPNO)
--- a/components/libpki/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/libpki/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -30,6 +30,10 @@
COMPONENT_NAME= libpki
COMPONENT_VERSION= 0.8.9
+# The new form includes the commit as a disambiguator, but the current archive
+# wasn't created with that in its name, so we use the old form until the next
+# update.
+COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_PROJECT_URL= https://www.openca.org/projects/libpki/
COMPONENT_ARCHIVE_SRC= git
COMPONENT_BUGDB= library/smartcard
--- a/components/libusb/ugen/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/libusb/ugen/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -30,6 +30,7 @@
IPS_COMPONENT_VERSION= 0.5.11
COMPONENT_PROJECT_URL= http://libusb.sf.net/
COMPONENT_SRC= src
+COMPONENT_ARCHIVE_SRC= none
COMPONENT_BUGDB= library/libusb
BUILD_STYLE= justmake
--- a/components/libusb/wrapper/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/libusb/wrapper/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -30,6 +30,7 @@
COMPONENT_PROJECT_URL= http://libusb.sf.net/
COMPONENT_SRC= src
COMPONENT_ARCHIVE=
+COMPONENT_ARCHIVE_SRC= none
COMPONENT_BUGDB= library/libusb
TPNO= 9184
--- a/components/openca-ocspd/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/openca-ocspd/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -27,6 +27,10 @@
COMPONENT_NAME= openca-ocspd
COMPONENT_VERSION= 3.1.2
+# The new form includes the commit as a disambiguator, but the current archive
+# wasn't created with that in its name, so we use the old form until the next
+# update.
+COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_PROJECT_URL= https://www.openca.org/projects/ocspd/
COMPONENT_ARCHIVE_SRC= git
COMPONENT_BUGDB= library/smartcard
--- a/components/rpm2cpio/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/rpm2cpio/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -35,6 +35,7 @@
COMPONENT_VERSION= 1.3
COMPONENT_PROJECT_URL= http://svnweb.freebsd.org/ports/head/archivers/rpm2cpio
COMPONENT_SRC= src
+COMPONENT_ARCHIVE_SRC= none
COMPONENT_BUGDB= utility/rpm
TPNO= 17824
--- a/components/vim/Makefile Thu Sep 08 17:47:13 2016 -0700
+++ b/components/vim/Makefile Thu Sep 15 11:53:59 2016 -0700
@@ -29,6 +29,7 @@
COMPONENT_VERSION= 7.4
IPS_COMPONENT_VERSION= $(shell echo $(HG_REV) | sed -e 's/-/./g' -e 's/v//')
# COMPONENT_SRC* is autodefined by the prep-{SCM} Makefile fragment
+COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.bz2
COMPONENT_PROJECT_URL= http://www.vim.org/
HG_REPO= https://vim.googlecode.com/hg
--- a/doc/makefile-variables.txt Thu Sep 08 17:47:13 2016 -0700
+++ b/doc/makefile-variables.txt Thu Sep 15 11:53:59 2016 -0700
@@ -2,22 +2,43 @@
Makefiles. To distinguish these from the Makefile(s) that are part of each
component distribution, the latter will be referred to as native Makefiles.
-The following are the basics that just about every Makefile should have.
+The following are the basics that just about every Makefile should have. Most
+have defaults, but can be overridden.
+
+* BUILD_ARCH declares which architecture this component should be built for;
+ possible values are: i386, sparc. If not set, the component will be built
+ for both.
* BUILD_BITS declares which bits this component should be built for and
which binaries are the preferred ones (i.e. should be installed in /usr/bin);
- values are: 64, 64_and_32, 32, 32_and_64.
+ values are: 64, 64_and_32, 32, 32_and_64, and NO_ARCH.
+
* COMPONENT_NAME is typically a short name (e.g., vim).
+
* COMPONENT_VERSION is typically numbers separated by dots (e.g. 7.3).
+
* COMPONENT_SRC is where the archive is extracted; it has a default value of
"$(COMPONENT_NAME)-$(COMPONENT_VERSION)".
+
* COMPONENT_PROJECT_URL is the general web site for the component.
+
* COMPONENT_ARCHIVE is the base name of the archive to be downloaded; it has
a default value of "$(COMPONENT_SRC).tar.gz".
+
* COMPONENT_ARCHIVE_HASH is typically "sha256:" followed by the first output
field of `sha256sum $(COMPONENT_ARCHIVE)`.
+
+* COMPONENT_ARCHIVE_SRC defines what kind of object delivers the source. This
+ can be "git", "hg", or "svn" if the source comes from an SCM repository, and
+ must be "none" if the source is checked into the Userland repository
+ directly.
+
* COMPONENT_ARCHIVE_URL is where the archive can be downloaded from. This is
typically constructed from $(COMPONENT_PROJECT_URL) and $(COMPONENT_ARCHIVE).
+
+* COMPONENT_BUGDB is the lower-case rendering of the BugDB cat/subcat; it has
+ a default value of "utility/$(COMPONENT_NAME)".
+
* COMPONENT_SIG_URL is the URL where the PGP signature for $(COMPONENT_ARCHIVE)
can be found. This can be used in addition to the hash in
$(COMPONENT_ARCHIVE_HASH) to verify the correctness of the archive. If
@@ -32,6 +53,11 @@
done
before you 'hg commit' your merge.
+* COMPONENT_LABEL is an arbitrary string that will be used as part of
+ COMPONENT_SRC when building an archive from an SCM source repository. It
+ defaults to COMPONENT_VERSION. It may be set to empty if desired. See
+ the relevant makefiles for the full composition.
+
* GIT_REPO can be used in place of COMPONENT_ARCHIVE_URL to pull the component
source from the GIT repository referenced in the value.
* GIT_REV is the tag or changeset that you wish to pull from GIT.
@@ -44,33 +70,9 @@
source from the Subversion repository referenced in the value.
* SVN_REV is the tag or changeset that you wish to pull from Subversion.
-The following are basic variables that can be overridden but provide default
-values:
-
-* BUILD_ARCH declares which architecture this component should be built for;
- possible values are: i386, sparc. If not set, the component will be built
- for both.
-* COMPONENT_SRC is where the archive is extracted; it has a default value of
- "$(COMPONENT_NAME)-$(COMPONENT_VERSION)".
-* COMPONENT_ARCHIVE is the base name of the archive to be downloaded; it has
- a default value of "$(COMPONENT_SRC).tar.gz".
-* COMPONENT_BUGDB is the lower-case rendering of the BugDB cat/subcat; it has
- a default value of "utility/$(COMPONENT_NAME)".
* REQUIRED_PACKAGES is a list of packages required to build or run the
component and its tests; it includes "system/library" by default.
-* GIT_REPO can be used in place of COMPONENT_ARCHIVE_URL to pull the component
- source from the GIT repository referenced in the value.
-* GIT_REV is the tag or changeset that you wish to pull from GIT.
-
-* HG_REPO can be used in place of COMPONENT_ARCHIVE_URL to pull the component
- source from the Mercurial repository referenced in the value.
-* HG_REV is the tag or changeset that you wish to pull from Mercurial.
-
-* SVN_REPO can be used in place of COMPONENT_ARCHIVE_URL to pull the component
- source from the Subversion repository referenced in the value.
-* SVN_REV is the tag or changeset that you wish to pull from Subversion.
-
The following are basic variables that must be set before including common.mk
if overriding the default:
--- a/make-rules/common.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/common.mk Thu Sep 15 11:53:59 2016 -0700
@@ -28,15 +28,6 @@
# userland components.
#
-# Assume that if no COMPONENT_ARCHIVE_URL or COMPONENT_ARCHIVE_SRC has been
-# defined that no COMPONENT_ARCHIVE exists; this allows providing a default
-# value for COMPONENT_ARCHIVE while avoiding prep errors.
-ifndef COMPONENT_ARCHIVE_URL
-ifndef COMPONENT_ARCHIVE_SRC
-COMPONENT_ARCHIVE=
-endif
-endif
-
include $(WS_MAKE_RULES)/prep.mk
# Override this to limit builds and publication to a single architecture.
--- a/make-rules/gnome-component.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/gnome-component.mk Thu Sep 15 11:53:59 2016 -0700
@@ -29,9 +29,7 @@
#
COMPONENT_PROJECT_URL ?= https://www.gnome.org/
COMPONENT_MAJOR_MINOR ?= $(basename $(COMPONENT_VERSION))
-ifndef COMPONENT_ARCHIVE_OVERRIDE
-COMPONENT_ARCHIVE = $(COMPONENT_SRC).tar.xz
-endif
+COMPONENT_ARCHIVE ?= $(COMPONENT_SRC).tar.xz
COMPONENT_ARCHIVE_URL ?= https://download.gnome.org/sources/$(COMPONENT_NAME)/$(COMPONENT_MAJOR_MINOR)/$(COMPONENT_ARCHIVE)
PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/gnome-incorporation
--- a/make-rules/prep-download.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/prep-download.mk Thu Sep 15 11:53:59 2016 -0700
@@ -37,16 +37,28 @@
# the file and signature for verification of its contents.
#
-URL_SUFFIXES = $(subst COMPONENT_ARCHIVE_URL_,, \
- $(filter COMPONENT_ARCHIVE_URL_%, $(.VARIABLES)))
+# Filter out any suffixes which correspond to auto-generated github archive
+# URLs (see prep-git.mk for the definition of GITHUB_ARCHIVE_SUFFIXES). If
+# the primary archive shouldn't be processed here, we check for it before
+# evaling.
+URL_SUFFIXES = $(filter-out $(GITHUB_ARCHIVE_SUFFIXES), \
+ $(subst COMPONENT_ARCHIVE_URL_,, \
+ $(filter COMPONENT_ARCHIVE_URL_%, $(.VARIABLES))))
-# Template for download rules.
-define download-rules
-ifdef COMPONENT_ARCHIVE_URL$(1)
-
+# Templates for download variables and rules. We separate the variable
+# assignments from the rules so that all the variable assignments are given a
+# chance to complete before those variables are used in targets or
+# prerequisites, where they'll be expanded immediately. Use ifneq/origin
+# instead of ifdef due to GNU Make bug 49093.
+define download-variables
+ifneq "$(origin COMPONENT_ARCHIVE_URL$(1))" "undefined"
ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1)) $$(notdir $$(COMPONENT_SIG_URL$(1)))
+endif
+endef
+define download-rules
+ifneq "$(origin COMPONENT_ARCHIVE_URL$(1))" "undefined"
download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ)
@@ -61,12 +73,17 @@
endif
endef
-#
-# Define the rules required to download any source archives and augment any
-# cleanup macros.
-#
-$(eval $(call download-rules,))
+# Evaluate the variable assignments immediately. If we're pulling the main
+# (unsuffixed) archive from github, gia prep-git.mk, then skip doing that here.
+# Use $(if) instead of ifeq() because the latter is evaluated immediately.
+$(if $(findstring __BLANK__,$(GITHUB_ARCHIVE_SUFFIXES)),,$(eval $(call download-variables,)))
+$(foreach suffix, $(URL_SUFFIXES), $(eval $(call download-variables,_$(suffix))))
+
+# Put the rule evaluations in a variable for deferred evaluation.
+define eval-download-rules
+$(if $(findstring __BLANK__,$(GITHUB_ARCHIVE_SUFFIXES)),,$(eval $(call download-rules,)))
$(foreach suffix, $(URL_SUFFIXES), $(eval $(call download-rules,_$(suffix))))
+endef
# Needed for signature validation of downloads
REQUIRED_PACKAGES += crypto/gnupg
--- a/make-rules/prep-git.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/prep-git.mk Thu Sep 15 11:53:59 2016 -0700
@@ -32,11 +32,15 @@
GIT_SUFFIXES = $(subst GIT_REPO_,, $(filter GIT_REPO_%, $(.VARIABLES)))
-define git-rules
+# Templates for git variables and rules. We separate the variable assignments
+# from the rules so that all the variable assignments are given a chance to
+# complete before those variables are used in targets or prerequisites, where
+# they'll be expanded immediately.
+define git-variables
ifdef GIT_REPO$(1)
ifeq ("",$(strip $(or $(GIT_BRANCH$(1)),$(GIT_COMMIT_ID$(1)))))
$$(error GIT_BRANCH$(1) and/or GIT_COMMIT_ID$(1) must be defined)
-else
+endif
ifdef GIT_BRANCH$(1)
GIT_BRANCH_ARG$(1) = -b $$(GIT_BRANCH$(1))
@@ -44,11 +48,20 @@
GIT_BRANCH_ARG$(1) = -b master
endif
-COMPONENT_SRC$(1) ?= $$(COMPONENT_NAME$(1))$$(GIT_BRANCH$(1):%=-%)$$(GIT_COMMIT_ID$(1):%=-%)
+# If the label is not already defined (including to empty), set it to the version.
+COMPONENT_LABEL$(1) ?= $$(COMPONENT_VERSION$(1))
+# The source directory is <name>-(<label>|<version>)[-(<tag>|<branch>)][-<commit].
+COMPONENT_SRC$(1) ?= $$(COMPONENT_NAME$(1))$$(COMPONENT_LABEL$(1):%=-%)$$($$(or $$(GIT_TAG$(1)),$$(GIT_BRANCH$(1))))$$(GIT_COMMIT_ID$(1):%=-%)
COMPONENT_ARCHIVE$(1) ?= $$(COMPONENT_SRC$(1)).tar.gz
-# If the source is github attempt to generate an archive url
+# If the source is github attempt to generate an archive url. Defining
+# COMPONENT_ARCHIVE_URL here messes with prep-download.mk, which keys off of
+# that variable to build download rules, so keep track of which suffixes
+# generated a github archive URL, and prep-download.mk will use that list to
+# remove those URLs. If the primary (unsuffixed) archive is from github, then
+# we add a dummy __BLANK__ suffix to the list, and filter that out separately.
ifeq (github,$(findstring github,$(GIT_REPO$(1))))
COMPONENT_ARCHIVE_URL$(1) ?= $(GIT_REPO$(1))/tarball/$(GIT_BRANCH$(1))
+ GITHUB_ARCHIVE_SUFFIXES += $(or $(strip $(1:_%=%)),__BLANK__)
else
COMPONENT_ARCHIVE_SRC$(1) = git
endif
@@ -56,7 +69,11 @@
CLEAN_PATHS += $$(COMPONENT_SRC$(1))
CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
+endif
+endef
+define git-rules
+ifdef GIT_REPO$(1)
download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
# First attempt to download a cached archive of the SCM repo at the proper
@@ -94,12 +111,14 @@
REQUIRED_PACKAGES += developer/versioning/git
endif
-endif
endef
-#
-# Define the rules required to download any source archives and augment any
-# cleanup macros.
-#
+# Evaluate the variable assignments immediately
+$(eval $(call git-variables,))
+$(foreach suffix, $(GIT_SUFFIXES), $(eval $(call git-variables,_$(suffix))))
+
+# Put the rule evaluations in a variable for deferred evaluation.
+define eval-git-rules
$(eval $(call git-rules,))
$(foreach suffix, $(GIT_SUFFIXES), $(eval $(call git-rules,_$(suffix))))
+endef
--- a/make-rules/prep-hg.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/prep-hg.mk Thu Sep 15 11:53:59 2016 -0700
@@ -32,18 +32,31 @@
HG_SUFFIXES = $(subst HG_REPO_,, $(filter HG_REPO_%, $(.VARIABLES)))
-define mercurial-rules
+# Templates for download variables and rules. We separate the variable
+# assignments from the rules so that all the variable assignments are given a
+# chance to complete before those variables are used in targets or
+# prerequisites, where they'll be expanded immediately.
+define hg-variables
ifdef HG_REPO$(1)
ifdef HG_REV$(1)
-COMPONENT_SRC$(1) = $$(COMPONENT_NAME$(1))-$(COMPONENT_VERSION)-$$(HG_REV$(1))
-COMPONENT_ARCHIVE$(1) = $$(COMPONENT_SRC$(1)).tar.bz2
+# If the label is not already defined (including to empty), set it to the version.
+COMPONENT_LABEL$(1) ?= $$(COMPONENT_VERSION$(1))
+# The source directory is <name>-(<label>|<version>)[-(<tag>|<branch>)][-<commit].
+COMPONENT_SRC$(1) ?= $$(COMPONENT_NAME$(1))$$(COMPONENT_LABEL$(1):%=-%)$$($$(or $$(HG_TAG$(1)),$$(HG_BRANCH$(1))))$$(HG_REV$(1):%=-%)
+COMPONENT_ARCHIVE$(1) ?= $$(COMPONENT_SRC$(1)).tar.gz
COMPONENT_ARCHIVE_SRC$(1) = hg
CLEAN_PATHS += $$(COMPONENT_SRC$(1))
CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
+endif
+endif
+endef
+define hg-rules
+ifdef HG_REPO$(1)
+ifdef HG_REV$(1)
download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
# First attempt to download a cached archive of the SCM repo at the proper
@@ -70,9 +83,12 @@
endif
endef
-#
-# Define the rules required to download any source archives and augment any
-# cleanup macros.
-#
-$(eval $(call mercurial-rules,))
-$(foreach suffix, $(HG_SUFFIXES), $(eval $(call mercurial-rules,_$(suffix))))
+# Evaluate the variable assignments immediately.
+$(eval $(call hg-variables,))
+$(foreach suffix, $(HG_SUFFIXES), $(eval $(call hg-variables,_$(suffix))))
+
+# Put the rule evaluations in a variable for deferred evaluation.
+define eval-hg-rules
+$(eval $(call hg-rules,))
+$(foreach suffix, $(HG_SUFFIXES), $(eval $(call hg-rules,_$(suffix))))
+endef
--- a/make-rules/prep-patch.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/prep-patch.mk Thu Sep 15 11:53:59 2016 -0700
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
#
GPATCH = /usr/gnu/bin/patch
@@ -63,7 +63,7 @@
# getting generated.
PCH_SUFFIXES = $(sort $(patsubst .patch_%,%, $(filter-out .patch,$(suffix $(PATCHES)))))
-define patch-rule
+define patch-variables
ifeq ($(1),_0)
PATCH_PATTERN$(1) ?= %.patch
@@ -78,7 +78,11 @@
ifeq ($(strip $(PARFAIT_BUILD)),yes)
PATCH_STAMPS$(1) += $$(PATCHES$(1):$(PARFAIT_PATCH_DIR)/%=$$(SOURCE_DIR$(1))/.patched-%)
endif
+endif
+endef
+define patch-rules
+ifneq ($$(PATCHES$(1)),)
# We should unpack the source that we patch before we patch it.
$$(PATCH_STAMPS$(1):: $$(UNPACK_STAMP$(1)) unpack
@@ -105,9 +109,12 @@
endif
endef
-#
-# Define the rules required to download any source archives and augment any
-# cleanup macros.
-#
-$(foreach suffix, $(PCH_SUFFIXES), $(eval $(call patch-rule,_$(suffix))))
-$(eval $(call patch-rule,)) # this must be last so we don't drop *.patch_%.
+# Evaluate the variable assignments immediately.
+$(foreach suffix, $(PCH_SUFFIXES), $(eval $(call patch-variables,_$(suffix))))
+$(eval $(call patch-variables,)) # this must be last so we don't drop *.patch_%.
+
+# Put the rule evaluations in a variable for deferred evaluation.
+define eval-patch-rules
+$(foreach suffix, $(PCH_SUFFIXES), $(eval $(call patch-rules,_$(suffix))))
+$(eval $(call patch-rules,)) # this must be last so we don't drop *.patch_%.
+endef
--- a/make-rules/prep-unpack.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/prep-unpack.mk Thu Sep 15 11:53:59 2016 -0700
@@ -27,22 +27,39 @@
#
# Anything that we downloaded and want to unpack must have a
-# COMPONENT_ARCHIVE{_[0-9]+} macro.
+# COMPONENT_ARCHIVE{_[0-9]+} macro. Filter out a handful of
+# well-known macros that don't correspond to extra archives.
+#
+PCK_SUFFIXES = $(filter-out HASH OVERRIDE SRC URL, $(subst COMPONENT_ARCHIVE_,, \
+ $(filter COMPONENT_ARCHIVE_%, $(.VARIABLES))))
+
+# Templates for unpacking variables and rules. We separate the variable
+# assignments from the rules so that all the variable assignments are given a
+# chance to complete before those variables are used in targets or
+# prerequisites, where they'll be expanded immediately.
#
-PCK_SUFFIXES = $(subst COMPONENT_ARCHIVE_,, \
- $(filter COMPONENT_ARCHIVE_%, $(.VARIABLES)))
+# Some components don't have an archive that we download, but host their source
+# directly in the repo, and a separate unpacking step will fail. So we don't do
+# any unpacking if COMPONENT_ARCHIVE_SRC is "none", and rely on such components
+# to set that variable specifically.
+#
+# The reason we don't condition on an empty COMPONENT_ARCHIVE is that any
+# components that rely on that being set by default by prep.mk won't have it set
+# for this conditional. It's easier to make the very few archive-less
+# components declare themselves rather than force everyone else to use
+# boilerplate code to name their archives.
+define unpack-variables
+ifneq ($(strip $(COMPONENT_ARCHIVE_SRC$(1))),none)
+CLEAN_PATHS += $$(COMPONENT_SRC$(1))
+SOURCE_DIR$(1) = $$(COMPONENT_SRC$(1):%=$$(COMPONENT_DIR)/%)
-# Template for unpacking rules.
+UNPACK_STAMP$(1) = $$(SOURCE_DIR$(1):%=%/.unpacked)
+endif
+endef
+
define unpack-rules
-ifneq ($(strip $(COMPONENT_ARCHIVE$(1))),)
-ifneq ($(strip $(COMPONENT_SRC$(1))),)
-
-CLEAN_PATHS += $$(COMPONENT_SRC$(1))
-SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
-
-UNPACK_STAMP$(1) = $$(SOURCE_DIR$(1))/.unpacked
-
-# RUBY_VERSION is passed on to ensure userland-unpack uses the
+ifneq ($(strip $(COMPONENT_ARCHIVE_SRC$(1))),none)
+# RUBY_VERSION is passed on to ensure userland-unpack uses the
# correct gem command for the ruby version specified
$$(UNPACK_STAMP$(1)): $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) download
$$(RM) -r $$(SOURCE_DIR$(1))
@@ -62,14 +79,15 @@
REQUIRED_PACKAGES += compress/zip
REQUIRED_PACKAGES += developer/java/jdk-8
REQUIRED_PACKAGES += runtime/ruby
-
-endif
endif
endef
-#
-# Define the rules required to download any source archives and augment any
-# cleanup macros.
-#
+# Evaluate the variable assignments immediately.
+$(eval $(call unpack-variables,))
+$(foreach suffix, $(PCK_SUFFIXES), $(eval $(call unpack-variables,_$(suffix))))
+
+# Put the rule evaluations in a variable for deferred evaluation.
+define eval-unpack-rules
$(eval $(call unpack-rules,))
$(foreach suffix, $(PCK_SUFFIXES), $(eval $(call unpack-rules,_$(suffix))))
+endef
--- a/make-rules/prep.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/prep.mk Thu Sep 15 11:53:59 2016 -0700
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
#
include $(WS_MAKE_RULES)/prep-download.mk
@@ -30,6 +30,19 @@
include $(WS_MAKE_RULES)/prep-unpack.mk
include $(WS_MAKE_RULES)/prep-patch.mk
+# Now that the above makefiles have had a chance to assign values to
+# COMPONENT_SRC and COMPONENT_ARCHIVE if they choose, we can assign some
+# reasonable defaults.
+COMPONENT_SRC ?= $(COMPONENT_SRC_NAME)-$(COMPONENT_VERSION)
+COMPONENT_ARCHIVE ?= $(COMPONENT_SRC).tar.gz
+
+$(eval $(call eval-download-rules))
+$(eval $(call eval-hg-rules))
+$(eval $(call eval-git-rules))
+$(eval $(call eval-svn-rules))
+$(eval $(call eval-unpack-rules))
+$(eval $(call eval-patch-rules))
+
download::
unpack:: download
--- a/make-rules/shared-macros.mk Thu Sep 08 17:47:13 2016 -0700
+++ b/make-rules/shared-macros.mk Thu Sep 15 11:53:59 2016 -0700
@@ -180,8 +180,6 @@
PKG_REPO = file:$(WS_REPO)
COMPONENT_SRC_NAME = $(COMPONENT_NAME)
-COMPONENT_SRC= $(COMPONENT_SRC_NAME)-$(COMPONENT_VERSION)
-COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz
# Assume a component is categorized as a utility by default.
COMPONENT_BUGDB= utility/$(COMPONENT_NAME)