xcompmgr: update to 1.1.10
[oi-userland.git] / make-rules / prep-svn.mk
blob5a53bfe1fa0ebdc13d4bc714295240be6a7cfee8
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
23 # Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
26 SVN = /usr/bin/svn
27 MKTEMP = /usr/gnu/bin/mktemp
29 COMPONENT_PREP_SVN?=yes
30 ifeq ($(strip $(COMPONENT_PREP_SVN)), yes)
33 # Anything that we pull from a Subversion repo must have a SVN_REPO{_[0-9]+} and
34 # SVN_REV{_[0-9]+} to match.
37 SVN_SUFFIXES = $(subst SVN_REPO_,, $(filter SVN_REPO_%, $(.VARIABLES)))
39 define subversion-rules
40 ifdef SVN_REPO$(1)
41 ifdef SVN_REV$(1)
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
47 CLEAN_PATHS += $$(COMPONENT_SRC$(1))
48 CLOBBER_PATHS += COMPONENT_ARCHIVE$(1)
49 SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$$(COMPONENT_SRC$(1))
51 download:: $$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1))
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 \
62 --sort=name --mtime="2018-10-05 00:00Z" --owner=0 --group=0 --numeric-owner \
63 --transform="s;$$$${TMP_REPO};$$(COMPONENT_SRC$(1));g" \
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)
71 USERLAND_REQUIRED_PACKAGES += developer/versioning/subversion
73 endif
74 endif
75 endef
78 # Define the rules required to download any source archives and augment any
79 # cleanup macros.
81 $(eval $(call subversion-rules,))
82 $(foreach suffix, $(SVN_SUFFIXES), $(eval $(call subversion-rules,_$(suffix))))
84 endif