author | Lukas Rovensky <Lukas.Rovensky@oracle.com> |
Fri, 16 Oct 2015 04:21:46 -0700 | |
changeset 4951 | 8ac3d1ff666a |
parent 4358 | 76306610179e |
child 5682 | 94c0ca64c022 |
permissions | -rw-r--r-- |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
1 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
2 |
# CDDL HEADER START |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
3 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
4 |
# The contents of this file are subject to the terms of the |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
5 |
# Common Development and Distribution License (the "License"). |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
6 |
# You may not use this file except in compliance with the License. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
7 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
8 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
9 |
# or http://www.opensolaris.org/os/licensing. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
10 |
# See the License for the specific language governing permissions |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
11 |
# and limitations under the License. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
12 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
13 |
# When distributing Covered Code, include this CDDL HEADER in each |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
14 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
15 |
# If applicable, add the following below this CDDL HEADER, with the |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
16 |
# fields enclosed by brackets "[]" replaced with your own identifying |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
17 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
18 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
19 |
# CDDL HEADER END |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
20 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
21 |
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
22 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
23 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
24 |
SVN = /usr/bin/svn |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
25 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
26 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
27 |
# Anything that we pull from a Subversion repo must have a SVN_REPO{_[0-9]+} and |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
28 |
# SVN_REV{_[0-9]+} to match. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
29 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
30 |
|
4251
2bf7e2c1ca74
21029374 probably shouldn't overload TMP_SUFFIXES in userland fragments
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4196
diff
changeset
|
31 |
SVN_SUFFIXES = $(subst SVN_REPO_,, $(filter SVN_REPO_%, $(.VARIABLES))) |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
32 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
33 |
define subversion-rules |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
34 |
ifdef SVN_REPO$(1) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
35 |
ifdef SVN_REV$(1) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
36 |
|
4358
76306610179e
21137323 Userland git/hg/svn support overwrites achives for multiple sources.
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4251
diff
changeset
|
37 |
COMPONENT_SRC$(1) = $$(COMPONENT_NAME$(1))-$$(SVN_REV$(1)) |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
38 |
COMPONENT_ARCHIVE$(1) = $$(COMPONENT_SRC$(1)).tar.bz2 |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
39 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
40 |
CLEAN_PATHS += $$(COMPONENT_SRC$(1)) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
41 |
CLOBBER_PATHS += COMPONENT_ARCHIVE$(1) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
42 |
SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1)) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
43 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
44 |
download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
45 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
46 |
# First attempt to download a cached archive of the SCM repo at the proper |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
47 |
# changeset ID. If that fails, create an archive by cloning the SCM repo, |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
48 |
# updating to the selected changeset, archiving that directory, and cleaning up # when complete. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
49 |
$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)): $(MAKEFILE_PREREQ) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
50 |
$$(FETCH) --file $$@ $$(SVN_HASH$(1):%=--hash %) || \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
51 |
(TMP_REPO=$$$$(mktemp --directory --dry-run) && \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
52 |
$(SVN) export $$(SVN_REPO$(1)) $$(SVN_REV$(1):%=--revision %) \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
53 |
$$$${TMP_REPO} && \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
54 |
/usr/gnu/bin/tar --create --file - --absolute-names \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
55 |
--transform="s;$$$${TMP_REPO};$$(COMPONENT_SRC$(1));g" \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
56 |
--bzip2 $$$${TMP_REPO} >$$@ && \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
57 |
$(RM) -rf $$$${TMP_REPO} && \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
58 |
SVN_HASH=$$$$(digest -a sha256 $$@) && \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
59 |
$(GSED) -i \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
60 |
-e "s/^SVN_HASH$(1)=.*/SVN_HASH$(1)= sha256:$$$${SVN_HASH}/" \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
61 |
Makefile) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
62 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
63 |
REQUIRED_PACKAGES += developer/versioning/subversion |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
64 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
65 |
endif |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
66 |
endif |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
67 |
endef |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
68 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
69 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
70 |
# Define the rules required to download any source archives and augment any |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
71 |
# cleanup macros. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
72 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
73 |
$(eval $(call subversion-rules,)) |
4251
2bf7e2c1ca74
21029374 probably shouldn't overload TMP_SUFFIXES in userland fragments
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4196
diff
changeset
|
74 |
$(foreach suffix, $(SVN_SUFFIXES), $(eval $(call subversion-rules,_$(suffix)))) |