Makefile revision 1527
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi###############################################################################
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Makefile for X Consolidation packages
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Permission is hereby granted, free of charge, to any person obtaining a
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# copy of this software and associated documentation files (the "Software"),
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# to deal in the Software without restriction, including without limitation
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# the rights to use, copy, modify, merge, publish, distribute, sublicense,
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# and/or sell copies of the Software, and to permit persons to whom the
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Software is furnished to do so, subject to the following conditions:
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# The above copyright notice and this permission notice (including the next
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# paragraph) shall be included in all copies or substantial portions of the
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Software.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# DEALINGS IN THE SOFTWARE.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi###############################################################################
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Heavily inspired by / borrowed from the ON usr/src/pkg/Makefile
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Please read the comments in it and the accompanying README in ON for many
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# details omitted here.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Major differences in the X implementation:
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# - X only supports building one repo, not redist + extra
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# - X only supports building packages on the same platform as the binaries,
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# no cross-platform packaging
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# - X has no bfu legacy to deal with
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# - ON has all manifests in one directory, X splits into current & legacy
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# - Integrates with X consolidation makefile/build system instead of ON's
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPWD:sh=pwd
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiTOP=$(PWD)/..
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi### Include common definitions
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumiinclude $(TOP)/open-src/common/Makefile.init
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi.SUFFIXES: .p5m .mog .dep .res .pub
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# We don't yet support building packages cross-architecture, but would
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# need this if we ever did. (See "Cross platform packaging notes" in
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# the ON usr/src/pkg/Makefile for what we'd have to do.)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMACH = $(MACH)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Map X makefile names to the ones used in the rules copied from ON
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# More to be updated if we ever decide to support building cross-platform
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGROOT = $(PROTODIR)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEST = $(PROTOTOP)/pkg_$(PKGMACH)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Map the V=1 style of enabling more verbose build messages used in the
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# X.Org/automake builds to the macro used in the rules copied from ON
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# You can enable verbose output with either V=1 or PKGDEBUG=""
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEBUG_V_0 = @
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEBUG_V_1 =
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEBUG_V_ = $(PKGDEBUG_V_0)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEBUG = $(PKGDEBUG_V_$(V))
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Commands used in rules copied from ON
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiCP= /usr/bin/cp -f
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiLN= /usr/bin/ln
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiMV= /usr/bin/mv -f
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiRM= /usr/bin/rm -f
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiSED= /usr/bin/sed
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiTOUCH= /usr/bin/touch
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# To suppress package dependency generation on any system, regardless
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# of how it was installed, set SUPPRESSPKGDEP=true in the build
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# environment.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiSUPPRESSPKGDEP= false
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# The packages directory will contain the processed manifests as
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# direct build targets and subdirectories for package metadata extracted
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# incidentally during manifest processing.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Nothing underneath $(PDIR) should ever be managed by SCM.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPDIR= build-$(PKGMACH)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR):
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi mkdir -p $@
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# By default, PKGS will list all manifests. To build and/or publish a
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# subset of packages, override this on the command line or in the
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# build environment and then reference (implicitly or explicitly) the all
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# or install targets.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiCURRENT_MANIFESTS :sh= (cd manifests; print *.p5m)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiLEGACY_MANIFESTS :sh= (cd legacy; print *.p5m)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiMANIFESTS = $(CURRENT_MANIFESTS) $(LEGACY_MANIFESTS)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGS= $(MANIFESTS:%.p5m=%)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Track the synthetic manifests separately so we can properly express
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# build rules and dependencies. The synthetic and real packages use
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# different sets of transforms and macros for pkgmogrify.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiSYNTH_PKGS= X-incorporation
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiSYNTH_MANIFESTS = $(SYNTH_PKGS:%=%.p5m)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Special manifest for exceptions to pass to pkglint & validate_pkg
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiEXCEPTION_MANIFESTS = exceptions-validate_pkg.p5m
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Manifests are in either manifests or legacy directory - merge in $(PDIR)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/%.p5m: manifests/%.p5m
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(LN) -s ../$< $@
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/%.p5m: legacy/%.p5m
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(LN) -s ../$< $@
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/%.p5m: %.p5m
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(LN) -s ../$< $@
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiALL_MANIFEST_SRCS = $(MANIFESTS) $(SYNTH_MANIFESTS) $(EXCEPTION_MANIFESTS)
92cbfdaf682dca9cf60243f23c2e911181bfc7abKATOH YasufumiALL_MANIFESTS = $(ALL_MANIFEST_SRCS:%=$(PDIR)/%)
92cbfdaf682dca9cf60243f23c2e911181bfc7abKATOH Yasufumimanifests: $(ALL_MANIFESTS)
92cbfdaf682dca9cf60243f23c2e911181bfc7abKATOH Yasufumi$(ALL_MANIFESTS): $(PDIR)
92cbfdaf682dca9cf60243f23c2e911181bfc7abKATOH Yasufumi
92cbfdaf682dca9cf60243f23c2e911181bfc7abKATOH Yasufumi### Additional metadata generation
92cbfdaf682dca9cf60243f23c2e911181bfc7abKATOH Yasufumi
92cbfdaf682dca9cf60243f23c2e911181bfc7abKATOH Yasufumi$(PROTOMETA)/%/:
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)mkdir -p $@
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Generate default copyright notice for packages without contents
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PROTOMETA)/%/cr_Oracle: $(PDIR)/%.p5m $(PROTOMETA)/%/
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)gsed -n -e '/# Copyright .* Oracle/ {' \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi -e 's/^# //' -e 'p' -e 'q' -e'}' $< > $@
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiSYNTH_LICENSES = $(SYNTH_PKGS:%=$(PROTOMETA)/%/cr_Oracle)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# This should eventually move into pkg publication
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiFONT_MANIFESTS :sh= (cd manifests; print system-font-*.p5m)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiFONT_METADATA = $(FONT_MANIFESTS:%.p5m=$(PDIR)/%.font)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiFONT_ATTRS = $(FONT_MANIFESTS:%.p5m=$(PDIR)/%.attr)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(FONT_ATTRS): $(FONT_METADATA)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiFONT_LIBS_PATH=$(PROTODIR)$(X11_SERVERLIBS_DIR)$(LIBSUBDIR_64):$(PROTODIR)$(X11_DIR)/lib$(LIBSUBDIR_64):$(PROTODIR)/usr/lib$(LIBSUBDIR_64)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/%.font: $(PDIR)/%.p5m
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Generating font metadata in $(@F)"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(RM) $(@)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)LD_LIBRARY_PATH=$(FONT_LIBS_PATH) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PERL) generate_font_metadata.pl \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi -p $(PROTODIR) -m $< > $@ || ( rm $@ ; exit 1 )
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi### Manifest mogrification
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOGRIFY = pkgmogrify
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# RELEASE = uname -r for the target release
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiRELEASE = 5.12
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGVERS_BUILTON = $(RELEASE)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# The PKGVERS_BRANCH is determined by the values in the Makefile.buildnum
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# PSARC 2012/240 for package version scheme
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumiinclude Makefile.buildnum
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGVERS_BRANCH_MAIN = 5.12.$(UPDATENUM).$(SRUNUM).$(PLATNUM)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGVERS_BRANCH = $(PKGVERS_BRANCH_MAIN).$(BUILDID).$(NIGHTLYID)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGVERS_BUILD = $(PKGVERS_BUILTON)-$(PKGVERS_BRANCH)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Generate pkgmogrify transform file with correct build version info in
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Build number is derived from last nv_XXX tag in hg log
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/versions: transforms/versions.tmpl $(PDIR)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Substituting build info in versions transformation template"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG) HG_ID="$$(hg id)" ; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PERL) -p -e "s{_PKGVERS_BUILD_}{$(PKGVERS_BUILD)};" \
db821c3a4168c9c1072a433340e6009892e26cf2KATOH Yasufumi -e "s{_HG_ID_}{$${HG_ID}}" transforms/versions.tmpl > $@
db821c3a4168c9c1072a433340e6009892e26cf2KATOH Yasufumi
db821c3a4168c9c1072a433340e6009892e26cf2KATOH Yasufumi# Set variables used by pkgmogrify
db821c3a4168c9c1072a433340e6009892e26cf2KATOH Yasufumi# These are the macros that may be used in package manifests
db821c3a4168c9c1072a433340e6009892e26cf2KATOH YasufumiPKGMOG_DEFINES =
db821c3a4168c9c1072a433340e6009892e26cf2KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Most upstream packages provide specific version numbers instead of using
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# the default of $(OSPKGVERS)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Some use $(X11PKGVERS) to refer to the X11 katamari version since they
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# bundle together components from multiple upstream packages with individual
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# version numbers
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += X11PKGVERS=7.7
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += OSPKGVERS=$(RELEASE)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Base URL for ARC cases used in opensolaris.arc_url metadata
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += ARC_URL='http://arc.opensolaris.org/caselog/'
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Platform specific choices
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += i386_ONLY=$(POUND_SIGN) sparc_ONLY=$(POUND_SIGN)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += $(PKGMACH)_ONLY=
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Architecture specific directory names
a1e4c206d5373b8ecd7906bff37f2601d65f022cKATOH YasufumiPKGMOG_DEFINES += ARCH=$(PKGMACH)
0dc296145715c36795ad0ad561f115afdd758223KATOH YasufumiPKGMOG_DEFINES += ARCH32=$(SUBDIR32_$(PKGMACH))
a1e4c206d5373b8ecd7906bff37f2601d65f022cKATOH YasufumiPKGMOG_DEFINES += ARCH64=$(SUBDIR64_$(PKGMACH))
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Perl version string used in package names, such as pkg:/runtime/perl-512
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPERL_PKG_VERSION_CMD = print $(PERL_VERSION) | tr -d '.'
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += PERL_PKG_VERSION=$(PERL_PKG_VERSION_CMD:sh)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Python version string used in path names, such as /usr/lib/python2.6
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += PYTHON_PATH_VERSION=$(PYTHON_VERSION)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Python version string used in package names, such as pkg:/runtime/python-26
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPYTHON_PKG_VERSION_CMD = print $(PYTHON_VERSION) | tr -d '.'
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += PYTHON_PKG_VERSION=$(PYTHON_PKG_VERSION_CMD:sh)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# automake version needed for build dependencies
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiAUTOMAKE_PKG_VERSION_CMD = print $(AUTOMAKE_VERSION) | tr -d '.'
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += AUTOMAKE_PKG_VERSION=$(AUTOMAKE_PKG_VERSION_CMD:sh)
41e8e807c8e85289bb717a365056b9437555e25aKATOH Yasufumi
41e8e807c8e85289bb717a365056b9437555e25aKATOH Yasufumi# gcc version needed for build dependencies
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiGCC_PKG_VERSION_CMD = print $(GCC_VERSION) | tr -d '.'
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGMOG_DEFINES += GCC_PKG_VERSION=$(GCC_PKG_VERSION_CMD:sh)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPROC_PKGS = $(PKGS:%=$(PDIR)/%.mog)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPROC_CURRENT_PKGS = $(CURRENT_MANIFESTS:%.p5m=$(PDIR)/%.mog)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPROC_LEGACY_PKGS = $(LEGACY_MANIFESTS:%.p5m=$(PDIR)/%.mog)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPROC_SYNTH_PKGS = $(SYNTH_MANIFESTS:%.p5m=$(PDIR)/%.mog)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPROC_EXCEPTIONS = $(EXCEPTION_MANIFESTS:%.p5m=$(PDIR)/%.mog)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Default transformations to apply
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPM_TRANSFORMS = $(PKG_BRANDING_TRANSFORMS) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi common_actions publish restart_fmri facets \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PDIR)/versions
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPM_INC = transforms
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Additional transforms for specific types of packages
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PROC_CURRENT_PKGS) $(PROC_SYNTH_PKGS) $(PROC_EXCEPTIONS) := \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi EXTRA_TRANSFORMS = defaults
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumimogrify: $(PROC_PKGS) $(PROC_EXCEPTIONS)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PROC_PKGS) $(PROC_SYNTH_PKGS): $(PDIR)/versions
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Combine & uniq metadata & license attributes generated during build
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/%.attr:
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Gathering metadata from build for $(@F)"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)case '$(@F)' in \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi system-font-*) ADDITIONAL_ATTRS="$(@:%.attr=%.font)" ;; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi esac ; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PERL) merge-metadata.pl $${ADDITIONAL_ATTRS} \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi ~(N)$(PROTOMETA)/$(@F:.attr=)/attributes_*.p5m \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi ~(N)$(PROTOMETA)/$(@F:.attr=)/license_*.p5m /dev/null > $@
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/%.mog: $(PDIR)/%.p5m $(PDIR)/%.attr
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Processing manifest $(@F:.mog=.p5m)"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(@:%.mog=%.metadata.*) $(@:%.mog=%.synth)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGMOG_DEFINES:%=-D %) -O $(@) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(@:%.mog=%.p5m) $(@:%.mog=%.attr) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PM_TRANSFORMS) $(EXTRA_TRANSFORMS)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(TOUCH) $(@)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# List of all packages we build, used in open source code release zip files
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(TOP)/pkglist.txt:
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Generating pkglist.txt"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGMOG_DEFINES:%=-D %) -O /dev/null \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi -I manifests -I legacy $(ALL_MANIFEST_SRCS) extract_names \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi | LC_ALL=C sort -u > $(@)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi### Dependency detection
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Package manifest containing list of packages to use in dependency
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# resolution, and not containing any dependencies to be detected/resolved.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_LIST_PKG = developer-opensolaris-X
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_CURRENT_PKGS_1 = $(CURRENT_MANIFESTS:%.p5m=$(PDIR)/%.dep)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_CURRENT_PKGS = $(DEP_CURRENT_PKGS_1:$(PDIR)/$(DEP_LIST_PKG).dep=)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_LEGACY_PKGS = $(LEGACY_MANIFESTS:%.p5m=$(PDIR)/%.dep)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_LEGACY_PKGS += $(DEP_LIST_PKG:%=$(PDIR)/%.dep)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_SYNTH_PKGS = $(SYNTH_MANIFESTS:%.p5m=$(PDIR)/%.dep)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEP_TOKENS_i386= \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'PLATFORM=i86hvm' \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'PLATFORM=i86pc' \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'PLATFORM=i86xpv' \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'ISALIST=amd64' \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'ISALIST=i386'
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEP_TOKENS_sparc= \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'PLATFORM=sun4u' \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'PLATFORM=sun4v' \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'ISALIST=sparcv9' \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi 'ISALIST=sparc'
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH))
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/%.dep: $(PDIR)/%.mog
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Generating dependencies for $(<F)"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(RM) $(@)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)if [[ "$(SUPPRESSPKGDEP)" != "true" ]]; then \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGROOT) > $(@); \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi else \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(CP) $(<) $(@); \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi fi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(DEP_SYNTH_PKGS) $(DEP_LEGACY_PKGS): $$(@:%.dep=%.mog)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Skipping dependency generation for $(@F:%.dep=%)"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi### Dependency resolution
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_RES_PKGS = $(DEP_PKGS:%=%.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_RES_CURRENT_PKGS = $(DEP_CURRENT_PKGS:%=%.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_RES_LEGACY_PKGS = $(DEP_LEGACY_PKGS:%=%.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiDEP_RES_SYNTH_PKGS = $(DEP_SYNTH_PKGS:%=%.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEP_VERBOSE_FLAG_0 =
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEP_VERBOSE_FLAG_1 = -v
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEP_VERBOSE_FLAG = $(PKGDEP_VERBOSE_FLAG_$(V))
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Root of pkg image to use for dependency resolution
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Normally / on the machine used to build the binaries
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEP_RESOLVE_IMAGE = /
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# File listing packages to consider in dependency resolution.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Automatically generated from the developer package to ensure they
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# stay in sync.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGDEP_RESOLVE_LIST = $(PDIR)/resolve.deps
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PKGDEP_RESOLVE_LIST): $(PDIR)/$(DEP_LIST_PKG).mog
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Generating package list for dependency resolution"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi -O /dev/null -P $(@) $(PDIR)/$(DEP_LIST_PKG).mog extract_depends
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# This rule resolves dependencies across all manifests for packages
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# currently delivering files.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/gendeps: $(DEP_CURRENT_PKGS) $(PKGDEP_RESOLVE_LIST)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)if [[ "$(SUPPRESSPKGDEP)" = "true" ]]; then \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi print "## Suppressing dependency resolution"; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi for p in $(DEP_CURRENT_PKGS:%.dep=%); do \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(CP) $$p.dep $$p.dep.res; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi done; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi else \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi print "## Resolving dependencies"; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve -E \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEP_VERBOSE_FLAG) -e $(PKGDEP_RESOLVE_LIST) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi -m $(DEP_CURRENT_PKGS) ; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi fi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(TOUCH) $(@)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumigendeps: $(PDIR)/gendeps
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(DEP_RES_CURRENT_PKGS): $(PDIR)/gendeps
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(DEP_RES_SYNTH_PKGS) $(DEP_RES_LEGACY_PKGS): $$(@:%.dep.res=%.dep)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Skipping dependency generation for $(@F:%.dep.res=%)"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(CP) $(@:%.dep.res=%.dep) $(@)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# Post-processing of manifests after dependency resolution
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiRES_PKGS = $(PKGS:%=$(PDIR)/%.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiRES_CURRENT_PKGS = $(CURRENT_MANIFESTS:%.p5m=$(PDIR)/%.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiRES_LEGACY_PKGS = $(LEGACY_MANIFESTS:%.p5m=$(PDIR)/%.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiRES_SYNTH_PKGS = $(SYNTH_MANIFESTS:%.p5m=$(PDIR)/%.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPOST_TRANSFORMS = post-pkgdepend extract_metadata
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/%.res: $(PDIR)/%.dep.res
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Post-processing manifest for $(@F:%.res=%)"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)if [[ -s $< ]] ; then \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi -O $@ -P $(@:%.res=%.synth) $< $(POST_TRANSFORMS) ; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi else \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(CP) $< $@ ; \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi fi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
853d58fdf5af0960b7b6edc9dea0fadddb8535f1Elan Ruusamäe# Generate info for synthetic manifests
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(RES_SYNTH_PKGS): $(RES_PKGS) $$(@:%.res=%.dep.res)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Gathering package lists for synthetic package $(@F:%.res=%)"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi -O $(@) -P $(@:%.res=%.synth.sed) \
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(@:%.res=%.dep.res) synthetic
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi $(PKGDEBUG)$(SED) -n -f $(@:%.res=%.synth.sed) $(PDIR)/*.synth >> $(@)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi### pkglint checking (pre-publication)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGLINT = pkglint
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH YasufumiPKGLINTRC = prepub-pkglintrc
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# This rule runs pkglint across all manifests to be published.
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# We require that packages be free from lint ERRORs before allowing them
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# to be published. Lint WARNINGs are acceptable (though unpleasant)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# The list of packages is the list of packages that did not resolve to
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi# 0-byte files, $CHECK_PKGS
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi#
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi$(PDIR)/checkmf: $(PDIR)/gendeps $(DEP_SYNTH_PKGS) $(DEP_PKGS)
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @print "## Checking packages"
cab79123082bef9ba265c9c8b9176b8b8afedd64KATOH Yasufumi @$(RM) $@
@$(TOUCH) $(PDIR)/pkglint-output.txt
-$(PKGDEBUG)for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
if [[ -s $$p.res ]]; then \
CHECK_PKGS="$$p.res $${CHECK_PKGS}"; \
fi; \
done; \
if [[ -n "$${CHECK_PKGS}" ]]; then \
$(PKGLINT) -f $(PKGLINTRC) $${CHECK_PKGS} $(PROC_EXCEPTIONS) \
2> $(PDIR)/pkglint-output.txt; \
fi ; \
if grep '^ERROR' $(PDIR)/pkglint-output.txt; then \
return 1; \
fi
@$(TOUCH) $@
### Repo setup
# Default in developer builds is "xnv-devel"
# X RE cronjob build scripts override to "xnv-nightly"
PKGPUBLISHER = xnv-devel
# Initialize the empty on-disk repositories
$(PKGDEST):
@print "## Initializing $(@F)"
$(PKGDEBUG)pkgrepo create --version 4 $(@)
$(PKGDEBUG)pkgrepo add-publisher -s $(@) $(PKGPUBLISHER)
clean-repo:
$(RM) -r $(PKGDEST)
### Package publication to repo
PUB_PKGS = $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
PUB_SYNTH_PKGS = $(SYNTH_MANIFESTS:%.p5m=$(PDIR)/%.pub)
publish_pkgs: $(PKGDEST) $(PDIR)/gendeps $(PDIR)/checkmf $(PUB_PKGS)
$(PUB_PKGS): $(PKGDEST) $(PDIR)/gendeps $(PDIR)/checkmf
$(PDIR)/%.pub: $(PKGDEST) $(PDIR)/gendeps $(PDIR)/%.res
$(PKGDEBUG) if [ -s $(@:%.pub=%.res) ]; then \
print "## Publishing $(@F:%.pub=%) to proto repository"; \
pkgsend -s $(PKGDEST) publish -d $(PKGROOT) \
-d $(PROTOMETA)/$(@F:%.pub=%) \
--fmri-in-manifest --no-index --no-catalog -T '*.py' \
$(@:%.pub=%.res) > /dev/null; \
fi; \
$(TOUCH) $(@)
$(PUB_SYNTH_PKGS): $(SYNTH_LICENSES)
### Repo finalization
install: repository-metadata
default: install
repository-metadata: $(PUB_PKGS)
@print "## Creating repository metadata"
$(PKGDEBUG)pkgrepo refresh -s $(PKGDEST)
### pkglint checking (post-publication)
LINT_PKGLINTRC = postpub-pkglintrc
#
# 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:
@print "## Running pkglint on the $(PKGPUBLISHER) repository"
-$(PKGDEBUG)$(PKGLINT) -f $(LINT_PKGLINTRC) \
-l file://$(PKGDEST) -c /tmp/pkglint_cache.$$$$ \
$(PKGLINT_REFERENCE_REPO:%=-r %) \
> $(PDIR)/pkglint.out 2> $(PDIR)/pkglint.lint ; \
grep '^Error:' $(PDIR)/pkglint.out ; \
$(RM) -rf /tmp/pkglint_cache.$$$$
$(PKGDEBUG)$(SED) -e 's/@[0-9TZ.:,-]*//g' $(PDIR)/pkglint.lint
### Overall rules
all: $(PROC_PKGS) $(PROC_SYNTH_PKGS) $(DEP_PKGS) $(DEP_SYNTH_PKGS) \
$(PDIR)/gendeps
clean:
-$(RM) -r $(PDIR)
clobber: clean clean-repo
.PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \
$(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS)
#
# rules to validate proto area against manifests, and check for safe
# file permission modes
#
EXCEPTIONS= $(PWD)/../exception_lists/packaging $(PDIR)/generated-exceptions
# Automatically exclude all pkg-config uninstalled.pc files, since those
# should never be packaged
$(PDIR)/generated-exceptions:
$(PKGDEBUG)(cd $(PKGROOT) ; find . -name '*-uninstalled.pc') > $@
protocmp: $(PROC_PKGS) $(EXCEPTIONS) $(PROC_EXCEPTIONS) fix_perms
$(PKGDEBUG)validate_pkg -a $(PKGMACH) -v $(EXCEPTIONS:%=-e %) \
-m $(PDIR) -p $(PKGROOT) || true
pmodes: $(PROC_PKGS) fix_perms
$(PKGDEBUG)validate_pkg -a $(PKGMACH) -M -m $(PDIR)
check-pkgfmt: $(ALL_MANIFESTS)
@print "## Checking for manifests not in pkgfmt expected form"
$(PKGDEBUG)$(PKGFMT) -c $(ALL_MANIFESTS) || true
@print ""
check: protocmp pmodes lint check-pkgfmt
# Instead of fixing all the upstream packages to follow our permission rules
# just fix the files in these subdirs of the proto area to match our rules.
FIX_PERMS_IN = /usr /lib /etc/X11 /etc/fonts /etc/hal
fix_perms:
@print "## Fixing proto area permissions"
$(PKGDEBUG)find $(FIX_PERMS_IN:%=$(PKGROOT)%) -type f -exec chmod a-w \{\} \+