Marcel Telka
2024-04-06 3ee8d02689a27e0e38cd6c4998db7efe50853dad
make-rules/prep-download.mk
@@ -28,7 +28,7 @@
# that tells us where the canonical source for the archive can be found.  The
# macro for the first archive is typically un-suffixed.  By convention,
# subsequent archives will include a _[0-9]+ in the macro name.  This allows
# an abitrary number of archives to be downloaded for a particular component
# an arbitrary number of archives to be downloaded for a particular component
# Makefile.  It is also important to note that there is a corresponding
# COMPONENT_ARCHIVE macro defining a local file name for the archive, and
# optional COMPONENT_ARCHIVE_HASH and COMPONENT_SIG_URL containing a hash of
@@ -38,26 +38,42 @@
URL_SUFFIXES = $(subst COMPONENT_ARCHIVE_URL_,, \
      $(filter COMPONENT_ARCHIVE_URL_%, $(.VARIABLES)))
# Argument to "userland-fetch" script that causes it to download and verify
# files, but not to remove mismatches; good to save traffic when initially
# fetching a new archive just to learn what checksum to expect in Makefile.
#FETCH_KEEP ?= --keep
FETCH_KEEP ?=
# Template for download rules.
define download-rules
ifdef COMPONENT_ARCHIVE$(1)
ifdef COMPONENT_ARCHIVE_URL$(1)
ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
fetch::   FETCH_KEEP=--keep
fetch::   $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
download::   $$(USERLAND_ARCHIVES)
download::   $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):   $(MAKEFILE_PREREQ)
   $$(FETCH) --file $$@ \
   $$(FETCH) $$(FETCH_KEEP) --file $$@ \
      $$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \
      $$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) \
      $$(COMPONENT_SIG_URL$(1):%=--sigurl %)
      $$(COMPONENT_SIG_URL$(1):%=--sigurl %) \
      $$(if $$(COMPONENT_FETCH_USER_AGENT$(1)),--user-agent $$(COMPONENT_FETCH_USER_AGENT$(1)))
   $$(TOUCH) $$@
REQUIRED_PACKAGES += runtime/python-26
USERLAND_REQUIRED_PACKAGES += runtime/python-39
endif
endif
endef
$(USERLAND_ARCHIVES):
   $(MKDIR) $(USERLAND_ARCHIVES)
#
# Define the rules required to download any source archives and augment any
@@ -67,4 +83,4 @@
$(foreach suffix, $(URL_SUFFIXES), $(eval $(call download-rules,_$(suffix))))
# Needed for signature validation of downloads
REQUIRED_PACKAGES += crypto/gnupg
USERLAND_REQUIRED_PACKAGES += crypto/gnupg