commit | author | age
|
ad4deb
|
1 |
# |
CG |
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 |
|
|
22 |
# |
|
23 |
# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. |
|
24 |
# |
|
25 |
|
|
26 |
SVN = /usr/bin/svn |
|
27 |
MKTEMP = /usr/gnu/bin/mktemp |
|
28 |
|
6236b5
|
29 |
COMPONENT_PREP_SVN?=yes |
AL |
30 |
ifeq ($(strip $(COMPONENT_PREP_SVN)), yes) |
|
31 |
|
ad4deb
|
32 |
# |
CG |
33 |
# Anything that we pull from a Subversion repo must have a SVN_REPO{_[0-9]+} and |
|
34 |
# SVN_REV{_[0-9]+} to match. |
|
35 |
# |
|
36 |
|
|
37 |
SVN_SUFFIXES = $(subst SVN_REPO_,, $(filter SVN_REPO_%, $(.VARIABLES))) |
|
38 |
|
|
39 |
define subversion-rules |
|
40 |
ifdef SVN_REPO$(1) |
|
41 |
ifdef SVN_REV$(1) |
|
42 |
|
|
43 |
COMPONENT_SRC$(1) = $$(COMPONENT_NAME$(1))-$$(SVN_REV$(1)) |
|
44 |
COMPONENT_ARCHIVE$(1) = $$(COMPONENT_SRC$(1)).tar.bz2 |
|
45 |
COMPONENT_ARCHIVE_SRC$(1) = svn |
|
46 |
|
|
47 |
CLEAN_PATHS += $$(COMPONENT_SRC$(1)) |
|
48 |
CLOBBER_PATHS += COMPONENT_ARCHIVE$(1) |
ca8acb
|
49 |
SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$$(COMPONENT_SRC$(1)) |
ad4deb
|
50 |
|
CG |
51 |
download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) |
|
52 |
|
|
53 |
# First attempt to download a cached archive of the SCM repo at the proper |
|
54 |
# changeset ID. If that fails, create an archive by cloning the SCM repo, |
|
55 |
# updating to the selected changeset, archiving that directory, and cleaning up # when complete. |
|
56 |
$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ) |
|
57 |
$$(FETCH) --file $$@ $$(SVN_HASH$(1):%=--hash %) --url SVN || \ |
|
58 |
(TMP_REPO=$$$$($(MKTEMP) --directory --dry-run) && \ |
|
59 |
$(SVN) export $$(SVN_REPO$(1)) $$(SVN_REV$(1):%=--revision %) \ |
|
60 |
$$$${TMP_REPO} && \ |
|
61 |
/usr/gnu/bin/tar --create --file - --absolute-names \ |
0232a2
|
62 |
--sort=name --mtime="2018-10-05 00:00Z" --owner=0 --group=0 --numeric-owner \ |
ad4deb
|
63 |
--transform="s;$$$${TMP_REPO};$$(COMPONENT_SRC$(1));g" \ |
CG |
64 |
--bzip2 $$$${TMP_REPO} >$$@ && \ |
|
65 |
$(RM) -rf $$$${TMP_REPO} && \ |
|
66 |
SVN_HASH=$$$$(digest -a sha256 $$@) && \ |
|
67 |
$(GSED) -i \ |
|
68 |
-e "s/^SVN_HASH$(1)=.*/SVN_HASH$(1)= sha256:$$$${SVN_HASH}/" \ |
|
69 |
Makefile) |
|
70 |
|
1349f8
|
71 |
USERLAND_REQUIRED_PACKAGES += developer/versioning/subversion |
ad4deb
|
72 |
|
CG |
73 |
endif |
|
74 |
endif |
|
75 |
endef |
|
76 |
|
|
77 |
# |
|
78 |
# Define the rules required to download any source archives and augment any |
|
79 |
# cleanup macros. |
|
80 |
# |
|
81 |
$(eval $(call subversion-rules,)) |
|
82 |
$(foreach suffix, $(SVN_SUFFIXES), $(eval $(call subversion-rules,_$(suffix)))) |
|
83 |
|
6236b5
|
84 |
endif |