Makefile revision 70f9559bd0c02885d84a425eaafc8c280df10efb
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# CDDL HEADER START
365b40dec2ed01d9983d29e276e7431c5a4a9c18vboxsync#
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# The contents of this file are subject to the terms of the
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# Common Development and Distribution License (the "License").
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# You may not use this file except in compliance with the License.
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync#
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# or http://www.opensolaris.org/os/licensing.
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# See the License for the specific language governing permissions
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# and limitations under the License.
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync#
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# When distributing Covered Code, include this CDDL HEADER in each
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# If applicable, add the following below this CDDL HEADER, with the
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# fields enclosed by brackets "[]" replaced with your own identifying
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# information: Portions Copyright [yyyy] [name of copyright owner]
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# CDDL HEADER END
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncinclude $(SRC)/Makefile.master
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsyncinclude $(SRC)/Makefile.buildnum
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Make sure we're getting a consistent execution environment for the
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# embedded scripts.
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync#
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsyncSHELL= /usr/bin/ksh93
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# To suppress package dependency generation on any system, regardless
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# of how it was installed, set SUPPRESSPKGDEP=true in the build
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync# environment.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncSUPPRESSPKGDEP= false
46e6cceda24bf6c589e4cb151afefe4fffecca7bvboxsync
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsync#
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync# Comment this line out or set "PKGDEBUG=" in your build environment
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# to get more verbose output from the make processes in usr/src/pkg
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPKGDEBUG= @
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Cross platform packaging notes
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# By default, we package the proto area from the same architecture as
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# the packaging build. In other words, if you're running nightly or
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# bldenv on an x86 platform, it will take objects from the x86 proto
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# area and use them to create x86 repositories.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# If you want to create repositories for an architecture that's
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# different from $(uname -p), you do so by setting PKGMACH in your
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# build environment.
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# For this to work correctly, the following must all happen:
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# 1. You need the desired proto area, which you can get either by
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# doing a gatekeeper-style build with the -U option to
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# nightly(1), or by using rsync. If you don't do this, you will
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# get packaging failures building all packages, because pkgsend
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# is unable to find the required binaries.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# 2. You need the desired tools proto area, which you can get in the
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync# same ways as the normal proto area. If you don't do this, you
0a724db1030736c131a45392c0ebb6bb25362917vboxsync# will get packaging failures building onbld, because pkgsend is
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# unable to find the tools binaries.
13c94cb9d95cf4865646e86b944c09e1af2fe48cvboxsync# 3. The remainder of this Makefile should never refer directly to
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# $(MACH). Instead, $(PKGMACH) should be used whenever an
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# architecture-specific path or token is needed. If this is done
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# incorrectly, then packaging will fail, and you will see the
c33cfcef143f5dc2148c35d7b1dd1a32183f1926vboxsync# value of $(uname -p) instead of the value of $(PKGMACH) in the
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync# commands that fail.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# 4. Each time a rule in this Makefile invokes $(MAKE), it should
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# pass PKGMACH=$(PKGMACH) explicitly on the command line. If
13c94cb9d95cf4865646e86b944c09e1af2fe48cvboxsync# this is done incorrectly, then packaging will fail, and you
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# will see the value of $(uname -p) instead of the value of
ad34209dccf31d54e2277d732a90ce6ea4374362vboxsync# $(PKGMACH) in the commands that fail.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Refer also to the convenience targets defined later in this
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Makefile.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPKGMACH= $(MACH)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# ROOT, TOOLS_PROTO, and PKGARCHIVE should be set by nightly or
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# bldenv. These macros translate them into terms of $PKGMACH, instead
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# of $ARCH.
27efd9329f6a90f7cacf840031e5305f98975960vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPKGROOT.cmd= print $(ROOT) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
ad34209dccf31d54e2277d732a90ce6ea4374362vboxsyncPKGROOT= $(PKGROOT.cmd:sh)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncTOOLSROOT.cmd= print $(TOOLS_PROTO) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsyncTOOLSROOT= $(TOOLSROOT.cmd:sh)
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsyncPKGDEST.cmd= print $(PKGARCHIVE) | sed -e s:/$(MACH)/:/$(PKGMACH)/:
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPKGDEST= $(PKGDEST.cmd:sh)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncEXCEPTIONS= packaging
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPKGMOGRIFY= pkgmogrify
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Always build the redistributable repository, but only build the
27efd9329f6a90f7cacf840031e5305f98975960vboxsync# nonredistributable bits if we have access to closed source.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
ad34209dccf31d54e2277d732a90ce6ea4374362vboxsync# Some objects that result from the closed build are still
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# redistributable, and should be packaged as part of an open-only
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync# build. Access to those objects is provided via the closed-bins
27efd9329f6a90f7cacf840031e5305f98975960vboxsync# tarball. See usr/src/tools/scripts/bindrop.sh for details.
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncREPOS= redist
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# The packages directory will contain the processed manifests as
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# direct build targets and subdirectories for package metadata extracted
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync# incidentally during manifest processing.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Nothing underneath $(PDIR) should ever be managed by SCM.
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPDIR= packages.$(PKGMACH)
27efd9329f6a90f7cacf840031e5305f98975960vboxsync
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync#
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync# The tools proto must be specified for dependency generation.
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync# Publication from the tools proto area is managed in the
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync# publication rule.
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync#
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync$(PDIR)/developer-build-onbld.dep:= PKGROOT= $(TOOLSROOT)
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync
27efd9329f6a90f7cacf840031e5305f98975960vboxsyncPKGPUBLISHER= $(PKGPUBLISHER_REDIST)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync#
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync# To get these defaults, manifests should simply refer to $(PKGVERS).
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync#
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsyncPKGVERS_COMPONENT= 0.$(RELEASE)
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsyncPKGVERS_BUILTON= $(RELEASE)
27efd9329f6a90f7cacf840031e5305f98975960vboxsyncPKGVERS_BRANCH= 0.$(ONNV_BUILDNUM)
27efd9329f6a90f7cacf840031e5305f98975960vboxsyncPKGVERS= $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync#
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync# The ARCH32 and ARCH64 macros are used in the manifests to express
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# architecture-specific subdirectories in the installation paths
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# for isaexec'd commands.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# We can't simply use $(MACH32) and $(MACH64) here, because they're
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# only defined for the build architecture. To do cross-platform
03e380b03da26ad4a2309190f35ba86843d3d824vboxsync# packaging, we need both values.
c38d5dda76cee141ae524ccce2c513178be1b87cvboxsync#
69f57565f5243a46f1df060b63d0fd830de3be04vboxsynci386_ARCH32= i86
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncsparc_ARCH32= sparcv7
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsynci386_ARCH64= amd64
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncsparc_ARCH64= sparcv9
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncOPENSSL = /usr/bin/openssl
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncOPENSSL10.cmd = $(OPENSSL) version | $(NAWK) '{if($$2<1){print "\043";}}'
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncOPENSSL10_ONLY = $(OPENSSL10.cmd:sh)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# macros and transforms needed by pkgmogrify
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# If you append to this list using target-specific assignments (:=),
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# be very careful that the targets are of the form $(PDIR)/pkgname. If
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# you use a higher level target, or a package list, you'll trigger a
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# complete reprocessing of all manifests because they'll fail command
4726db8b47db329039ce8f8e13ecd2c1f696fa60vboxsync# dependency checking.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsyncPM_TRANSFORMS= common_actions publish restart_fmri facets defaults \
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync extract_metadata
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsyncPM_INC= transforms manifests
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPKGMOG_DEFINES= \
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync i386_ONLY=$(POUND_SIGN) \
097b3079a919c94052ca642306232b856949c755vboxsync sparc_ONLY=$(POUND_SIGN) \
097b3079a919c94052ca642306232b856949c755vboxsync OPENSSL10_ONLY=$(OPENSSL10_ONLY) \
097b3079a919c94052ca642306232b856949c755vboxsync $(PKGMACH)_ONLY= \
097b3079a919c94052ca642306232b856949c755vboxsync ARCH=$(PKGMACH) \
097b3079a919c94052ca642306232b856949c755vboxsync ARCH32=$($(PKGMACH)_ARCH32) \
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync ARCH64=$($(PKGMACH)_ARCH64) \
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync PKGVERS_BUILTON=$(PKGVERS_BUILTON) \
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync PKGVERS_BRANCH=$(PKGVERS_BRANCH) \
6e2490fe643cb292ee8e37f9e1d7171e9315129cvboxsync PKGVERS=$(PKGVERS)
917d66601860f75830cb684385ba7b4d73458bcavboxsync
917d66601860f75830cb684385ba7b4d73458bcavboxsyncPKGDEP_TOKENS_i386= \
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync 'PLATFORM=i86hvm' \
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync 'PLATFORM=i86pc' \
1c2c968fd241148110002d75b2c0fdeddc211e14vboxsync 'PLATFORM=i86xpv' \
1c2c968fd241148110002d75b2c0fdeddc211e14vboxsync 'ISALIST=amd64' \
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync 'ISALIST=i386'
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsyncPKGDEP_TOKENS_sparc= \
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync 'PLATFORM=sun4u' \
9d473abea9a9b6597b2b20bedc950ba33a2e73a5vboxsync 'PLATFORM=sun4v' \
7e958a4329e4f9d83f597e26c72121969091e87bvboxsync 'ISALIST=sparcv9' \
f3f687b00a9f7c98dc0b81899090bc5f659ae7bdvboxsync 'ISALIST=sparc'
13c94cb9d95cf4865646e86b944c09e1af2fe48cvboxsyncPKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH))
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync
80b853528b74d686eebf9331ee762891d0038f06vboxsync#
80b853528b74d686eebf9331ee762891d0038f06vboxsync# The package lists are generated with $(PKGDEP_TYPE) as their
80b853528b74d686eebf9331ee762891d0038f06vboxsync# dependency types, so that they can be included by either an
80b853528b74d686eebf9331ee762891d0038f06vboxsync# incorporation or a group package.
80b853528b74d686eebf9331ee762891d0038f06vboxsync#
80b853528b74d686eebf9331ee762891d0038f06vboxsync$(PDIR)/osnet-redist.mog := PKGDEP_TYPE= require
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync$(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPKGDEP_INCORP= \
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync depend fmri=consolidation/osnet/osnet-incorporation type=require
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync#
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync# All packaging build products should go into $(PDIR), so they don't
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync# need to be included separately in CLOBBERFILES.
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync#
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsyncCLOBBERFILES= $(PDIR) proto_list_$(PKGMACH)
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync#
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync# By default, PKGS will list all manifests. To build and/or publish a
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync# subset of packages, override this on the command line or in the
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# build environment and then reference (implicitly or explicitly) the all
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsync# or install targets.
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync#
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsyncMANIFESTS :sh= (cd manifests; print *.mf)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsyncPKGS= $(MANIFESTS:%.mf=%)
ad34209dccf31d54e2277d732a90ce6ea4374362vboxsyncDEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
ad34209dccf31d54e2277d732a90ce6ea4374362vboxsyncPROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsync
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync#
9d473abea9a9b6597b2b20bedc950ba33a2e73a5vboxsync# Track the synthetic manifests separately so we can properly express
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# build rules and dependencies. The synthetic and real packages use
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync# different sets of transforms and macros for pkgmogrify.
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync#
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsyncSYNTH_PKGS= osnet-incorporation osnet-redist
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsyncDEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep)
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsyncPROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog)
5c7a628b8077efd9a3049538f6e7f470d8afb9b3vboxsync
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync#
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync# Root of pkg image to use for dependency resolution
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync# Normally / on the machine used to build the binaries
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPKGDEP_RESOLVE_IMAGE = /
8eb4989e815c8f374b965265ccf184d6ce17d9e8vboxsync
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync#
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# For each package, we determine the target repository based on
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# manifest-embedded metadata. Because we make that determination on
5b802b5e11fed6e163afca32e9118d2599d312fbvboxsync# the fly, the publication target cannot be expressed as a
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# subdirectory inside the unknown-by-the-makefile target repository.
bcc2356dccf06ea3fdd1f3e4d4e62b04e95673d0vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# In order to limit the target set to real files in known locations,
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# we use a ".pub" file in $(PDIR) for each processed manifest, regardless
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# of content or target repository.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncPUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync#
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync# Any given repository- and status-specific package list may be empty,
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync# but we can only determine that dynamically, so we always generate all
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync# lists for each repository we're building.
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync#
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync# The meanings of each package status are as follows:
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync#
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync# PKGSTAT meaning
bbfc28b1a00ce00001b2ead074d47254bec3e5cfvboxsync# ---------- ----------------------------------------------------
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync# noincorp Do not include in incorporation or group package
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync# obsolete Include in incorporation, but not group package
ad34209dccf31d54e2277d732a90ce6ea4374362vboxsync# renamed Include in incorporation, but not group package
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# current Include in incorporation and group package
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync#
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Since the semantics of the "noincorp" package status dictate that
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# such packages are not included in the incorporation or group packages,
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# there is no need to build noincorp package lists.
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsync#
20b950300ed7ebcdf78f414c3d98b20d010ff74fvboxsyncPKGLISTS= \
702250abf86d6252cfbbff216d848d2c799548a4vboxsync $(REPOS:%=$(PDIR)/packages.%.current) \
27efd9329f6a90f7cacf840031e5305f98975960vboxsync $(REPOS:%=$(PDIR)/packages.%.renamed) \
2b66a097b19f31e00af3abc508a3ff8c74ca1f8avboxsync $(REPOS:%=$(PDIR)/packages.%.obsolete)
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync.KEEP_STATE:
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync.PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS)
#
# For a single manifest, the dependency chain looks like this:
#
# raw manifest (mypkg.mf)
# |
# | use pkgmogrify to process raw manifest
# |
# processed manifest (mypkg.mog)
# |
# * | use pkgdepend generate to generate dependencies
# |
# manifest with TBD dependencies (mypkg.dep)
# |
# % | use pkgdepend resolve to resolve dependencies
# |
# manifest with dependencies resolved (mypkg.res)
# |
# | use pkgsend to publish the package
# |
# placeholder to indicate successful publication (mypkg.pub)
#
# * This may be suppressed via SUPPRESSPKGDEP. The resulting
# packages will install correctly, but care must be taken to
# install all dependencies, because pkg will not have the input
# it needs to determine this automatically.
#
# % This is included in this diagram to make the picture complete, but
# this is a point of synchronization in the build process.
# Dependency resolution is actually done once on the entire set of
# manifests, not on a per-package basis.
#
# The full dependency chain for generating everything that needs to be
# published, without actually publishing it, looks like this:
#
# processed synthetic packages
# | |
# package lists synthetic package manifests
# |
# processed real packages
# | |
# package dir real package manifests
#
# Here, each item is a set of real or synthetic packages. For this
# portion of the build, no reference is made to the proto area. It is
# therefore suitable for the "all" target, as opposed to "install."
#
# Since each of these steps is expressed explicitly, "all" need only
# depend on the head of the chain.
#
# From the end of manifest processing, the publication dependency
# chain looks like this:
#
# repository metadata (catalogs and search indices)
# |
# | pkg.depotd
# |
# published packages
# | |
# | | pkgsend publish
# | |
# repositories resolved dependencies
# | |
# pkgsend | | pkgdepend resolve
# create-repository |
# | generated dependencies
# repo directories |
# | pkgdepend
# |
# processed manifests
#
ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
all: $(ALL_TARGETS)
#
# This will build the directory to contain the processed manifests
# and the metadata symlinks.
#
$(PDIR):
@print "Creating $(@)"
$(PKGDEBUG)$(INS.dir)
#
# This rule resolves dependencies across all published manifests.
#
# We shouldn't have to ignore the error from pkgdepend, but until
# 16012 and its dependencies are resolved, pkgdepend will always exit
# with an error.
#
$(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS)
-$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \
print "Suppressing dependency resolution"; \
for p in $(DEP_PKGS:%.dep=%); do \
$(CP) $$p.dep $$p.res; \
done; \
else \
print "Resolving dependencies"; \
pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve \
-m $(DEP_SYNTH_PKGS) $(DEP_PKGS); \
for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
if [ "$$(print $$p.metadata.*)" = \
"$$(print $$p.metadata.noincorp.*)" ]; \
then \
print "Removing dependency versions from $$p"; \
$(PKGMOGRIFY) $(PKGMOG_VERBOSE) \
-O $$p.res -I transforms \
strip_versions $$p.dep.res; \
$(RM) $$p.dep.res; \
else \
$(MV) $$p.dep.res $$p.res; \
fi; \
done; \
fi
$(PKGDEBUG)$(TOUCH) $(@)
install: $(ALL_TARGETS) repository-metadata
repository-metadata: publish_pkgs
@print "Creating repository metadata"
$(PKGDEBUG)for r in $(REPOS); do \
/usr/lib/pkg.depotd -d $(PKGDEST)/repo.$$r \
--add-content --exit-ready; \
done
#
# Since we create zero-length processed manifests for a graceful abort
# from pkgmogrify, we need to detect that here and make no effort to
# publish the package.
#
# For all other packages, we publish them regardless of status. We
# derive the target repository as a component of the metadata-derived
# symlink for each package.
#
publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
#
# Before publishing, we want to pull the license files from $CODEMGR_WS
# into the proto area. This allows us to NOT pass $SRC (or
# $CODEMGR_WS) as a basedir for publication.
#
$(PUB_PKGS): stage-licenses
#
# Initialize the empty on-disk repositories
#
$(REPOS:%=$(PKGDEST)/repo.%):
@print "Initializing $(@F)"
$(PKGDEBUG)$(INS.dir)
$(PKGDEBUG)pkgsend -s file://$(@) create-repository \
--set-property publisher.prefix=$(PKGPUBLISHER)
#
# rule to process real manifests
#
# To allow redistributability and package status to change, we must
# remove not only the actual build target (the processed manifest), but
# also the incidental ones (the metadata-derived symlinks).
#
# If pkgmogrify exits cleanly but fails to create the specified output
# file, it means that it encountered an abort directive. That means
# that this package should not be published for this particular build
# environment. Since we can't prune such packages from $(PKGS)
# retroactively, we need to create an empty target file to keep make
# from trying to rebuild it every time. For these empty targets, we
# do not create metadata symlinks.
#
# Automatic dependency resolution to files is also done at this phase of
# processing. The skipped packages are skipped due to existing bugs
# in pkgdepend.
#
# The incorporation dependency is tricky: it needs to go into all
# current and renamed manifests (ie all incorporated packages), but we
# don't know which those are until after we run pkgmogrify. So
# instead of expressing it as a transform, we tack it on ex post facto.
#
# Implementation notes:
#
# - The first $(RM) must not match other manifests, or we'll run into
# race conditions with parallel manifest processing.
#
# - The make macros [ie $(MACRO)] are evaluated when the makefile is
# read in, and will result in a fixed, macro-expanded rule for each
# target enumerated in $(PROC_PKGS).
#
# - The shell variables (ie $$VAR) are assigned on the fly, as the rule
# is executed. The results may only be referenced in the shell in
# which they are assigned, so from the perspective of make, all code
# that needs these variables needs to be part of the same line of
# code. Hence the use of command separators and line continuation
# characters.
#
# - The extract_metadata transforms are designed to spit out shell
# variable assignments to stdout. Those are published to the
# .vars temporary files, and then used as input to the eval
# statement. This is done in stages specifically so that pkgmogrify
# can signal failure if the manifest has a syntactic or other error.
# The eval statement should begin with the default values, and the
# output from pkgmogrify (if any) should be in the form of a
# variable assignment to override those defaults.
#
# - When this rule completes execution, it must leave an updated
# target file ($@) in place, or make will reprocess the package
# every time it encounters it as a dependency. Hence the "touch"
# statement to ensure that the target is created, even when
# pkgmogrify encounters an abort in the publish transforms.
#
.SUFFIXES: .mf .mog .dep .res .pub
$(PDIR)/%.mog: manifests/%.mf
@print "Processing manifest $(<F)"
@env PKGFMT_OUTPUT=v1 pkgfmt -c $<
$(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
$(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
$(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
$(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \
$(<) $(PM_TRANSFORMS)
$(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \
`$(CAT) -s $(@).vars`; \
if [ -f $(@) ]; then \
if [ "$$NODEPEND" != "false" ]; 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; \
print $$LICS > $(@:%.mog=%.lics); \
else \
$(TOUCH) $(@) $(@:%.mog=%.lics); \
fi
$(PKGDEBUG)$(RM) $(@).vars
$(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 license_files -d $(PKGROOT)/licenses \
--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.* $(@).vars
$(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
$(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
-P $(@).vars -O $(@) $(@F:%.mog=%.mf) \
$(PM_TRANSFORMS) synthetic
$(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \
if [ -f $(@) ]; then \
$(LN) -s $(@F) \
$(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
else \
$(TOUCH) $(@); \
fi
$(PKGDEBUG)$(RM) $(@).vars
$(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
#
# The .lics files were created during pkgmogrification, and list the
# set of licenses to pull from $SRC for each package. Because
# licenses may be duplicated between packages, we uniquify them as
# well as aggregating them here.
#
license-list: makesilent
$(PKGDEBUG)( for l in `cat $(PROC_PKGS:%.mog=%.lics)`; \
do print $$l; done ) | sort -u > $@
#
# Staging the license and description files in the proto area allows
# us to do proper unreferenced file checking of both license and
# description files without blanket exceptions, and to pull license
# content without reference to $CODEMGR_WS during publication.
#
stage-licenses: license-list FRC
$(PKGDEBUG)$(MAKE) -e -f Makefile.lic \
PKGDEBUG=$(PKGDEBUG) LICROOT=$(PKGROOT)/licenses \
`$(NAWK) '{ \
print "$(PKGROOT)/licenses/" $$0; \
print "$(PKGROOT)/licenses/" $$0 ".descrip"; \
}' license-list` > /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 \
SUNWibsdpib \
SUNWkdc \
SUNWlsimega \
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
# EXPORT DELETE END