Makefile revision 1152
0075dcb5aeeee4864fe9f64db82c8a8202bbe6d6henning mueller###############################################################################
777277547289aa27dd829f34bfa8ae6900cadbe7Eugen Kuksa# Makefile for X Consolidation packages
d0e19b833d7f9c691a36342c365029720c095742henning mueller# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
d8fe750649d3c87ea141981dde0182e879e27892Daniel Couto Vale# Permission is hereby granted, free of charge, to any person obtaining a
7a522a1916e13f0cdbf191f633a4fc2523444038Daniel Couto Vale# copy of this software and associated documentation files (the "Software"),
4b8c0f56a6a49c41dd0e9fdd28a27c4f35e2a208Julian Kornberger# to deal in the Software without restriction, including without limitation
ec96c6e3605c2e9eb5c0113e4e1b07b3b5228c8chenning mueller# the rights to use, copy, modify, merge, publish, distribute, sublicense,
d8fe750649d3c87ea141981dde0182e879e27892Daniel Couto Vale# and/or sell copies of the Software, and to permit persons to whom the
22e260fcd85642794d99c2ffaa333f2ef6ed7828Daniel Couto Vale# Software is furnished to do so, subject to the following conditions:
9f820b8418985826ffbe714a8c509ff34db315a7Julian Kornberger# The above copyright notice and this permission notice (including the next
d95c0de1fbdb66e2aa8d2dc223ad554413f1dc87Julian Kornberger# paragraph) shall be included in all copies or substantial portions of the
92c8f40524b3849c1964e357e13a4101b005c9acTimo Kohorst# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
aa7327ac2097bc1cec25790f373965b2531d80a4Timo Kohorst# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2e08e51b941a9fa3b4c23b14d427d45abf68244cTimo Kohorst# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
4b019622d4ba4514958de12f2609b8af960ce238Timo Kohorst# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8909576a7720b882ab11c3916bd02154f2fa65fchenning mueller# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
797d4d835625eaf5cf55d19f3a6073728dacbf76Daniel Couto Vale# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
986b1475ccd7f42e55f86db8212e52ddd69292f5Tim Reddehase# DEALINGS IN THE SOFTWARE.
20c94fa632f5b9a5a1b2fbc28fa46f2afe7c65c2Tim Reddehase###############################################################################
20c94fa632f5b9a5a1b2fbc28fa46f2afe7c65c2Tim Reddehase# Heavily inspired by / borrowed from the ON usr/src/pkg/Makefile
20c94fa632f5b9a5a1b2fbc28fa46f2afe7c65c2Tim Reddehase# Please read the comments in it and the accompanying README in ON for many
62b1e45efde570fb171801dbe2716d24a4b70ad8Eugen Kuksa# details omitted here.
4bc5ce05ccad8d66930671690afb2b1cee179c1bEugen Kuksa# Major differences in the X implementation:
e165d93c5dc7e3989fdbde84d77e7ffdd40d73e2Daniel Vale# - X only supports building one repo, not redist + extra
0cd37f42517da8081f1e90a0fdfbb82a526c1704henning mueller# - X only supports building packages on the same platform as the binaries,
933255de5cd0057b56c0684e867e0405ef908a5dEugen Kuksa# no cross-platform packaging
5b6f49391291b25c13e660ebdfcf80424cf941b2henning mueller# - X has no bfu legacy to deal with
725d1f9b70a60c140e264a476060022ecc384e5aDaniel Couto Vale# - ON has all manifests in one directory, X splits into current & legacy
725d1f9b70a60c140e264a476060022ecc384e5aDaniel Couto Vale# - Integrates with X consolidation makefile/build system instead of ON's
015f3b206cf74c7974d891c633e7d0ec8a0dc865Eugen Kuksa### Include common definitions
3eedfb6dd90308259bcfeddaa2cc883c1219df76henning mueller# We don't yet support building packages cross-architecture, but would
6563cb6fc17e253425e201dab181c945ec7c71b9Eugen Kuksa# need this if we ever did. (See "Cross platform packaging notes" in
6563cb6fc17e253425e201dab181c945ec7c71b9Eugen Kuksa# the ON usr/src/pkg/Makefile for what we'd have to do.)
6563cb6fc17e253425e201dab181c945ec7c71b9Eugen Kuksa# Map X makefile names to the ones used in the rules copied from ON
6563cb6fc17e253425e201dab181c945ec7c71b9Eugen Kuksa# More to be updated if we ever decide to support building cross-platform
c78b9d2b96505bd1c3f800bba797f16bb29e0f7fEugen Kuksa# Map the V=1 style of enabling more verbose build messages used in the
e5eca0bd6f33319aa50d148768a8e8f580598018Eugen Kuksa# X.Org/automake builds to the macro used in the rules copied from ON
e5eca0bd6f33319aa50d148768a8e8f580598018Eugen Kuksa# You can enable verbose output with either V=1 or PKGDEBUG=""
2d71e6ce37b0cd8de9ca2473399d040bbaafd3efEugen Kuksa# Commands used in rules copied from ON
93601837822998e6b847baa46d986f7cfc21d46fDaniel Couto Vale# To suppress package dependency generation on any system, regardless
78138263df40607408b1390049d9a1ae89756f95Eugen Kuksa# of how it was installed, set SUPPRESSPKGDEP=true in the build
823b204d13c129df1ae3b49ff62ee1da0c8f6b63Eugen Kuksa# environment.
a8dfb084fae639d0948cb334fb69525b574e185bEugen Kuksa# The packages directory will contain the processed manifests as
a8dfb084fae639d0948cb334fb69525b574e185bEugen Kuksa# direct build targets and subdirectories for package metadata extracted
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# incidentally during manifest processing.
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# Nothing underneath $(PDIR) should ever be managed by SCM.
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# By default, PKGS will list all manifests. To build and/or publish a
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# subset of packages, override this on the command line or in the
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# build environment and then reference (implicitly or explicitly) the all
4ae600b01cda15be2d0ef49dc3fc4ad9006911d7Tim Reddehase# or install targets.
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning muellerCURRENT_MANIFESTS :sh= (cd manifests; print *.p5m)
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning muellerLEGACY_MANIFESTS :sh= (cd legacy; print *.p5m)
a4707bb77f9894e31b9e5b924c34e0095681cfe3Eugen KuksaMANIFESTS = $(CURRENT_MANIFESTS) $(LEGACY_MANIFESTS)
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# Track the synthetic manifests separately so we can properly express
7ef46b1adca473f664769a44a378e9f08385d3a0Julian Kornberger# build rules and dependencies. The synthetic and real packages use
777277547289aa27dd829f34bfa8ae6900cadbe7Eugen Kuksa# different sets of transforms and macros for pkgmogrify.
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning muellerSYNTH_PKGS= X-incorporation X-redistributable
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# Any given package list may be empty, but we can only determine that
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# dynamically, so we always generate all lists.
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# The meanings of each package status are as follows:
a2cfedf970eadd36fa2b5e81c2e8a24396a86792Daniel Couto Vale# PKGSTAT meaning
a2cfedf970eadd36fa2b5e81c2e8a24396a86792Daniel Couto Vale# ---------- ----------------------------------------------------
a2cfedf970eadd36fa2b5e81c2e8a24396a86792Daniel Couto Vale# noincorp Do not include in incorporation or group package
a2cfedf970eadd36fa2b5e81c2e8a24396a86792Daniel Couto Vale# grouponly Include in group package, but not incorporation
a2cfedf970eadd36fa2b5e81c2e8a24396a86792Daniel Couto Vale# obsolete Include in incorporation, but not group package
a2cfedf970eadd36fa2b5e81c2e8a24396a86792Daniel Couto Vale# renamed Include in incorporation, but not group package
0e1c499cb42cf4a474994fe7a3307c9ea91506c2Tim Reddehase# current Include in incorporation and group package
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# Since the semantics of the "noincorp" package status dictate that
777277547289aa27dd829f34bfa8ae6900cadbe7Eugen Kuksa# such packages are not included in the incorporation or group packages,
46dd7ca898be6d5dbdfda64fd90ce01e253c0878Julian Kornberger# there is no need to build noincorp package lists.
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# Since packages depend on their incorporation, noincorp necessarily
f3b8c4da2db512a2ad58709c1c6bb0d93d1866bbhenning mueller# implies nodepend, or it would inadvertently pull in other packages.
6ef37875f247fe11ed2d07014ad74711ee17321cEugen Kuksa# Manifests are in either manifests or legacy directory - merge in $(PDIR)
985ad360b6abec4b1133f231e37c3163110f00c1Eugen Kuksa### Additional metadata generation
296f03208bf82551e7ab646c8b874d618d9c44a4Eugen Kuksa# This should eventually move into pkg publication
296f03208bf82551e7ab646c8b874d618d9c44a4Eugen KuksaFONT_MANIFESTS :sh= (cd manifests; print system-font-*.p5m)
296f03208bf82551e7ab646c8b874d618d9c44a4Eugen KuksaFONT_METADATA = $(FONT_MANIFESTS:%.p5m=$(PDIR)/%.font)
296f03208bf82551e7ab646c8b874d618d9c44a4Eugen KuksaFONT_ATTRS = $(FONT_MANIFESTS:%.p5m=$(PDIR)/%.attr)
794d8870f2d40edebbfb02f103ce1fb8091bdb67Eugen Kuksa### Manifest mogrification
8ca8c974c5b60b881e5e509c33a7c2ab56eb4acfEugen Kuksa# RELEASE = uname -r for the target release
12499f46bb83dba7d8c5ef4ab9d9e5a592f99f12Tim Reddehase# Generate pkgmogrify transform file with correct build version info in
986b1475ccd7f42e55f86db8212e52ddd69292f5Tim Reddehase# Build number is derived from last nv_XXX tag in hg log
12499f46bb83dba7d8c5ef4ab9d9e5a592f99f12Tim Reddehase$(PDIR)/versions: transforms/versions.tmpl $(PDIR)
12499f46bb83dba7d8c5ef4ab9d9e5a592f99f12Tim Reddehase @print "## Substituting build info in versions transformation template"
fbe72315a0dc517cba60b5ec6f156d64139c1f3fTim Reddehase $(PKGDEBUG)XNV_BUILDNUM="$${XNV_BUILDNUM:-$$(hg log | \
fbe72315a0dc517cba60b5ec6f156d64139c1f3fTim Reddehase 'if ($$_ =~ m/^tag:\s+nv_([\d\.]+)/) { print $$1 ; exit}')}" ; \
b5513f660ba0c032a3667f9628e303e498e66b20Tim Reddehase PKGVERS_BUILD="$${PKGVERS_BUILTON}-$${PKGVERS_BRANCH}" ; \
bd870b52ef7afb26c0c6671c5ca4a620998ff57fTim Reddehase $(PERL) -p -e "s{_PKGVERS_BUILD_}{$${PKGVERS_BUILD}};" \
bd870b52ef7afb26c0c6671c5ca4a620998ff57fTim Reddehase -e "s{_HG_ID_}{$${HG_ID}}" transforms/versions.tmpl > $@
b5513f660ba0c032a3667f9628e303e498e66b20Tim Reddehase# Set variables used by pkgmogrify
12499f46bb83dba7d8c5ef4ab9d9e5a592f99f12Tim Reddehase# These are the macros that may be used in package manifests
12499f46bb83dba7d8c5ef4ab9d9e5a592f99f12Tim Reddehase# Most upstream packages provide specific version numbers instead of using
12499f46bb83dba7d8c5ef4ab9d9e5a592f99f12Tim Reddehase# the default of $(OSPKGVERS)
9b9d0de2b383747e766f7734b9de2521c6663e43Tim Reddehase# Some use $(X11PKGVERS) to refer to the X11 katamari version since they
9b9d0de2b383747e766f7734b9de2521c6663e43Tim Reddehase# bundle together components from multiple upstream packages with individual
9b9d0de2b383747e766f7734b9de2521c6663e43Tim Reddehase# version numbers
9b9d0de2b383747e766f7734b9de2521c6663e43Tim Reddehase# Base URL for ARC cases used in opensolaris.arc_url metadata
9b9d0de2b383747e766f7734b9de2521c6663e43Tim ReddehasePKGMOG_DEFINES += ARC_URL='http://arc.opensolaris.org/caselog/'
85740b8f9c770963a1fe3a993c1745fb4f4f5ea8Tim Reddehase# Platform specific choices
85740b8f9c770963a1fe3a993c1745fb4f4f5ea8Tim ReddehasePKGMOG_DEFINES += i386_ONLY=$(POUND_SIGN) sparc_ONLY=$(POUND_SIGN)
85740b8f9c770963a1fe3a993c1745fb4f4f5ea8Tim Reddehase# Architecture specific directory names
f8c2def0cfd21d8c73a7932919fae27c0db03297Eugen Kuksa# Perl version string used in package names, such as pkg:/runtime/perl-512
a4707bb77f9894e31b9e5b924c34e0095681cfe3Eugen KuksaPERL_PKG_VERSION_CMD = print $(PERL_VERSION) | tr -d '.'
823b204d13c129df1ae3b49ff62ee1da0c8f6b63Eugen KuksaPKGMOG_DEFINES += PERL_PKG_VERSION=$(PERL_PKG_VERSION_CMD:sh)
985ad360b6abec4b1133f231e37c3163110f00c1Eugen Kuksa# Python version string used in path names, such as /usr/lib/python2.6
520161da45e61680de226baab3de17ce30fbce25Tim ReddehasePKGMOG_DEFINES += PYTHON_PATH_VERSION=$(PYTHON_VERSION)
985ad360b6abec4b1133f231e37c3163110f00c1Eugen Kuksa# Python version string used in package names, such as pkg:/runtime/python-26
985ad360b6abec4b1133f231e37c3163110f00c1Eugen KuksaPYTHON_PKG_VERSION_CMD = print $(PYTHON_VERSION) | tr -d '.'
41a6f02b1f3a85f740ff745a49e7457d564162ebEugen KuksaPKGMOG_DEFINES += PYTHON_PKG_VERSION=$(PYTHON_PKG_VERSION_CMD:sh)
41a6f02b1f3a85f740ff745a49e7457d564162ebEugen Kuksa# Default transformations to apply
-e 'if ($$_ =~ m{name=pkg.fmri value=(\S+)}) {' \
$(PKGDEBUG)if [[ -s $< ]] ; then \
$(CP) $< $@ ; \
if [[ -s $$p.res ]]; then \
$(PKGDEST):
lint:
$(PKGLINT_REFERENCE_REPO:%=-r %) \
# Automatically exclude all pkg-config uninstalled.pc files, since those
# Handle exceptions list exceptions-validate_pkg.p5m