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.
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.
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]
21 # Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
24 FETCH
= $(WS_TOOLS
)/userland-fetch
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
31 # an arbitrary number of archives to be downloaded for a particular component
32 # Makefile. It is also important to note that there is a corresponding
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.
38 URL_SUFFIXES
= $(subst COMPONENT_ARCHIVE_URL_
,, \
39 $(filter COMPONENT_ARCHIVE_URL_
%, $(.VARIABLES
)))
41 # Argument to "userland-fetch" script that causes it to download and verify
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.
47 # Template for download rules.
49 ifdef COMPONENT_ARCHIVE
$(1)
50 ifdef COMPONENT_ARCHIVE_URL
$(1)
52 ARCHIVES
+= $$(COMPONENT_ARCHIVE
$(1))
53 CLOBBER_PATHS
+= $$(COMPONENT_ARCHIVE
$(1))
55 fetch
:: FETCH_KEEP
=--keep
56 fetch
:: $$(USERLAND_ARCHIVES
)$$(COMPONENT_ARCHIVE
$(1))
58 download
:: $$(USERLAND_ARCHIVES
)
59 download
:: $$(USERLAND_ARCHIVES
)$$(COMPONENT_ARCHIVE
$(1))
61 $$(USERLAND_ARCHIVES
)$$(COMPONENT_ARCHIVE
$(1)): $(MAKEFILE_PREREQ
)
62 $$(FETCH
) $$(FETCH_KEEP
) --file
$$@ \
63 $$(COMPONENT_ARCHIVE_URL
$(1):%=--url
%) \
64 $$(COMPONENT_ARCHIVE_HASH
$(1):%=--hash
%) \
65 $$(COMPONENT_SIG_URL
$(1):%=--sigurl
%) \
66 $$(if
$$(COMPONENT_FETCH_USER_AGENT
$(1)),--user-agent
$$(COMPONENT_FETCH_USER_AGENT
$(1)))
69 USERLAND_REQUIRED_PACKAGES
+= runtime
/python-39
76 $(MKDIR
) $(USERLAND_ARCHIVES
)
79 # Define the rules required to download any source archives and augment any
82 $(eval
$(call download-rules
,))
83 $(foreach suffix, $(URL_SUFFIXES
), $(eval
$(call download-rules
,_
$(suffix))))
85 # Needed for signature validation of downloads
86 USERLAND_REQUIRED_PACKAGES
+= crypto
/gnupg