Makefile revision 0ea64585698b885134cf212069f5ff7ebda376a6
88f76f668542dcd72fc9d71577997967c6bf123bslive#
d24d4c5159bcb11c25bb294926cfe7105c789ea9slive# CDDL HEADER START
e942c741056732f50da2074b36fe59805d370650slive#
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd# The contents of this file are subject to the terms of the
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd# Common Development and Distribution License (the "License").
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd# You may not use this file except in compliance with the License.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding#
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# or http://www.opensolaris.org/os/licensing.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# See the License for the specific language governing permissions
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# and limitations under the License.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding#
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd# When distributing Covered Code, include this CDDL HEADER in each
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd# If applicable, add the following below this CDDL HEADER, with the
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd# fields enclosed by brackets "[]" replaced with your own identifying
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd# information: Portions Copyright [yyyy] [name of copyright owner]
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd#
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd# CDDL HEADER END
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd#
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd#
7db9f691a00ead175b03335457ca296a33ddf31bnd# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
88f76f668542dcd72fc9d71577997967c6bf123bslive# Use is subject to license terms.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive
88f76f668542dcd72fc9d71577997967c6bf123bsliveinclude $(SRC)/Makefile.master
88f76f668542dcd72fc9d71577997967c6bf123bsliveinclude $(SRC)/Makefile.buildnum
88f76f668542dcd72fc9d71577997967c6bf123bslive
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Make sure we're getting a consistent execution environment for the
88f76f668542dcd72fc9d71577997967c6bf123bslive# embedded scripts.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bsliveSHELL= /usr/bin/ksh93
88f76f668542dcd72fc9d71577997967c6bf123bslive
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# On non-OpenSolaris systems, the fallback to the build system to
88f76f668542dcd72fc9d71577997967c6bf123bslive# satisfy interconsolidation dependencies won't work. To avoid that
88f76f668542dcd72fc9d71577997967c6bf123bslive# pitfall, disable package dependency generation on such systems.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# For any OpenSolaris system, SUNWcs should be installed, and is not
88f76f668542dcd72fc9d71577997967c6bf123bslive# expected to be renamed soon.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# To suppress package dependency generation on any system, regardless
88f76f668542dcd72fc9d71577997967c6bf123bslive# of how it was installed, set SUPPRESSPKGDEP=true in the build
88f76f668542dcd72fc9d71577997967c6bf123bslive# environment.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bsliveSUPPRESSPKGDEP :sh= \
ed213de6d7481be782a20ecc2675bc57fd4fac69slive tdir=`mktemp -d`; \
ed213de6d7481be782a20ecc2675bc57fd4fac69slive PKG_CACHEDIR=$tdir pkg list SUNWcs > /dev/null 2>&1; \
ed213de6d7481be782a20ecc2675bc57fd4fac69slive if [ $? -ne 0 ]; then \
ed213de6d7481be782a20ecc2675bc57fd4fac69slive print "true"; \
ed213de6d7481be782a20ecc2675bc57fd4fac69slive else \
ed213de6d7481be782a20ecc2675bc57fd4fac69slive print "false"; \
88f76f668542dcd72fc9d71577997967c6bf123bslive fi; rm -rf $tdir
88f76f668542dcd72fc9d71577997967c6bf123bslive
38677582e6ddf26e810728a68cbe560345486e48slive#
38677582e6ddf26e810728a68cbe560345486e48slive# Comment this line out or set "PKGDEBUG=" in your build environment
38677582e6ddf26e810728a68cbe560345486e48slive# to get more verbose output from the make processes in usr/src/pkg
7647551a51db086eef1f5b651b2d6f174dffb8b3slive#
7647551a51db086eef1f5b651b2d6f174dffb8b3slivePKGDEBUG= @
0222f4c188bbd414e293e0b78a8e350e3054322anilgun
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# Cross platform packaging notes
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# By default, we package the proto area from the same architecture as
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# the packaging build. In other words, if you're running nightly or
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# bldenv on an x86 platform, it will take objects from the x86 proto
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# area and use them to create x86 repositories.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# If you want to create repositories for an architecture that's
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# different from $(uname -p), you do so by setting PKGMACH in your
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# build environment.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# For this to work correctly, the following must all happen:
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# 1. You need the desired proto area, which you can get either by
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# doing a gatekeeper-style build with the -U option to
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# nightly(1), or by using rsync. If you don't do this, you will
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# get packaging failures building all packages, because pkgsend
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# is unable to find the required binaries.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# 2. You need the desired tools proto area, which you can get in the
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# same ways as the normal proto area. If you don't do this, you
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# will get packaging failures building SUNWonbld, because pkgsend is
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# unable to find the tools binaries.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# 3. You need to have built the appropriate third party license
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# files in $SRC, which generally means you should override SRC in
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# your build environment. If you don't do this, you will get
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# packaging failures because pkgsend is unable to find various
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# THIRDPARTYLICENSE files.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# 4. The remainder of this Makefile should never refer directly to
7647551a51db086eef1f5b651b2d6f174dffb8b3slive# $(MACH). Instead, $(PKGMACH) should be used whenever an
7647551a51db086eef1f5b651b2d6f174dffb8b3slive# architecture-specific path or token is needed. If this is done
7647551a51db086eef1f5b651b2d6f174dffb8b3slive# incorrectly, then packaging will fail, and you will see the
88f76f668542dcd72fc9d71577997967c6bf123bslive# value of $(uname -p) instead of the value of $(PKGMACH) in the
88f76f668542dcd72fc9d71577997967c6bf123bslive# commands that fail.
88f76f668542dcd72fc9d71577997967c6bf123bslive# 5. Each time a rule in this Makefile invokes $(MAKE), it should
67a715b4352c3e25bff32fccad48350180393f5end# pass PKGMACH=$(PKGMACH) explicitly on the command line. If
67a715b4352c3e25bff32fccad48350180393f5end# this is done incorrectly, then packaging will fail, and you
88f76f668542dcd72fc9d71577997967c6bf123bslive# will see the value of $(uname -p) instead of the value of
88f76f668542dcd72fc9d71577997967c6bf123bslive# $(PKGMACH) in the commands that fail.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Refer also to the convenience targets defined later in this
88f76f668542dcd72fc9d71577997967c6bf123bslive# Makefile.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
0222f4c188bbd414e293e0b78a8e350e3054322anilgunPKGMACH= $(MACH)
88f76f668542dcd72fc9d71577997967c6bf123bslive
67a715b4352c3e25bff32fccad48350180393f5end#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# ROOT, TOOLS_PROTO, and PKGARCHIVE should be set by nightly or
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# bldenv. These macros translate them into terms of $PKGMACH, instead
aa997d6b651a6ac262d708b7f807a080d57c3844slive# of $ARCH.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
67a715b4352c3e25bff32fccad48350180393f5endPKGROOT.cmd= print $(ROOT) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
67a715b4352c3e25bff32fccad48350180393f5endPKGROOT= $(PKGROOT.cmd:sh)
67a715b4352c3e25bff32fccad48350180393f5endTOOLSROOT.cmd= print $(TOOLS_PROTO) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
88f76f668542dcd72fc9d71577997967c6bf123bsliveTOOLSROOT= $(TOOLSROOT.cmd:sh)
0222f4c188bbd414e293e0b78a8e350e3054322anilgunPKGDEST.cmd= print $(PKGARCHIVE) | sed -e s:/$(MACH)/:/$(PKGMACH)/:
0222f4c188bbd414e293e0b78a8e350e3054322anilgunPKGDEST= $(PKGDEST.cmd:sh)
0222f4c188bbd414e293e0b78a8e350e3054322anilgun
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# The publish transforms, EXCEPTIONS list, and some manifests need to
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# know when we're building open-only and when we're using internal
88f76f668542dcd72fc9d71577997967c6bf123bslive# crypto bits.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
67a715b4352c3e25bff32fccad48350180393f5end# We only use internal crypto when we're doing a closed build, the
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# CODESIGN_USER env variable is not set, and ON_CRYPTO_BINS is not set.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# This matches the conditions under which the internal key and cert
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# are needed for the packaged objects.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# We use X_FLAG, as exported by nightly and bldenv, to decide when we
88f76f668542dcd72fc9d71577997967c6bf123bslive# need IHV-related exceptions for protocmp.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
0dd298aa254f43fc223b1cc41e79d4a1fec308bcnd$(CLOSED_BUILD)OPEN_ONLY_BUILD= $(POUND_SIGN)
0dd298aa254f43fc223b1cc41e79d4a1fec308bcnd
0dd298aa254f43fc223b1cc41e79d4a1fec308bcndUSE_INTERNAL_CRYPTO= $(POUND_SIGN)
88f76f668542dcd72fc9d71577997967c6bf123bsliveUI1= $(CODESIGN_USER:%=$(POUND_SIGN))
0dd298aa254f43fc223b1cc41e79d4a1fec308bcnd$(UI1)UI2= $(ON_CRYPTO_BINS:%=$(POUND_SIGN))
88f76f668542dcd72fc9d71577997967c6bf123bslive$(CLOSED_BUILD)USE_INTERNAL_CRYPTO= $(UI1)$(UI2)
88f76f668542dcd72fc9d71577997967c6bf123bsliveUSE_SIGNED_CRYPTO=
88f76f668542dcd72fc9d71577997967c6bf123bslive$(USE_INTERNAL_CRYPTO)USE_SIGNED_CRYPTO= $(POUND_SIGN)
0287d5784a0533920978a7eb8f3cdeace17b467arbowen
0287d5784a0533920978a7eb8f3cdeace17b467arbowenX_FLAG= n
52ebee778263c25c1b366f5e296d3f973fcb7abandIHV_COPY_BUILD1= $(X_FLAG:n%=$(POUND_SIGN)%)
0287d5784a0533920978a7eb8f3cdeace17b467arbowenIHV_COPY_BUILD= $(IHV_COPY_BUILD1:y%=%)
0287d5784a0533920978a7eb8f3cdeace17b467arbowen
0287d5784a0533920978a7eb8f3cdeace17b467arbowen
2348633f2de9e8a3228db792f189d8b6ffdfdafandEXCEPTIONS= packaging
2348633f2de9e8a3228db792f189d8b6ffdfdafand$(CLOSED_BUILD)EXCEPTIONS += packaging.closed
2348633f2de9e8a3228db792f189d8b6ffdfdafand$(OPEN_ONLY_BUILD)EXCEPTIONS += packaging.open
ca908c21f63a71c5efa7d32bd2cfafe9a42ba1fbrbowen$(IHV_COPY_BUILD)EXCEPTIONS += packaging.ihv
2348633f2de9e8a3228db792f189d8b6ffdfdafand
0287d5784a0533920978a7eb8f3cdeace17b467arbowenPKGMOGRIFY= pkgmogrify
0287d5784a0533920978a7eb8f3cdeace17b467arbowen
0287d5784a0533920978a7eb8f3cdeace17b467arbowen#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Always build the redistributable repository, but only build the
88f76f668542dcd72fc9d71577997967c6bf123bslive# nonredistributable bits if we have access to closed source.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Some objects that result from the closed build are still
88f76f668542dcd72fc9d71577997967c6bf123bslive# redistributable, and should be packaged as part of an open-only
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# build. Access to those objects is provided via the closed-bins
88f76f668542dcd72fc9d71577997967c6bf123bslive# tarball. See usr/src/tools/scripts/bindrop.sh for details.
67a715b4352c3e25bff32fccad48350180393f5end#
67a715b4352c3e25bff32fccad48350180393f5endREPOS= redist
88f76f668542dcd72fc9d71577997967c6bf123bslive$(CLOSED_BUILD)REPOS += extra
88f76f668542dcd72fc9d71577997967c6bf123bslive
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# The packages directory will contain the processed manifests as
88f76f668542dcd72fc9d71577997967c6bf123bslive# direct build targets and subdirectories for package metadata extracted
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# incidentally during manifest processing.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
030108b1816bcda3d925df65357feabdce83bc94slive# Nothing underneath $(PDIR) should ever be managed by SCM.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslivePDIR= packages.$(PKGMACH)
88f76f668542dcd72fc9d71577997967c6bf123bslive
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# The tools proto must be specified for dependency generation.
67a715b4352c3e25bff32fccad48350180393f5end# Publication from the tools proto area is managed in the
67a715b4352c3e25bff32fccad48350180393f5end# publication rule.
67a715b4352c3e25bff32fccad48350180393f5end#
67a715b4352c3e25bff32fccad48350180393f5end$(PDIR)/SUNWonbld.dep:= PKGROOT= $(TOOLSROOT)
aa997d6b651a6ac262d708b7f807a080d57c3844slive
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirierPKGPUBLISHER= $(PKGPUBLISHER_REDIST)
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier$(PKGDEST)/repo.extra:= PKGPUBLISHER= $(PKGPUBLISHER_NONREDIST)
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier
aa997d6b651a6ac262d708b7f807a080d57c3844slive#
aa997d6b651a6ac262d708b7f807a080d57c3844slive# To get these defaults, manifests should simply refer to $(PKGVERS).
aa997d6b651a6ac262d708b7f807a080d57c3844slive#
aa997d6b651a6ac262d708b7f807a080d57c3844slivePKGVERS_COMPONENT= 0.$(RELEASE)
aa997d6b651a6ac262d708b7f807a080d57c3844slivePKGVERS_BUILTON= $(RELEASE)
aa997d6b651a6ac262d708b7f807a080d57c3844slivePKGVERS_BRANCH= 0.$(ONNV_BUILDNUM)
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirierPKGVERS= $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH)
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# The ARCH32 and ARCH64 macros are used in the manifests to express
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# architecture-specific subdirectories in the installation paths
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# for isaexec'd commands.
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# We can't simply use $(MACH32) and $(MACH64) here, because they're
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# only defined for the build architecture. To do cross-platform
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# packaging, we need both values.
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirieri386_ARCH32= i86
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoiriersparc_ARCH32= sparcv7
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirieri386_ARCH64= amd64
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoiriersparc_ARCH64= sparcv9
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# macros and transforms needed by pkgmogrify
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# If you append to this list using target-specific assignments (:=),
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# be very careful that the targets are of the form $(PDIR)/pkgname. If
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# you use a higher level target, or a package list, you'll trigger a
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# complete reprocessing of all manifests because they'll fail command
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# dependency checking.
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirierPM_TRANSFORMS= publish restart_fmri defaults extract_metadata
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirierPM_INC= transforms
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirierPKGMOG_DEFINES= \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier i386_ONLY=$(POUND_SIGN) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier sparc_ONLY=$(POUND_SIGN) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier $(PKGMACH)_ONLY= \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier ARCH=$(PKGMACH) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier ARCH32=$($(PKGMACH)_ARCH32) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier ARCH64=$($(PKGMACH)_ARCH64) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier PKGVERS_BUILTON=$(PKGVERS_BUILTON) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier PKGVERS_BRANCH=$(PKGVERS_BRANCH) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier PKGVERS=$(PKGVERS) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier SRC=$(SRC) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier CLOSED_BUILD=$(CLOSED_BUILD) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier OPEN_BUILD=$(OPEN_ONLY_BUILD) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier USE_INTERNAL_CRYPTO=$(USE_INTERNAL_CRYPTO) \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier USE_SIGNED_CRYPTO=$(USE_SIGNED_CRYPTO)
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirierPKGDEP_TOKENS_i386= \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier 'PLATFORM=i86hvm' \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier 'PLATFORM=i86pc' \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier 'PLATFORM=i86xpv' \
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier 'ISALIST=amd64' \
88f76f668542dcd72fc9d71577997967c6bf123bslive 'ISALIST=i386'
88f76f668542dcd72fc9d71577997967c6bf123bslivePKGDEP_TOKENS_sparc= \
88f76f668542dcd72fc9d71577997967c6bf123bslive 'PLATFORM=sun4u' \
88f76f668542dcd72fc9d71577997967c6bf123bslive 'PLATFORM=sun4v' \
88f76f668542dcd72fc9d71577997967c6bf123bslive 'ISALIST=sparcv9' \
88f76f668542dcd72fc9d71577997967c6bf123bslive 'ISALIST=sparc'
88f76f668542dcd72fc9d71577997967c6bf123bslivePKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH))
67a715b4352c3e25bff32fccad48350180393f5end
67a715b4352c3e25bff32fccad48350180393f5end#
88f76f668542dcd72fc9d71577997967c6bf123bslive# The package lists are generated with $(PKGDEP_TYPE) as their
88f76f668542dcd72fc9d71577997967c6bf123bslive# dependency types, so that they can be included by either an
88f76f668542dcd72fc9d71577997967c6bf123bslive# incorporation or a group package.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive$(PDIR)/osnet-redist.mog $(PDIR)/osnet-extra.mog:= PKGDEP_TYPE= require
82fedb7a2164fa01fe2870f080aeac6344503148slive$(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate
82fedb7a2164fa01fe2870f080aeac6344503148slive
82fedb7a2164fa01fe2870f080aeac6344503148slivePKGDEP_INCORP= \
aa997d6b651a6ac262d708b7f807a080d57c3844slive depend fmri=consolidation/osnet/osnet-incorporation type=require
e32abf00422bf50d92c28c448f60b951c8fa42earbowen
e32abf00422bf50d92c28c448f60b951c8fa42earbowen#
e32abf00422bf50d92c28c448f60b951c8fa42earbowen# All packaging build products should go into $(PDIR), so they don't
e32abf00422bf50d92c28c448f60b951c8fa42earbowen# need to be included separately in CLOBBERFILES.
e32abf00422bf50d92c28c448f60b951c8fa42earbowen#
aa997d6b651a6ac262d708b7f807a080d57c3844sliveCLOBBERFILES= $(PDIR) proto_list_$(PKGMACH)
82fedb7a2164fa01fe2870f080aeac6344503148slive
82fedb7a2164fa01fe2870f080aeac6344503148slive#
82fedb7a2164fa01fe2870f080aeac6344503148slive# By default, PKGS will list all manifests. To build and/or publish a
82fedb7a2164fa01fe2870f080aeac6344503148slive# subset of packages, override this on the command line or in the
82fedb7a2164fa01fe2870f080aeac6344503148slive# build environment and then reference (implicitly or explicitly) the all
88f76f668542dcd72fc9d71577997967c6bf123bslive# or install targets.
67a715b4352c3e25bff32fccad48350180393f5end#
cc15c790bcacbd71ac0252fa1c775ac29d761106rbowenMANIFESTS :sh= (cd manifests; print *.mf)
e32abf00422bf50d92c28c448f60b951c8fa42earbowenPKGS= $(MANIFESTS:%.mf=%)
e32abf00422bf50d92c28c448f60b951c8fa42earbowenDEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
e32abf00422bf50d92c28c448f60b951c8fa42earbowenPROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
e32abf00422bf50d92c28c448f60b951c8fa42earbowen
67a715b4352c3e25bff32fccad48350180393f5end#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Track the synthetic manifests separately so we can properly express
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# build rules and dependencies. The synthetic and real packages use
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# different sets of transforms and macros for pkgmogrify.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
b2bdfa03847b3d5edc094516de5d30189ab7667digalicSYNTH_PKGS= osnet-incorporation osnet-redist
b2bdfa03847b3d5edc094516de5d30189ab7667digalic$(CLOSED_BUILD)SYNTH_PKGS += osnet-extra
b2bdfa03847b3d5edc094516de5d30189ab7667digalicDEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep)
b2bdfa03847b3d5edc094516de5d30189ab7667digalicPROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog)
b2bdfa03847b3d5edc094516de5d30189ab7667digalic
b2bdfa03847b3d5edc094516de5d30189ab7667digalic#
1dc8b93510d9b89f686e98b98a18cc436cefa7f2slive# For each package, we determine the target repository based on
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# manifest-embedded metadata. Because we make that determination on
1dc8b93510d9b89f686e98b98a18cc436cefa7f2slive# the fly, the publication target cannot be expressed as a
1dc8b93510d9b89f686e98b98a18cc436cefa7f2slive# subdirectory inside the unknown-by-the-makefile target repository.
1dc8b93510d9b89f686e98b98a18cc436cefa7f2slive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# In order to limit the target set to real files in known locations,
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# we use a ".pub" file in $(PDIR) for each processed manifest, regardless
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# of content or target repository.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgunPUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
88f76f668542dcd72fc9d71577997967c6bf123bslive
67a715b4352c3e25bff32fccad48350180393f5end#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Any given repository- and status-specific package list may be empty,
67a715b4352c3e25bff32fccad48350180393f5end# but we can only determine that dynamically, so we always generate all
88f76f668542dcd72fc9d71577997967c6bf123bslive# lists for each repository we're building.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# The meanings of each package status are as follows:
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# PKGSTAT meaning
88f76f668542dcd72fc9d71577997967c6bf123bslive# ---------- ----------------------------------------------------
88f76f668542dcd72fc9d71577997967c6bf123bslive# noincorp Do not include in incorporation or group package
88f76f668542dcd72fc9d71577997967c6bf123bslive# obsolete Include in incorporation, but not group package
88f76f668542dcd72fc9d71577997967c6bf123bslive# renamed Include in incorporation, but not group package
88f76f668542dcd72fc9d71577997967c6bf123bslive# current Include in incorporation and group package
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Since the semantics of the "noincorp" package status dictate that
88f76f668542dcd72fc9d71577997967c6bf123bslive# such packages are not included in the incorporation or group packages,
88f76f668542dcd72fc9d71577997967c6bf123bslive# there is no need to build noincorp package lists.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Since packages depend on their incorporation, noincorp necessarily
88f76f668542dcd72fc9d71577997967c6bf123bslive# implies nodepend, or it would inadvertently pull in other packages.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslivePKGLISTS= \
88f76f668542dcd72fc9d71577997967c6bf123bslive $(REPOS:%=$(PDIR)/packages.%.current) \
88f76f668542dcd72fc9d71577997967c6bf123bslive $(REPOS:%=$(PDIR)/packages.%.renamed) \
88f76f668542dcd72fc9d71577997967c6bf123bslive $(REPOS:%=$(PDIR)/packages.%.obsolete)
67a715b4352c3e25bff32fccad48350180393f5end
88f76f668542dcd72fc9d71577997967c6bf123bslive.KEEP_STATE:
88f76f668542dcd72fc9d71577997967c6bf123bslive
88f76f668542dcd72fc9d71577997967c6bf123bslive#
67a715b4352c3e25bff32fccad48350180393f5end# XXX Once we can publish in parallel, we can add $(PUB_PKGS) here.
67a715b4352c3e25bff32fccad48350180393f5end# And then we can also remove the leading "all .WAIT" from the
88f76f668542dcd72fc9d71577997967c6bf123bslive# install target, which currently allows us to at least process in
88f76f668542dcd72fc9d71577997967c6bf123bslive# parallel.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
bd63a8c7b38d0af10e7c9d891a245913daabd352rbowen.PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \
67a715b4352c3e25bff32fccad48350180393f5end $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS)
67a715b4352c3e25bff32fccad48350180393f5end
67a715b4352c3e25bff32fccad48350180393f5end#
bd63a8c7b38d0af10e7c9d891a245913daabd352rbowen# For a single manifest, the dependency chain looks like this:
bd63a8c7b38d0af10e7c9d891a245913daabd352rbowen#
88f76f668542dcd72fc9d71577997967c6bf123bslive# raw manifest (mypkg.mf)
88f76f668542dcd72fc9d71577997967c6bf123bslive# |
88f76f668542dcd72fc9d71577997967c6bf123bslive# | use pkgmogrify to process raw manifest
88f76f668542dcd72fc9d71577997967c6bf123bslive# |
88f76f668542dcd72fc9d71577997967c6bf123bslive# processed manifest (mypkg.mog)
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# |
15ba1801088da1aad6d20609cf3f7b0b1eefce8aslive# * | use pkgdepend generate to generate dependencies
67a715b4352c3e25bff32fccad48350180393f5end# |
67a715b4352c3e25bff32fccad48350180393f5end# manifest with TBD dependencies (mypkg.dep)
88f76f668542dcd72fc9d71577997967c6bf123bslive# |
88f76f668542dcd72fc9d71577997967c6bf123bslive# % | use pkgdepend resolve to resolve dependencies
88f76f668542dcd72fc9d71577997967c6bf123bslive# |
88f76f668542dcd72fc9d71577997967c6bf123bslive# manifest with dependencies resolved (mypkg.res)
88f76f668542dcd72fc9d71577997967c6bf123bslive# |
88f76f668542dcd72fc9d71577997967c6bf123bslive# | use pkgsend to publish the package
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# |
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# placeholder to indicate successful publication (mypkg.pub)
030108b1816bcda3d925df65357feabdce83bc94slive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# * This may be suppressed via SUPPRESSPKGDEP. The resulting
88f76f668542dcd72fc9d71577997967c6bf123bslive# packages will install correctly, but care must be taken to
88f76f668542dcd72fc9d71577997967c6bf123bslive# install all dependencies, because pkg will not have the input
88f76f668542dcd72fc9d71577997967c6bf123bslive# it needs to determine this automatically.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
67a715b4352c3e25bff32fccad48350180393f5end# % This is included in this diagram to make the picture complete, but
67a715b4352c3e25bff32fccad48350180393f5end# this is a point of synchronization in the build process.
ffe8ed2cd88be2c415ddef11f50394c52df9190ctrawick# Dependency resolution is actually done once on the entire set of
67a715b4352c3e25bff32fccad48350180393f5end# manifests, not on a per-package basis.
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# The full dependency chain for generating everything that needs to be
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# published, without actually publishing it, looks like this:
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# processed synthetic packages
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# | |
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# package lists synthetic package manifests
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# |
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# processed real packages
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# | |
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# package dir real package manifests
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Here, each item is a set of real or synthetic packages. For this
88f76f668542dcd72fc9d71577997967c6bf123bslive# portion of the build, no reference is made to the proto area. It is
88f76f668542dcd72fc9d71577997967c6bf123bslive# therefore suitable for the "all" target, as opposed to "install."
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Since each of these steps is expressed explicitly, "all" need only
88f76f668542dcd72fc9d71577997967c6bf123bslive# depend on the head of the chain.
67a715b4352c3e25bff32fccad48350180393f5end#
88f76f668542dcd72fc9d71577997967c6bf123bslive# From the end of manifest processing, the publication dependency
88f76f668542dcd72fc9d71577997967c6bf123bslive# chain looks like this:
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# repository metadata (catalogs and search indices)
88f76f668542dcd72fc9d71577997967c6bf123bslive# |
88f76f668542dcd72fc9d71577997967c6bf123bslive# | pkg.depotd
88f76f668542dcd72fc9d71577997967c6bf123bslive# |
88f76f668542dcd72fc9d71577997967c6bf123bslive# published packages
88f76f668542dcd72fc9d71577997967c6bf123bslive# | |
88f76f668542dcd72fc9d71577997967c6bf123bslive# | | pkgsend publish
88f76f668542dcd72fc9d71577997967c6bf123bslive# | |
88f76f668542dcd72fc9d71577997967c6bf123bslive# repositories resolved dependencies
88f76f668542dcd72fc9d71577997967c6bf123bslive# | |
88f76f668542dcd72fc9d71577997967c6bf123bslive# pkgsend | | pkgdepend resolve
88f76f668542dcd72fc9d71577997967c6bf123bslive# create-repository |
67a715b4352c3e25bff32fccad48350180393f5end# | generated dependencies
88f76f668542dcd72fc9d71577997967c6bf123bslive# repo directories |
88f76f668542dcd72fc9d71577997967c6bf123bslive# | pkgdepend
88f76f668542dcd72fc9d71577997967c6bf123bslive# |
88f76f668542dcd72fc9d71577997967c6bf123bslive# processed manifests
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# Due to limitations in pkgdepend, we cannot simply treat synthetic
88f76f668542dcd72fc9d71577997967c6bf123bslive# and real manifests identically. But we don't really want to
88f76f668542dcd72fc9d71577997967c6bf123bslive# maintain a separate chain for synthetic manifests, so for the left
88f76f668542dcd72fc9d71577997967c6bf123bslive# side of this diagram, we actually do faux dependency generation and
88f76f668542dcd72fc9d71577997967c6bf123bslive# resolution, so we end up with the expected set of files in $(PDIR),
88f76f668542dcd72fc9d71577997967c6bf123bslive# per the individual file chain described above: mf, mog, dep, res,
88f76f668542dcd72fc9d71577997967c6bf123bslive# and pub files for each manifest.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bsliveall: $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
88f76f668542dcd72fc9d71577997967c6bf123bslive
67a715b4352c3e25bff32fccad48350180393f5end#
67a715b4352c3e25bff32fccad48350180393f5end# This will build the directory to contain the processed manifests
88f76f668542dcd72fc9d71577997967c6bf123bslive# and the metadata symlinks.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive$(PDIR):
88f76f668542dcd72fc9d71577997967c6bf123bslive @print "Creating $(@)"
88f76f668542dcd72fc9d71577997967c6bf123bslive $(PKGDEBUG)$(INS.dir)
88f76f668542dcd72fc9d71577997967c6bf123bslive
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# This rule resolves dependencies across all published manifests.
aa997d6b651a6ac262d708b7f807a080d57c3844slive# We should be able to do this with
67a715b4352c3e25bff32fccad48350180393f5end#
aa997d6b651a6ac262d708b7f807a080d57c3844slive# pkgdepend resolve -m $(PUB_PKGS:%.pub=%.dep)
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# but until 14113 is fixed, the incorporations confuse pkgdepend, so we
67a715b4352c3e25bff32fccad48350180393f5end# just create the .res file for DEP_SYNTH_PKGS directly.
67a715b4352c3e25bff32fccad48350180393f5end#
67a715b4352c3e25bff32fccad48350180393f5end# We also shouldn't have to ignore the error from pkgdepend, but
88f76f668542dcd72fc9d71577997967c6bf123bslive# until at least 14110 is resolved, pkgdepend will always exit with
88f76f668542dcd72fc9d71577997967c6bf123bslive# an error.
aa997d6b651a6ac262d708b7f807a080d57c3844slive#
aa997d6b651a6ac262d708b7f807a080d57c3844slive$(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS)
aa997d6b651a6ac262d708b7f807a080d57c3844slive -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \
aa997d6b651a6ac262d708b7f807a080d57c3844slive print "Suppressing dependency resolution"; \
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive for p in $(DEP_PKGS:%.dep=%); do \
aa997d6b651a6ac262d708b7f807a080d57c3844slive $(CP) $$p.dep $$p.res; \
aa997d6b651a6ac262d708b7f807a080d57c3844slive done; \
aa997d6b651a6ac262d708b7f807a080d57c3844slive else \
aa997d6b651a6ac262d708b7f807a080d57c3844slive print "Resolving dependencies"; \
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive pkgdepend resolve -m $(DEP_PKGS); \
aa997d6b651a6ac262d708b7f807a080d57c3844slive for p in $(DEP_PKGS:%.dep=%); do \
aa997d6b651a6ac262d708b7f807a080d57c3844slive $(MV) $$p.dep.res $$p.res; \
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony done; \
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony fi
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony $(PKGDEBUG)for p in $(DEP_SYNTH_PKGS:%.dep=%); \
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony do \
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony $(CP) $$p.dep $$p.res; \
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony done
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony $(PKGDEBUG)$(TOUCH) $(@)
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctonyinstall: repository-metadata
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctonyrepository-metadata: publish_pkgs
e54ed2ca7730f513417f7ddbb2c85a49a8063cdbpctony @print "Creating repository metadata"
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive $(PKGDEBUG)for r in $(REPOS); do \
aa997d6b651a6ac262d708b7f807a080d57c3844slive /usr/lib/pkg.depotd -d $(PKGDEST)/repo.$$r \
aa997d6b651a6ac262d708b7f807a080d57c3844slive --add-content --exit-ready; \
aa997d6b651a6ac262d708b7f807a080d57c3844slive done
aa997d6b651a6ac262d708b7f807a080d57c3844slive
aa997d6b651a6ac262d708b7f807a080d57c3844slive#
aa997d6b651a6ac262d708b7f807a080d57c3844slive# Since we create zero-length processed manifests for a graceful abort
aa997d6b651a6ac262d708b7f807a080d57c3844slive# from pkgmogrify, we need to detect that here and make no effort to
aa997d6b651a6ac262d708b7f807a080d57c3844slive# publish the package.
aa997d6b651a6ac262d708b7f807a080d57c3844slive#
aa997d6b651a6ac262d708b7f807a080d57c3844slive# For all other packages, we publish them regardless of status. We
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive# derive the target repository as a component of the metadata-derived
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive# symlink for each package.
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive#
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslivepublish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive$(PUB_PKGS): FRC
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive#
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive# Initialize the empty on-disk repositories
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive#
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive$(REPOS:%=$(PKGDEST)/repo.%):
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive @print "Initializing $(@F)"
0222f4c188bbd414e293e0b78a8e350e3054322anilgun $(PKGDEBUG)$(INS.dir)
48981ff8ae4c9f2d7ac18c320727de9c36480d0fslive $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
aa997d6b651a6ac262d708b7f807a080d57c3844slive --set-property publisher.prefix=$(PKGPUBLISHER)
88f76f668542dcd72fc9d71577997967c6bf123bslive
aa997d6b651a6ac262d708b7f807a080d57c3844slive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# rule to process real manifests
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# To allow redistributability and package status to change, we must
88f76f668542dcd72fc9d71577997967c6bf123bslive# remove not only the actual build target (the processed manifest), but
88f76f668542dcd72fc9d71577997967c6bf123bslive# also the incidental ones (the metadata-derived symlinks).
88f76f668542dcd72fc9d71577997967c6bf123bslive#
67a715b4352c3e25bff32fccad48350180393f5end# If pkgmogrify exits cleanly but fails to create the specified output
67a715b4352c3e25bff32fccad48350180393f5end# file, it means that it encountered an abort directive. That means
88f76f668542dcd72fc9d71577997967c6bf123bslive# that this package should not be published for this particular build
88f76f668542dcd72fc9d71577997967c6bf123bslive# environment. Since we can't prune such packages from $(PKGS)
88f76f668542dcd72fc9d71577997967c6bf123bslive# retroactively, we need to create an empty target file to keep make
88f76f668542dcd72fc9d71577997967c6bf123bslive# from trying to rebuild it every time. For these empty targets, we
88f76f668542dcd72fc9d71577997967c6bf123bslive# do not create metadata symlinks.
0222f4c188bbd414e293e0b78a8e350e3054322anilgun#
0222f4c188bbd414e293e0b78a8e350e3054322anilgun# Automatic dependency resolution to files is also done at this phase of
030108b1816bcda3d925df65357feabdce83bc94slive# processing. The skipped packages are skipped due to existing bugs
88f76f668542dcd72fc9d71577997967c6bf123bslive# in pkgdepend.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# The incorporation dependency is tricky: it needs to go into all
88f76f668542dcd72fc9d71577997967c6bf123bslive# current and renamed manifests (ie all incorporated packages), but we
88f76f668542dcd72fc9d71577997967c6bf123bslive# don't know which those are until after we run pkgmogrify. So
67a715b4352c3e25bff32fccad48350180393f5end# instead of expressing it as a transform, we tack it on ex post facto.
67a715b4352c3e25bff32fccad48350180393f5end#
67a715b4352c3e25bff32fccad48350180393f5end# Implementation notes:
67a715b4352c3e25bff32fccad48350180393f5end#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# - The first $(RM) must not match other manifests, or we'll run into
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# race conditions with parallel manifest processing.
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# - The make macros [ie $(MACRO)] are evaluated when the makefile is
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# read in, and will result in a fixed, macro-expanded rule for each
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# target enumerated in $(PROC_PKGS).
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# - The shell variables (ie $$VAR) are assigned on the fly, as the rule
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# is executed. The results may only be referenced in the shell in
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# which they are assigned, so from the perspective of make, all code
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# that needs these variables needs to be part of the same line of
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# code. Hence the use of command separators and line continuation
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# characters.
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier#
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# - The extract_metadata transforms are designed to spit out shell
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# variable assignments to stdout. So the eval statement should
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# begin with the default values, and any output from pkgmogrify
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# should be in the form of a variable assignment to override those
c700b3b19086d0d0d52e74fd51e54864e3a11bbbpoirier# defaults.
88f76f668542dcd72fc9d71577997967c6bf123bslive#
88f76f668542dcd72fc9d71577997967c6bf123bslive# - When this rule completes execution, it must leave an updated
88f76f668542dcd72fc9d71577997967c6bf123bslive# target file ($@) in place, or make will reprocess the package
88f76f668542dcd72fc9d71577997967c6bf123bslive# every time it encounters it as a dependency. Hence the "touch"
88f76f668542dcd72fc9d71577997967c6bf123bslive# statement to ensure that the target is created, even when
# pkgmogrify encounters an abort in the publish transforms. This
# will not cause publication failures when switching build
# environments, because $(CLOSED_BUILD) and $(OPEN_ONLY) are
# referenced in $(PKGMOG_DEFINES), and changes will therefore
# trigger a rebuild for command dependency failure. (Command
# dependency checking is turned on by .KEEP_STATE: above.)
#
.SUFFIXES: .mf .mog .dep .res .pub
$(PDIR)/%.mog: manifests/%.mf
@print "Processing manifest $(<F)"
$(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
$(PDIR)/$(@F:%.mog=%).metadata.*
$(PKGDEBUG)eval REPO=redist PKGSTAT=current \
NODEPEND=$(SUPPRESSPKGDEP) \
`$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
$(PKGMOG_DEFINES:%=-D %) -O $(@) $(<) $(PM_TRANSFORMS)`; \
if [ -f $(@) ]; then \
if [ \( "$$NODEPEND" != "false" \) -o \
\( "$$PKGSTAT" = "noincorp" \) ]; then \
$(TOUCH) $(@:%.mog=%.nodepend); \
fi; \
$(LN) -s $(@F) \
$(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
if [ \( "$$PKGSTAT" = "current" \) -o \
\( "$$PKGSTAT" = "renamed" \) ]; \
then print $(PKGDEP_INCORP) >> $(@); \
fi; \
else \
$(TOUCH) $(@); \
fi
$(PDIR)/%.dep: $(PDIR)/%.mog
@print "Generating dependencies for $(<F)"
$(PKGDEBUG)$(RM) $(@)
$(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \
pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \
$(PKGROOT) > $(@); \
else \
$(CP) $(<) $(@); \
fi
#
# The full chain implies that there should be a .dep.res suffix rule,
# but dependency generation is done on a set of manifests, rather than
# on a per-manifest basis. Instead, see the gendeps rule above.
#
$(PDIR)/%.pub: $(PDIR)/%.res
$(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \
r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \
if [ -s $(<) ]; then \
print "Publishing $(@F:%.pub=%) to $$r repository"; \
pkgsend -s file://$(PKGDEST)/repo.$$r publish \
-d $(PKGROOT) -d $(TOOLSROOT) -d $(SRC)/pkg/license_files \
-d $(SRC) --fmri-in-manifest --no-index --no-catalog $(<) \
> /dev/null; \
fi; \
$(TOUCH) $(@);
#
# rule to build the synthetic manifests
#
# This rule necessarily has PKGDEP_TYPE that changes according to
# the specific synthetic manifest. Rather than escape command
# dependency checking for the real manifest processing, or failing to
# express the (indirect) dependency of synthetic manifests on real
# manifests, we simply split this rule out from the one above.
#
# The implementation notes from the previous rule are applicable
# here, too.
#
$(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf)
@print "Processing synthetic manifest $(@F:%.mog=%.mf)"
$(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.*
$(PKGDEBUG)eval REPO=redist PKGSTAT=current \
`$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
$(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
-O $(@) $(@F:%.mog=%.mf) $(PM_TRANSFORMS) synthetic` ; \
if [ -f $(@) ]; then \
$(LN) -s $(@F) \
$(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
else \
$(TOUCH) $(@); \
fi
$(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog)
@print "Skipping dependency generation for $(@F:%.dep=%)"
$(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@)
clean:
clobber: clean
$(RM) -r $(CLOBBERFILES)
#
# This rule assumes that all links in the $PKGSTAT directories
# point to valid manifests, and will fail the make run if one
# does not contain an fmri.
#
# We do this in the BEGIN action instead of using pattern matching
# because we expect the fmri to be at or near the first line of each input
# file, and this way lets us avoid reading the rest of the file after we
# find what we need.
#
# We keep track of a failure to locate an fmri, so we can fail the
# make run, but we still attempt to process each package in the
# repo/pkgstat-specific subdir, in hopes of maybe giving some
# additional useful info.
#
# The protolist is used for bfu archive creation, which may be invoked
# interactively by the user. Both protolist and PKGLISTS targets
# depend on $(PROC_PKGS), but protolist builds them recursively.
# To avoid collisions, we insert protolist into the dependency chain
# here. This has two somewhat subtle benefits: it allows bfu archive
# creation to work correctly, even when -a was not part of NIGHTLY_OPTIONS,
# and it ensures that a protolist file here will always correspond to the
# contents of the processed manifests, which can vary depending on build
# environment.
#
$(PKGLISTS): $(PROC_PKGS)
$(PKGDEBUG)sdotr=$(@F:packages.%=%); \
r=$${sdotr%.+(?)}; s=$${sdotr#+(?).}; \
print "Generating $$r $$s package list"; \
$(RM) $(@); $(TOUCH) $(@); \
$(NAWK) 'BEGIN { \
if (ARGC < 2) { \
exit; \
} \
retcode = 0; \
for (i = 1; i < ARGC; i++) { \
do { \
e = getline f < ARGV[i]; \
} while ((e == 1) && (f !~ /name=pkg.fmri/)); \
close(ARGV[i]); \
if (e == 1) { \
l = split(f, a, "="); \
print "depend fmri=" a[l], \
"type=$$(PKGDEP_TYPE)"; \
} else { \
print "no fmri in " ARGV[i] >> "/dev/stderr"; \
retcode = 2; \
} \
} \
exit retcode; \
}' `find $(PDIR) -type l -a \( $(PKGS:%=-name %.metadata.$$s.$$r -o) \
-name NOSUCHFILE \)` >> $(@)
#
# rules to validate proto area against manifests, check for safe
# file permission modes, and generate a faux proto list
#
# For the check targets, the dependencies on $(PROC_PKGS) is specified
# as a subordinate make process in order to suppress output.
#
makesilent:
@$(MAKE) -e $(PROC_PKGS) PKGMACH=$(PKGMACH) \
SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) > /dev/null
protocmp: makesilent
@validate_pkg -a $(PKGMACH) -v \
$(EXCEPTIONS:%=-e $(CODEMGR_WS)/exception_lists/%) \
-m $(PDIR) -p $(PKGROOT) -p $(TOOLSROOT)
pmodes: makesilent
@validate_pkg -a $(PKGMACH) -M -m $(PDIR) \
-e $(CODEMGR_WS)/exception_lists/pmodes
check: protocmp pmodes
protolist: proto_list_$(PKGMACH)
proto_list_$(PKGMACH): $(PROC_PKGS)
@validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@)
$(PROC_PKGS): $(PDIR)
#
# This is a convenience target to allow package names to function as
# build targets. Generally, using it is only useful when iterating on
# development of a manifest.
#
# When processing a manifest, use the basename (without extension) of
# the package. When publishing, use the basename with a ".pub"
# extension.
#
# Other than during manifest development, the preferred usage is to
# avoid these targets and override PKGS on the make command line and
# use the provided all and install targets.
#
$(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog)
$(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@)
#
# This is a convenience target to resolve dependencies without publishing
# packages.
#
gendeps: $(PDIR)/gendeps
#
# These are convenience targets for cross-platform packaging. If you
# want to build any of "the normal" targets for a different
# architecture, simply use "arch/target" as your build target.
#
# Since the most common use case for this is "install," the architecture
# specific install targets have been further abbreviated to elide "/install."
#
i386/% sparc/%:
$(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP)
i386 sparc: $$(@)/install
FRC:
# EXPORT DELETE START
XMOD_PKGS= \
BRCMbnx \
BRCMbnxe \
SUNWadpu320 \
SUNWcryptoint \
SUNWibsdpib \
SUNWkdc \
SUNWlsimega \
SUNWspwr \
SUNWsvvs \
SUNWwbint \
SUNWwbsup
EXPORT_SRC: CRYPT_SRC
$(RM) $(XMOD_PKGS:%=manifests/%.mf)
$(RM) Makefile+
$(SED) -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
< Makefile > Makefile+
$(MV) -f Makefile+ Makefile
$(CHMOD) 444 Makefile
CRYPT_SRC:
$(RM) manifests/SUNWcryptoint.mf+
$(SED) -e "/^# CRYPT DELETE START/,/^# CRYPT DELETE END/d" \
< manifests/SUNWcryptoint.mf > manifests/SUNWcryptoint.mf+
$(MV) manifests/SUNWcryptoint.mf+ manifests/SUNWcryptoint.mf
$(CHMOD) 444 manifests/SUNWcryptoint.mf
# EXPORT DELETE END