Makefile revision 1139
###############################################################################
#
# Makefile for X Consolidation packages
#
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
###############################################################################
# Please read the comments in it and the accompanying README in ON for many
# details omitted here.
# Major differences in the X implementation:
# - X only supports building one repo, not redist + extra
# - X only supports building packages on the same platform as the binaries,
# no cross-platform packaging
# - X has no bfu legacy to deal with
# - ON has all manifests in one directory, X splits into current & legacy
### Include common definitions
# We don't yet support building packages cross-architecture, but would
# need this if we ever did. (See "Cross platform packaging notes" in
# Map X makefile names to the ones used in the rules copied from ON
# More to be updated if we ever decide to support building cross-platform
# Map the V=1 style of enabling more verbose build messages used in the
#
# You can enable verbose output with either V=1 or PKGDEBUG=""
PKGDEBUG_V_0 = @
PKGDEBUG_V_ = $(PKGDEBUG_V_0)
# Commands used in rules copied from ON
#
# To suppress package dependency generation on any system, regardless
# of how it was installed, set SUPPRESSPKGDEP=true in the build
# environment.
#
SUPPRESSPKGDEP= false
#
# The packages directory will contain the processed manifests as
# direct build targets and subdirectories for package metadata extracted
# incidentally during manifest processing.
#
# Nothing underneath $(PDIR) should ever be managed by SCM.
#
$(PDIR):
mkdir -p $@
#
# subset of packages, override this on the command line or in the
# build environment and then reference (implicitly or explicitly) the all
# or install targets.
#
#
# Track the synthetic manifests separately so we can properly express
# build rules and dependencies. The synthetic and real packages use
# different sets of transforms and macros for pkgmogrify.
#
# Any given package list may be empty, but we can only determine that
# dynamically, so we always generate all lists.
#
# The meanings of each package status are as follows:
#
# PKGSTAT meaning
# ---------- ----------------------------------------------------
# noincorp Do not include in incorporation or group package
# grouponly Include in group package, but not incorporation
# obsolete Include in incorporation, but not group package
# renamed Include in incorporation, but not group package
# current Include in incorporation and group package
#
# Since the semantics of the "noincorp" package status dictate that
# such packages are not included in the incorporation or group packages,
# there is no need to build noincorp package lists.
#
# Since packages depend on their incorporation, noincorp necessarily
# implies nodepend, or it would inadvertently pull in other packages.
#
PKGLISTS= \
$(PDIR)/packages.current \
$(PDIR)/packages.grouponly \
$(PDIR)/packages.renamed \
# Manifests are in either manifests or legacy directory - merge in $(PDIR)
manifests: $(PMANIFESTS)
$(PMANIFESTS): $(PDIR)
### Additional metadata generation
# This should eventually move into pkg publication
$(FONT_ATTRS): $(FONT_METADATA)
@print "## Generating font metadata in $(@F)"
### Manifest mogrification
# RELEASE = uname -r for the target release
RELEASE = 5.11
# Generate pkgmogrify transform file with correct build version info in
# Build number is derived from last nv_XXX tag in hg log
@print "## Substituting build info in versions transformation template"
'if ($$_ =~ m/^tag:\s+nv_([\d\.]+)/) { print $$1 ; exit}')}" ; \
PKGVERS_BRANCH="0.$${XNV_BUILDNUM}" ; \
PKGVERS_BUILD="$${PKGVERS_BUILTON}-$${PKGVERS_BRANCH}" ; \
$(PERL) -p -e "s{_PKGVERS_BUILD_}{$${PKGVERS_BUILD}};" \
# Set variables used by pkgmogrify
# These are the macros that may be used in package manifests
# Most upstream packages provide specific version numbers instead of using
# the default of $(OSPKGVERS)
# Some use $(X11PKGVERS) to refer to the X11 katamari version since they
# bundle together components from multiple upstream packages with individual
# version numbers
# Base URL for ARC cases used in opensolaris.arc_url metadata
# Platform specific choices
# Architecture specific directory names
# Default transformations to apply
# Extra transforms for non-legacy packages
# Combine & uniq metadata & license attributes generated during build
@print "## Gathering metadata from build for $(@F)"
esac ; \
$(PKGDEBUG)if [[ -f $(@) ]]; then \
then \
fi; \
$(LN) -s $(@F) \
then \
print $(PKGDEP_INCORP) >> $(@); \
fi; \
else \
$(TOUCH) $(@); \
fi
# make the package lists from the real manifests for the synthetic manifests
-e 'if ($$_ =~ m{name=pkg.fmri value=(\S+)}) {' \
-e ' printf "depend fmri=$$1 type=\$$(PKGDEP_TYPE)\n";' \
-e ' close ARGV; ' \
# The package lists are generated with $(PKGDEP_TYPE) as their
# dependency types, so that they can be included by either an
# incorporation or a group package.
#
# rule to build the synthetic manifests
### Dependency detection
'PLATFORM=i86hvm' \
'PLATFORM=i86pc' \
'PLATFORM=i86xpv' \
'ISALIST=amd64' \
'ISALIST=i386'
'PLATFORM=sun4u' \
'PLATFORM=sun4v' \
'ISALIST=sparcv9' \
'ISALIST=sparc'
@print "## Generating dependencies for $(<F)"
$(PKGROOT) > $(@); \
else \
fi
$(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog)
### Dependency resolution
#
# This rule resolves dependencies across all published manifests.
# We should be able to do this with
#
# pkgdepend resolve -m $(PUB_PKGS:%.pub=%.dep)
#
# but until 14113 is fixed, the incorporations confuse pkgdepend, so we
# just create the .res file for DEP_SYNTH_PKGS directly.
#
# Root of pkg image to use for dependency resolution
# Normally / on the machine used to build the binaries
print "## Suppressing dependency resolution"; \
done; \
else \
print "## Resolving dependencies"; \
$(PKGDEP_VERBOSE_FLAG) -m $(DEP_PKGS); \
done; \
fi
do \
done
### pkglint checking (pre-publication)
#
# This rule runs pkglint across all manifests to be published.
#
# We require that packages be free from lint ERRORs before allowing them
# to be published. Lint WARNINGs are acceptable (though unpleasant)
# The list of packages is the list of packages that did not resolve to
# 0-byte files, $CHECK_PKGS
#
@print "## Checking packages"
if [[ -s $$p.res ]]; then \
CHECK_PKGS="$$p.res $${CHECK_PKGS}"; \
fi; \
done; \
if [[ -n "$${CHECK_PKGS}" ]]; then \
fi ; \
return 1; \
fi
### Repo setup
# Default in developer builds is "xnv-devel"
# X RE cronjob build scripts override to "xnv-nightly" or "xnv-biweekly"
# Initialize the empty on-disk repositories
$(PKGDEST):
@print "## Initializing $(@F)"
### Package publication to repo
fi; \
$(TOUCH) $(@)
### Repo finalization
@print "## Creating repository metadata"
### pkglint checking (post-publication)
#
# Perform a pkglint run on the published repositories. We remove package
# version information from the lint output so that it is comparable across
# lint runs.
#
lint:
$(PKGLINT_REFERENCE_REPO:%=-r %) \
### Overall rules
#
# rules to validate proto area against manifests, and check for safe
# file permission modes
#
# Automatically exclude all pkg-config uninstalled.pc files, since those
# should never be packaged
# Handle exceptions list exceptions-validate_pkg.p5m
# Instead of fixing all the upstream packages to follow our permission rules
# just fix the proto area to match our rules
@print "## Fixing proto area permissions"