|
1 # |
|
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 |
|
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. |
|
36 # |
|
37 |
|
38 TMP_SUFFIXES = $(subst COMPONENT_ARCHIVE_URL_,, \ |
|
39 $(filter COMPONENT_ARCHIVE_URL_%, $(.VARIABLES))) |
|
40 |
|
41 # Template for download rules. |
|
42 define download-rules |
|
43 ifdef COMPONENT_ARCHIVE_URL$(1) |
|
44 |
|
45 ARCHIVES += $$(COMPONENT_ARCHIVE$(1)) |
|
46 CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1)) |
|
47 |
|
48 download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) |
|
49 |
|
50 $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ) |
|
51 $$(FETCH) --file $$@ \ |
|
52 $$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \ |
|
53 $$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) \ |
|
54 $$(COMPONENT_SIG_URL$(1):%=--sigurl %) |
|
55 $$(TOUCH) $$@ |
|
56 |
|
57 REQUIRED_PACKAGES += runtime/python-27 |
|
58 |
|
59 endif |
|
60 endef |
|
61 |
|
62 # |
|
63 # Define the rules required to download any source archives and augment any |
|
64 # cleanup macros. |
|
65 # |
|
66 $(eval $(call download-rules,)) |
|
67 $(foreach suffix, $(TMP_SUFFIXES), $(eval $(call download-rules,_$(suffix)))) |