Marcel Telka
2024-04-08 5d8bcb58722b250c296fc0324f9d06470fb3d7d0
commit | author | age
e28f4f 1 #
AP 2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21 # Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
22 #
23
24 FETCH =        $(WS_TOOLS)/userland-fetch
25
26 #
27 # Anything that we download must have a COMPONENT_ARCHIVE_URL{_[0-9]+} macro
28 # that tells us where the canonical source for the archive can be found.  The
29 # macro for the first archive is typically un-suffixed.  By convention,
30 # subsequent archives will include a _[0-9]+ in the macro name.  This allows
12abf9 31 # an arbitrary number of archives to be downloaded for a particular component
e28f4f 32 # Makefile.  It is also important to note that there is a corresponding
AP 33 # COMPONENT_ARCHIVE macro defining a local file name for the archive, and
34 # optional COMPONENT_ARCHIVE_HASH and COMPONENT_SIG_URL containing a hash of
35 # the file and signature for verification of its contents.
36 #
37
38 URL_SUFFIXES = $(subst COMPONENT_ARCHIVE_URL_,, \
39         $(filter COMPONENT_ARCHIVE_URL_%, $(.VARIABLES)))
40
bd7dc6 41 # Argument to "userland-fetch" script that causes it to download and verify
JK 42 # files, but not to remove mismatches; good to save traffic when initially
43 # fetching a new archive just to learn what checksum to expect in Makefile.
44 #FETCH_KEEP ?= --keep
1349f8 45 FETCH_KEEP ?=
bd7dc6 46
e28f4f 47 # Template for download rules.
AP 48 define download-rules
4841f6 49 ifdef COMPONENT_ARCHIVE$(1)
e28f4f 50 ifdef COMPONENT_ARCHIVE_URL$(1)
AP 51
52 ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
53 CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
54
bd7dc6 55 fetch::    FETCH_KEEP=--keep
JK 56 fetch::    $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
57
226430 58 download::    $$(USERLAND_ARCHIVES)
e28f4f 59 download::    $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
226430 60
e28f4f 61 $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):    $(MAKEFILE_PREREQ)
bd7dc6 62     $$(FETCH) $$(FETCH_KEEP) --file $$@ \
e28f4f 63         $$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \
AP 64         $$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) \
a9be2d 65         $$(COMPONENT_SIG_URL$(1):%=--sigurl %) \
MT 66         $$(if $$(COMPONENT_FETCH_USER_AGENT$(1)),--user-agent $$(COMPONENT_FETCH_USER_AGENT$(1)))
e28f4f 67     $$(TOUCH) $$@
AP 68
0ab2bc 69 USERLAND_REQUIRED_PACKAGES += runtime/python-39
e28f4f 70
AP 71 endif
4841f6 72 endif
e28f4f 73 endef
AP 74
4841f6 75 $(USERLAND_ARCHIVES):
MT 76     $(MKDIR) $(USERLAND_ARCHIVES)
77
e28f4f 78 #
AP 79 # Define the rules required to download any source archives and augment any
80 # cleanup macros.
81 #
82 $(eval $(call download-rules,))
83 $(foreach suffix, $(URL_SUFFIXES), $(eval $(call download-rules,_$(suffix))))
84
85 # Needed for signature validation of downloads
1349f8 86 USERLAND_REQUIRED_PACKAGES += crypto/gnupg