make-rules/prep-hg.mk
author Misaki Miyashita <Misaki.Miyashita@Oracle.COM>
Thu, 13 Oct 2016 14:47:30 -0700
changeset 7103 398c9d0ab0f3
parent 6951 deaf66c90a34
permissions -rw-r--r--
24588300 OpenSSL FIPS work based on 1.0.2 for Oracle Solaris: Phase I 20800792 openssl-1.0.1-fips-140: using obsolete -xarch option
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
#
5682
94c0ca64c022 15558602 TCL_LD_SEARCH_FLAGS is wrongly defined in tclConfig.sh
Shawn Walker-Salas <shawn.walker@oracle.com>
parents: 4358
diff changeset
    21
94c0ca64c022 15558602 TCL_LD_SEARCH_FLAGS is wrongly defined in tclConfig.sh
Shawn Walker-Salas <shawn.walker@oracle.com>
parents: 4358
diff changeset
    22
#
94c0ca64c022 15558602 TCL_LD_SEARCH_FLAGS is wrongly defined in tclConfig.sh
Shawn Walker-Salas <shawn.walker@oracle.com>
parents: 4358
diff changeset
    23
# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
4196
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    24
#
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
HG =		/usr/bin/hg
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    27
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    28
#
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    29
# Anything that we pull from a Mercurial repo must have a HG_REPO{_[0-9]+} and
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    30
# HG_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
    31
#
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    32
4251
2bf7e2c1ca74 21029374 probably shouldn't overload TMP_SUFFIXES in userland fragments
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents: 4196
diff changeset
    33
HG_SUFFIXES = $(subst HG_REPO_,, $(filter HG_REPO_%, $(.VARIABLES)))
4196
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    34
6911
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    35
# Templates for download variables and rules.  We separate the variable
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    36
# assignments from the rules so that all the variable assignments are given a
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    37
# chance to complete before those variables are used in targets or
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    38
# prerequisites, where they'll be expanded immediately.
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    39
define hg-variables
4196
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    40
ifdef HG_REPO$(1)
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    41
ifdef HG_REV$(1)
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    42
6911
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    43
# If the label is not already defined (including to empty), set it to the version.
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    44
COMPONENT_LABEL$(1) ?= $$(COMPONENT_VERSION$(1))
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    45
# The source directory is <name>-(<label>|<version>)[-(<tag>|<branch>)][-<commit].
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    46
COMPONENT_SRC$(1) ?= $$(COMPONENT_NAME$(1))$$(COMPONENT_LABEL$(1):%=-%)$$($$(or $$(HG_TAG$(1)),$$(HG_BRANCH$(1))))$$(HG_REV$(1):%=-%)
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    47
COMPONENT_ARCHIVE$(1) ?= $$(COMPONENT_SRC$(1)).tar.gz
5682
94c0ca64c022 15558602 TCL_LD_SEARCH_FLAGS is wrongly defined in tclConfig.sh
Shawn Walker-Salas <shawn.walker@oracle.com>
parents: 4358
diff changeset
    48
COMPONENT_ARCHIVE_SRC$(1) = hg
4196
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    49
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    50
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
    51
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
    52
SOURCE_DIR$(1) = $$(COMPONENT_DIR)/$(COMPONENT_SRC$(1))
6911
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    53
endif
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    54
endif
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    55
endef
4196
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    56
6911
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    57
define hg-rules
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    58
ifdef HG_REPO$(1)
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    59
ifdef HG_REV$(1)
4196
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    60
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
    61
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    62
# 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
    63
# 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
    64
# updating to the selected changeset, archiving that directory, and cleaning up
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    65
# when complete.
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    66
$$(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
    67
	$$(FETCH) --file $$@ $$(HG_HASH$(1):%=--hash %) || \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    68
	(TMP_REPO=$$$$(mktemp --directory) && \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    69
	 $(HG) clone $$(HG_REPO$(1)) $$(HG_REV$(1):%=--rev %) \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    70
		 $$(HG_REV$(1):%=--updaterev %) \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    71
		 $$(HG_BRANCH$(1):%=--branch %) \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    72
		    $$$${TMP_REPO} && \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    73
	 $(HG) -R $$$${TMP_REPO} archive --prefix $$(COMPONENT_SRC$(1)) $$@ && \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    74
	 $(RM) -rf $${TMP_REPO} && \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    75
	 HG_HASH=$$$$(digest -a sha256 $$@) && \
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    76
	 $(GSED) -i \
6951
deaf66c90a34 24676059 {GIT,HG}_HASH lines not replaced properly
Danek Duvall <danek.duvall@oracle.com>
parents: 6911
diff changeset
    77
		-e "s/\(HG_HASH$(1)[[:space:]]*=[[:space:]]*\).*/\1sha256:$$$${HG_HASH}/" \
4196
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    78
		Makefile)
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    79
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    80
REQUIRED_PACKAGES += developer/versioning/mercurial
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    81
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    82
endif
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    83
endif
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    84
endef
d697072a92f5 19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    85
6911
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    86
# Evaluate the variable assignments immediately.
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    87
$(eval $(call hg-variables,))
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    88
$(foreach suffix, $(HG_SUFFIXES), $(eval $(call hg-variables,_$(suffix))))
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    89
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    90
# Put the rule evaluations in a variable for deferred evaluation.
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    91
define eval-hg-rules
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    92
$(eval $(call hg-rules,))
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    93
$(foreach suffix, $(HG_SUFFIXES), $(eval $(call hg-rules,_$(suffix))))
7b878dfe6f0d 24661161 COMPONENT_SRC and COMPONENT_ARCHIVE are un-overridable in prep-*.mk
Danek Duvall <danek.duvall@oracle.com>
parents: 5682
diff changeset
    94
endef