Makefile revision 1105
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys###############################################################################
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Makefile for X Consolidation packages
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Permission is hereby granted, free of charge, to any person obtaining a
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# copy of this software and associated documentation files (the "Software"),
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# to deal in the Software without restriction, including without limitation
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# the rights to use, copy, modify, merge, publish, distribute, sublicense,
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# and/or sell copies of the Software, and to permit persons to whom the
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Software is furnished to do so, subject to the following conditions:
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# The above copyright notice and this permission notice (including the next
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# paragraph) shall be included in all copies or substantial portions of the
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
2c9a247fb01631b3eb3b85a1127e72f0b60ae108Wyllys Ingersoll# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# DEALINGS IN THE SOFTWARE.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys###############################################################################
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Heavily inspired by / borrowed from the ON usr/src/pkg/Makefile
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Please read the comments in it and the accompanying README in ON for many
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# details omitted here.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Major differences in the X implementation:
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# - X only supports building one repo, not redist + extra
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# - X only supports building packages on the same platform as the binaries,
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# no cross-platform packaging
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# - X has no bfu legacy to deal with
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# - ON has all manifests in one directory, X splits into current & legacy
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# - Integrates with X consolidation makefile/build system instead of ON's
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys### Include common definitions
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# We don't yet support building packages cross-architecture, but would
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# need this if we ever did. (See "Cross platform packaging notes" in
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# the ON usr/src/pkg/Makefile for what we'd have to do.)
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Map X makefile names to the ones used in the rules copied from ON
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll# More to be updated if we ever decide to support building cross-platform
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Map the V=1 style of enabling more verbose build messages used in the
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# X.Org/automake builds to the macro used in the rules copied from ON
6b35cb3cf158584a9408d44b9b6796564e8e1882Richard PALO# You can enable verbose output with either V=1 or PKGDEBUG=""
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Commands used in rules copied from ON
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# To suppress package dependency generation on any system, regardless
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll# of how it was installed, set SUPPRESSPKGDEP=true in the build
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# environment.
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll# The packages directory will contain the processed manifests as
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# direct build targets and subdirectories for package metadata extracted
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# incidentally during manifest processing.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Nothing underneath $(PDIR) should ever be managed by SCM.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# By default, PKGS will list all manifests. To build and/or publish a
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# subset of packages, override this on the command line or in the
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# build environment and then reference (implicitly or explicitly) the all
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# or install targets.
d00756ccb34596a328f8a15d1965da5412d366d0wyllys# Track the synthetic manifests separately so we can properly express
d00756ccb34596a328f8a15d1965da5412d366d0wyllys# build rules and dependencies. The synthetic and real packages use
d00756ccb34596a328f8a15d1965da5412d366d0wyllys# different sets of transforms and macros for pkgmogrify.
d00756ccb34596a328f8a15d1965da5412d366d0wyllys# Any given package list may be empty, but we can only determine that
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# dynamically, so we always generate all lists.
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# The meanings of each package status are as follows:
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# PKGSTAT meaning
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# ---------- ----------------------------------------------------
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# noincorp Do not include in incorporation or group package
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying Lee# grouponly Include in group package, but not incorporation
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying Lee# obsolete Include in incorporation, but not group package
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying Lee# renamed Include in incorporation, but not group package
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# current Include in incorporation and group package
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# Since the semantics of the "noincorp" package status dictate that
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# such packages are not included in the incorporation or group packages,
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# there is no need to build noincorp package lists.
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# Since packages depend on their incorporation, noincorp necessarily
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# implies nodepend, or it would inadvertently pull in other packages.
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# Manifests are in either manifests or legacy directory - merge in $(PDIR)
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying Lee### Additional metadata generation
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying Lee# This should eventually move into pkg publication
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying LeeFONT_MANIFESTS :sh= (cd manifests; print system-font-*.p5m)
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying LeeFONT_METADATA = $(FONT_MANIFESTS:%.p5m=$(PDIR)/%.font)
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying LeeFONT_ATTRS = $(FONT_MANIFESTS:%.p5m=$(PDIR)/%.attr)
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying Lee $(PKGDEBUG)$(PERL) generate_font_metadata.pl \
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying Lee -p $(PROTODIR) -m $< > $@ || ( rm $@ ; exit 1 )
a44b45c8fa54b3a79a2de076aa2d8c48cd75dee4Huie-Ying Lee### Manifest mogrification
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# RELEASE = uname -r for the target release
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Generate pkgmogrify transform file with correct build version info in
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Build number is derived from last nv_XXX tag in hg log
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll @print "## Substituting build info in versions transformation template"
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll $(PKGDEBUG)XNV_BUILDNUM="$${XNV_BUILDNUM:-$$(hg log | \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys 'if ($$_ =~ m/^tag:\s+nv_([\d\.]+)/) { print $$1 ; exit}')}" ; \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys PKGVERS_BUILD="$${PKGVERS_BUILTON}-$${PKGVERS_BRANCH}" ; \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys $(PERL) -p -e "s{_PKGVERS_BUILD_}{$${PKGVERS_BUILD}};" \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys -e "s{_HG_ID_}{$${HG_ID}}" transforms/versions.tmpl > $@
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# Set variables used by pkgmogrify
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Most upstream packages provide specific version numbers instead of using
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# the default of $(OSPKGVERS)
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Some use $(X11PKGVERS) to refer to the X11 katamari version since they
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# bundle together components from multiple upstream packages with individual
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# version numbers
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Base URL for ARC cases used in opensolaris.arc_url metadata
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# These are the macros that may be used in package manifests
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll# Default transformations to apply
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys IngersollPM_TRANSFORMS = $(PKG_BRANDING_TRANSFORMS) \
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll common_actions publish restart_fmri facets \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysPKGDEP_INCORP = depend fmri=pkg:/consolidation/X/X-incorporation type=require
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllysPROC_CURRENT_PKGS = $(CURRENT_MANIFESTS:%.p5m=$(PDIR)/%.mog)
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# Extra transforms for non-legacy packages
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# Combine & uniq metadata & license attributes generated during build
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys system-font-*) ADDITIONAL_ATTRS="$(@:%.attr=%.font)" ;; \
d00756ccb34596a328f8a15d1965da5412d366d0wyllys ~(N)$(PROTOMETA)/$(@F:.attr=)/license_*.p5m /dev/null > $@
d00756ccb34596a328f8a15d1965da5412d366d0wyllys $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
d00756ccb34596a328f8a15d1965da5412d366d0wyllys $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys if [[ "$$NODEPEND" != "false" || "$$PKGSTAT" = "noincorp" ]]; \
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys if [[ "$$PKGSTAT" = "current" || "$$PKGSTAT" = "renamed" ]]; \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# make the package lists from the real manifests for the synthetic manifests
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys @print "## Generating $(@F:packages.%=%) package list"
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys -e 'if ($$_ =~ m{name=pkg.fmri value=(\S+)}) {' \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys -e ' printf "depend fmri=$$1 type=\$$(PKGDEP_TYPE)\n";' \
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll -e ' close ARGV; ' \
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll -e '}' $(PDIR)/*.metadata.$(@F:packages.%=%) > $(@).new
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# The package lists are generated with $(PKGDEP_TYPE) as their
6b35cb3cf158584a9408d44b9b6796564e8e1882Richard PALO# dependency types, so that they can be included by either an
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# incorporation or a group package.
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys$(PDIR)/X-incorporation.mog:= PKGDEP_TYPE= incorporate
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# rule to build the synthetic manifests
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys @print "## Processing synthetic manifest $(@F:%.mog=%.p5m)"
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
448b8615fe9e8af757530284920a235430ead7e8wyllys### Dependency detection
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys 'PLATFORM=i86hvm' \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys 'PLATFORM=i86pc' \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys 'PLATFORM=i86xpv' \
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll 'ISALIST=amd64' \
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll 'ISALIST=i386'
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll 'PLATFORM=sun4u' \
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll 'PLATFORM=sun4v' \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys 'ISALIST=sparcv9' \
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys 'ISALIST=sparc'
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys $(PKGDEBUG)if [[ ! -f $(@:%.dep=%.nodepend) ]]; then \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys @print "## Skipping dependency generation for $(@F:%.dep=%)"
d00756ccb34596a328f8a15d1965da5412d366d0wyllys### Dependency resolution
d00756ccb34596a328f8a15d1965da5412d366d0wyllys# This rule resolves dependencies across all published manifests.
d00756ccb34596a328f8a15d1965da5412d366d0wyllys# We should be able to do this with
d00756ccb34596a328f8a15d1965da5412d366d0wyllys# pkgdepend resolve -m $(PUB_PKGS:%.pub=%.dep)
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# but until 14113 is fixed, the incorporations confuse pkgdepend, so we
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# just create the .res file for DEP_SYNTH_PKGS directly.
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Root of pkg image to use for dependency resolution
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys# Normally / on the machine used to build the binaries
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys -$(PKGDEBUG)if [[ "$(SUPPRESSPKGDEP)" = "true" ]]; then \
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys print "## Suppressing dependency resolution"; \
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys print "## Resolving dependencies"; \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys### Repo setup
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Default in developer builds is "xnv-devel"
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# X RE cronjob build scripts override to "xnv-nightly" or "xnv-biweekly"
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Initialize the empty on-disk repositories
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys### Package publication to repo
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllysPUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys$(PDIR)/%.pub: $(PKGDEST) $(PDIR)/gendeps $(PDIR)/%.res
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll print "## Publishing $(@F:%.pub=%) to proto repository"; \
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys### Repo finalization
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll @print "## Creating repository metadata"
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersoll $(PKGDEBUG)/usr/lib/pkg.depotd -d $(PKGDEST) \
30a5e8fa1253cb33980ee4514743cf683f584b4ewyllys### Overall rules
e65e5c2d2f32a99e8c5f740cabae9075dab03ce7Wyllys Ingersollall: $(PROC_PKGS) $(PROC_SYNTH_PKGS) $(DEP_PKGS) $(DEP_SYNTH_PKGS) \
592106a23e99a1790d339bab84de7fa3474964a4Wyllys Ingersoll $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS)
592106a23e99a1790d339bab84de7fa3474964a4Wyllys Ingersoll# rules to validate proto area against manifests, and check for safe
592106a23e99a1790d339bab84de7fa3474964a4Wyllys Ingersoll# file permission modes
592106a23e99a1790d339bab84de7fa3474964a4Wyllys IngersollEXCEPTIONS= $(PWD)/../exception_lists/packaging $(PDIR)/generated-exceptions
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# Automatically exclude all pkg-config uninstalled.pc files, since those
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys# should never be packaged
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys $(PKGDEBUG)(cd $(PKGROOT) ; find . -name '*-uninstalled.pc') > $@
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys $(PKGDEBUG)validate_pkg -a $(PKGMACH) -v $(EXCEPTIONS:%=-e %) \
592106a23e99a1790d339bab84de7fa3474964a4Wyllys Ingersoll $(PKGDEBUG)validate_pkg -a $(PKGMACH) -M -m $(PDIR)
592106a23e99a1790d339bab84de7fa3474964a4Wyllys Ingersoll# Instead of fixing all the upstream packages to follow our permission rules
592106a23e99a1790d339bab84de7fa3474964a4Wyllys Ingersoll# just fix the proto area to match our rules
99ebb4ca412cb0a19d77a3899a87c055b9c30fa8wyllys @print "## Fixing proto area permissions"