Revert "gcc-6: drop documentation patches"
[unleashed-userland.git] / make-rules / prep-download.mk
blob571235df3089af06a10b69a64e2935b647c1c56b
2 # CDDL HEADER START
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]
19 # CDDL HEADER END
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 abitrary 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.
44 #FETCH_KEEP ?= --keep
45 FETCH_KEEP ?=
47 # Template for download rules.
48 define download-rules
49 ifdef COMPONENT_ARCHIVE_URL$(1)
51 ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
52 CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
54 fetch:: FETCH_KEEP=--keep
55 fetch:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
57 download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
59 $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ)
60 $$(FETCH) $$(FETCH_KEEP) --file $$@ \
61 $$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \
62 $$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) \
63 $$(COMPONENT_SIG_URL$(1):%=--sigurl %) \
64 $$(if $$(COMPONENT_FETCH_USER_AGENT$(1)),--user-agent $$(COMPONENT_FETCH_USER_AGENT$(1)))
65 $$(TOUCH) $$@
67 REQUIRED_PACKAGES += runtime/python-27
69 endif
70 endef
73 # Define the rules required to download any source archives and augment any
74 # cleanup macros.
76 $(eval $(call download-rules,))
77 $(foreach suffix, $(URL_SUFFIXES), $(eval $(call download-rules,_$(suffix))))
79 # Needed for signature validation of downloads
80 REQUIRED_PACKAGES += crypto/gnupg