2N/A#
2N/A# CDDL HEADER START
2N/A#
2N/A# The contents of this file are subject to the terms of the
2N/A# Common Development and Distribution License (the "License").
2N/A# You may not use this file except in compliance with the License.
2N/A#
2N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A# or http://www.opensolaris.org/os/licensing.
2N/A# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A#
2N/A# When distributing Covered Code, include this CDDL HEADER in each
2N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A# If applicable, add the following below this CDDL HEADER, with the
2N/A# fields enclosed by brackets "[]" replaced with your own identifying
2N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2N/A#
2N/A# CDDL HEADER END
2N/A#
2790N/A
2790N/A#
5337N/A# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
2N/A#
2N/A
2N/A#
2N/A# Rules and Macros for generating an IPS package manifest and publishing an
2N/A# IPS package to a pkg depot.
2N/A#
3817N/A# To use these rules, include $(WS_MAKE_RULES)/ips.mk in your Makefile
2N/A# and define an "install" target appropriate to building your component.
2N/A# Ex:
2N/A#
59N/A# install: $(BUILD_DIR)/build/$(MACH32)/.installed \
59N/A# $(BUILD_DIR)/build/$(MACH64)/.installed
2N/A#
2N/A# This set of rules makes the "publish" target the default target for make(1)
2N/A#
2N/A
26N/APKGDEPEND = /usr/bin/pkgdepend
26N/APKGFMT = /usr/bin/pkgfmt
181N/APKGMANGLE = $(WS_TOOLS)/userland-mangler
26N/A
4811N/AGENERATE_HISTORY= $(WS_TOOLS)/generate-history
4811N/AHISTORY= history
4811N/A
3739N/A# pkgfmt has an odd behavior at present where -c means "check validity
3739N/A# against any format" whereas -d means "diffs against latest format" and
3739N/A# no arguments means "update to latest format". Thus, 'pkgfmt -c' can
3739N/A# run clean on a v1 manifest that actually needs to be updated. So we
3739N/A# use the explicit format version argument below. If this behavior is
3739N/A# changed, then the -f argument below can be dropped.
3739N/APKGFMT_CHECK_ARGS = -c -fv2
3739N/A
3817N/AWS_TRANSFORMS = $(WS_TOP)/transforms
3817N/A
26N/A# Package headers should all pretty much follow the same format
26N/AMETADATA_TEMPLATE = $(WS_TOP)/transforms/manifest-metadata-template
26N/ACOPYRIGHT_TEMPLATE = $(WS_TOP)/transforms/copyright-template
26N/A
26N/A# order is important
26N/AGENERATE_TRANSFORMS += $(WS_TOP)/transforms/generate-cleanup
26N/A
700N/APKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/libtool-drop
700N/A
26N/ACOMPARISON_TRANSFORMS += $(WS_TOP)/transforms/comparison-cleanup
26N/ACOMPARISON_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
26N/A
1498N/ALICENSE_TRANSFORMS = $(WS_TOP)/transforms/license-changes
1498N/A
26N/A# order is important
1498N/APUBLISH_TRANSFORMS += $(LICENSE_TRANSFORMS)
151N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/variant-cleanup
206N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/autopyc
26N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/defaults
26N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/actuators
6607N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/depends
26N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/devel
26N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/docs
26N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/locale
3998N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/standard-python-libraries
2818N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/python-rename
2830N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/python-3-groups
3127N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/python-3-soabi
3998N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/python-3-no-32bit
5745N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/ruby-tests
5745N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/puppet
26N/APUBLISH_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
3294N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/incorporate
26N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/publish-cleanup
2N/A
4747N/A# If we are building "evaluation" packages, add the evaluation information
4437N/A# action so that the package(s) display the terms and require acceptance
4437N/A# to install.
4488N/Aifeq ($(BUILD_TYPE),evaluation)
4488N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/evaluation
4437N/Aendif
4437N/A
5425N/A# For items defined as variables or that may contain whitespace, add
5425N/A# them to a list to be expanded into PKG_OPTIONS later.
5425N/APKG_VARS += ARC_CASE TPNO
5425N/APKG_VARS += BUILD_VERSION OS_VERSION SOLARIS_VERSION PKG_SOLARIS_VERSION
5425N/APKG_VARS += CONSOLIDATION CONSOLIDATION_CHANGESET CONSOLIDATION_REPOSITORY_URL
5425N/APKG_VARS += COMPONENT_VERSION IPS_COMPONENT_VERSION HUMAN_VERSION
5425N/APKG_VARS += COMPONENT_ARCHIVE_URL COMPONENT_PROJECT_URL COMPONENT_NAME
5425N/APKG_VARS += HG_REPO HG_REV HG_URL
7047N/APKG_VARS += GIT_COMMIT_ID GIT_REPO GIT_TAG
5425N/APKG_VARS += MACH MACH32 MACH64
5425N/APKG_VARS += PUBLISHER PUBLISHER_LOCALIZABLE
5425N/APKG_VARS += SOLARIS_11_ONLY SOLARIS_12_ONLY
5425N/A
5425N/A# Include TPNO_* Makefile variables in PKG_VARS.
5425N/A$(foreach macro, $(filter TPNO_%, $(.VARIABLES)), \
5425N/A $(eval PKG_VARS += $(macro)) \
5425N/A)
5425N/A
5425N/A# For items that need special definition, add them to PKG_MACROS.
5329N/A# IPS_COMPONENT_VERSION suitable for use in regular expressions.
5329N/APKG_MACROS += IPS_COMPONENT_RE_VERSION=$(subst .,\\.,$(IPS_COMPONENT_VERSION))
5329N/A# COMPONENT_VERSION suitable for use in regular expressions.
5329N/APKG_MACROS += COMPONENT_RE_VERSION=$(subst .,\\.,$(COMPONENT_VERSION))
5349N/A
2236N/APKG_MACROS += PYTHON_2.7_ONLY=\#
2818N/APKG_MACROS += PYTHON_3.4_ONLY=\#
4910N/APKG_MACROS += PYTHON_3.5_ONLY=\#
2N/A
5425N/A# Convenience macros for quoting in manifests; necessary because pkgfmt will
5425N/A# drop literal quotes in attribute values if they do not contain whitespace
5425N/A# since the action parsing in pkg will drop them during action stringification.
5425N/APKG_MACROS += SQ=\'
5425N/APKG_MACROS += DQ=\"
5425N/APKG_MACROS += Q=\"
5425N/A
26N/APKG_OPTIONS += $(PKG_MACROS:%=-D %)
26N/A
181N/AMANGLED_DIR = $(PROTO_DIR)/mangled
181N/A
4353N/A# We use += below so anyone wishing to put other directories at the beginning
4353N/A# of the list can do so, by setting PKG_PROTO_DIRS before including this file.
4353N/A# So don't change += to = here or components that use this will break.
4488N/APKG_PROTO_DIRS += $(MANGLED_DIR) $(PROTO_DIR) $(@D) $(COMPONENT_DIR) $(COMPONENT_SRC) $(WS_LICENSES)
99N/A
59N/AMANIFEST_BASE = $(BUILD_DIR)/manifest-$(MACH)
12N/A
30N/ACANONICAL_MANIFESTS = $(wildcard *.p5m)
4811N/Aifneq ($(wildcard $(HISTORY)),)
4811N/AHISTORICAL_MANIFESTS = $(shell $(NAWK) -v FUNCTION=name -f $(GENERATE_HISTORY) < $(HISTORY))
4811N/Aendif
1256N/A
1256N/A# Look for manifests which need to be duplicated for each version of python.
1256N/Aifeq ($(findstring -PYVER,$(CANONICAL_MANIFESTS)),-PYVER)
2818N/AUNVERSIONED_MANIFESTS = $(filter-out %GENFRAG.p5m,$(filter-out %-PYVER.p5m,$(CANONICAL_MANIFESTS)))
1256N/APY_MANIFESTS = $(filter %-PYVER.p5m,$(CANONICAL_MANIFESTS))
1256N/APYV_MANIFESTS = $(foreach v,$(shell echo $(PYTHON_VERSIONS) | tr -d .),$(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER.p5m/-$(v).p5m/g'))
1256N/APYNV_MANIFESTS = $(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER//')
1256N/Aelse
1256N/AUNVERSIONED_MANIFESTS = $(CANONICAL_MANIFESTS)
1256N/Aendif
1256N/A
1256N/A# Look for manifests which need to be duplicated for each version of perl.
1256N/Aifeq ($(findstring -PERLVER,$(UNVERSIONED_MANIFESTS)),-PERLVER)
2818N/ANOPERL_MANIFESTS = $(filter-out %GENFRAG.p5m,$(filter-out %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS)))
1256N/APERL_MANIFESTS = $(filter %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS))
1256N/APERLV_MANIFESTS = $(foreach v,$(shell echo $(PERL_VERSIONS) | tr -d .),$(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER.p5m/-$(v).p5m/g'))
1256N/APERLNV_MANIFESTS = $(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER//')
1256N/Aelse
1256N/ANOPERL_MANIFESTS = $(UNVERSIONED_MANIFESTS)
1256N/Aendif
1256N/A
3109N/A# Look for manifests which need to be duplicated for each version of ruby.
3109N/A# NOPERL_MANIFESTS represents the manifests that are not Python or
3109N/A# Perl manifests. Extract the Ruby Manifests from NOPERL_MANIFESTS.
3109N/A# Any remaining manifests are stored in NONRUBY_MANIFESTS
3109N/Aifeq ($(findstring -RUBYVER,$(NOPERL_MANIFESTS)),-RUBYVER)
3109N/ANORUBY_MANIFESTS = $(filter-out %GENFRAG.p5m,\
3109N/A $(filter-out %-RUBYVER.p5m,$(NOPERL_MANIFESTS)))
3109N/ARUBY_MANIFESTS = $(filter %-RUBYVER.p5m,$(NOPERL_MANIFESTS))
3109N/ARUBYV_MANIFESTS = $(foreach v,$(shell echo $(RUBY_VERSIONS)),\
3109N/A $(shell echo $(RUBY_MANIFESTS) |\
3109N/A sed -e 's/-RUBYVER.p5m/-$(shell echo $(v) |\
3109N/A cut -d. -f1,2 | tr -d .).p5m/g'))
3109N/ARUBYNV_MANIFESTS = $(shell echo $(RUBY_MANIFESTS) | sed -e 's/-RUBYVER//')
3109N/Aelse
3109N/ANORUBY_MANIFESTS = $(NOPERL_MANIFESTS)
3109N/Aendif
3109N/A
1256N/AVERSIONED_MANIFESTS = \
1256N/A $(PYV_MANIFESTS) $(PYNV_MANIFESTS) \
1256N/A $(PERLV_MANIFESTS) $(PERLNV_MANIFESTS) \
3109N/A $(RUBYV_MANIFESTS) $(RUBYNV_MANIFESTS) \
4811N/A $(NORUBY_MANIFESTS) $(HISTORICAL_MANIFESTS)
1256N/A
26N/AGENERATED = $(MANIFEST_BASE)-generated
26N/ACOMBINED = $(MANIFEST_BASE)-combined
1256N/AMANIFESTS = $(VERSIONED_MANIFESTS:%=$(MANIFEST_BASE)-%)
2N/A
26N/A
1256N/ADEPENDED=$(VERSIONED_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.depend)
1256N/ARESOLVED=$(VERSIONED_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.depend.res)
185N/APUBLISHED=$(RESOLVED:%.depend.res=%.published)
2N/A
255N/ACOPYRIGHT_FILE ?= $(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright
145N/AIPS_COMPONENT_VERSION ?= $(COMPONENT_VERSION)
7N/A
26N/A.DEFAULT: publish
26N/A
38N/A.SECONDARY:
26N/A
197N/A# allow publishing to be overridden, such as when
197N/A# a package is for one architecture only.
197N/APUBLISH_STAMP ?= $(BUILD_DIR)/.published-$(MACH)
197N/A
197N/Apublish: build install $(PUBLISH_STAMP)
26N/A
30N/Asample-manifest: $(GENERATED).p5m
26N/A
46N/A$(GENERATED).p5m: install
46N/A $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) | \
46N/A $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 $(GENERATE_TRANSFORMS) | \
64N/A sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) | \
64N/A cat $(METADATA_TEMPLATE) - >$@
26N/A
46N/A# copy the canonical manifest(s) to the build tree
46N/A$(MANIFEST_BASE)-%.generate: %.p5m canonical-manifests
46N/A cat $(METADATA_TEMPLATE) $< >$@
2N/A
1256N/A# The text of a transform that will emit a dependency conditional on the
1256N/A# presence of a particular version of a runtime, which will then draw in the
1256N/A# runtime-version-specific version of the package we're operating on. $(1) is
1256N/A# the name of the runtime package, and $(2) is the version suffix.
1256N/Amkgeneric = \
2818N/A echo "<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-\#\#\#PYV\#\#\#@(.*)" \
1256N/A "-> emit depend nodrop=true type=conditional" \
1256N/A "predicate=$(1)-$(2) fmri=%<1>-$(2)@%<2>>" >> $@;
1256N/A
1256N/A# Define and execute a macro that generates a rule to create a manifest for a
1256N/A# python module specific to a particular version of the python runtime.
2818N/A# Creates build/manifest-*-modulename-##.p5m file where ## is replaced with
2818N/A# the version number.
1256N/Adefine python-manifest-rule
2236N/A$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY=
2236N/A
1256N/A$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m
2818N/A if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; fi
3739N/A $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
5425N/A $(PKGMOGRIFY) -D PYVER=$(1) -D MAYBE_PYVER_SPACE="$(1) " \
5425N/A -D MAYBE_SPACE_PYVER=" $(1)" \
5659N/A -D SOLARIS_11_ONLY="$(SOLARIS_11_ONLY)" \
5425N/A -D PYV=$(shell echo $(1) | tr -d .) $$< > $$@
1256N/Aendef
1256N/A$(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver))))
1256N/A
1256N/A# A rule to create a helper transform package for python, that will insert the
1256N/A# appropriate conditional dependencies into a python library's
1256N/A# runtime-version-generic package to pull in the version-specific bits when the
1256N/A# corresponding version of python is on the system.
3817N/A$(BUILD_DIR)/mkgeneric-python: $(WS_MAKE_RULES)/shared-macros.mk
1256N/A $(RM) $@
1256N/A $(foreach ver,$(shell echo $(PYTHON_VERSIONS) | tr -d .), \
1256N/A $(call mkgeneric,runtime/python,$(ver)))
1256N/A
1256N/A# Build Python version-wrapping manifests from the generic version.
2818N/A# Creates build/manifest-*-modulename.p5m file.
3449N/A# Note that the mkgeneric transform uses the literal string "###PYV###"
3449N/A# as the place-holder for the Python version (for mkgeneric-python) and
3449N/A# the Perl version (for mkgeneric-perl below) and the Ruby version (for
3449N/A# mkgeneric-ruby further below). The authors did not anticipate that this
3449N/A# mechanism would be extended beyond Python when they wrote it; something
3449N/A# more generic like LANGVER might make more sense, but for now we are
3449N/A# sticking with something known to work.
1934N/A$(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python
3739N/A $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
5425N/A $(PKGMOGRIFY) -D PYV=###PYV### -D MAYBE_PYVER_SPACE= \
5659N/A -D SOLARIS_11_ONLY="$(SOLARIS_11_ONLY)" \
5425N/A -D MAYBE_SPACE_PYVER= $(BUILD_DIR)/mkgeneric-python \
1256N/A $(WS_TOP)/transforms/mkgeneric $< > $@
1256N/A if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
1256N/A
1413N/A# Define and execute a macro that generates a rule to create a manifest for a
1413N/A# perl module specific to a particular version of the perl runtime.
1413N/Adefine perl-manifest-rule
1413N/A$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PERLVER.p5m
3739N/A $(PKGFMT) $(PKGFMT_CHECK_ARGS) $$<
5425N/A $(PKGMOGRIFY) -D PERLVER=$(1) -D MAYBE_PERLVER_SPACE="$(1) " \
5425N/A -D MAYBE_SPACE_PERLVER=" $(1)" \
5425N/A -D PLV=$(shell echo $(1) | tr -d .) \
1413N/A -D PERL_ARCH=$(call PERL_ARCH_FUNC,$(PERL.$(1))) $$< > $$@
1413N/Aendef
1413N/A$(foreach ver,$(PERL_VERSIONS),$(eval $(call perl-manifest-rule,$(ver))))
1413N/A
1256N/A# A rule to create a helper transform package for perl, that will insert the
1256N/A# appropriate conditional dependencies into a perl library's
1256N/A# runtime-version-generic package to pull in the version-specific bits when the
1256N/A# corresponding version of perl is on the system.
3817N/A$(BUILD_DIR)/mkgeneric-perl: $(WS_MAKE_RULES)/shared-macros.mk
1256N/A $(RM) $@
1256N/A $(foreach ver,$(shell echo $(PERL_VERSIONS) | tr -d .), \
1256N/A $(call mkgeneric,runtime/perl,$(ver)))
1256N/A
1256N/A# Build Perl version-wrapping manifests from the generic version.
3449N/A# See the block comment above about why "###PYV###" is used here even
3449N/A# though this is for Perl rather than Python.
1934N/A$(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl
3739N/A $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
5425N/A $(PKGMOGRIFY) -D PLV=###PYV### -D MAYBE_PERLVER_SPACE= \
5425N/A -D MAYBE_SPACE_PERLVER= $(BUILD_DIR)/mkgeneric-perl \
1256N/A $(WS_TOP)/transforms/mkgeneric $< > $@
1256N/A if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
1256N/A
3109N/A# Define and execute a macro that generates a rule to create a manifest for a
3109N/A# ruby module specific to a particular version of the ruby runtime.
3109N/A# Creates build/manifest-*-modulename-##.p5m file where ## is replaced with
3109N/A# the version number.
3109N/Adefine ruby-manifest-rule
3109N/A$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: \
3109N/A PKG_MACROS += RUBY_VERSION=$(1) RUBY_LIB_VERSION=$(2) \
3109N/A RUBYV=$(subst .,,$(1))
3109N/A
3109N/A$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m
3109N/A if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \
3109N/A cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \
3109N/A fi
3739N/A $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
3109N/A $(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \
5425N/A -D MAYBE_RUBY_VERSION_SPACE="$(1) " \
5425N/A -D MAYBE_SPACE_RUBY_VERSION=" $(1)" \
3109N/A -D RUBYV=$(shell echo $(1) | tr -d .) $$< > $$@
3109N/Aendef
3109N/A$(foreach ver,$(RUBY_VERSIONS),\
3109N/A $(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \
3109N/A cut -d. -f1,2),$(ver))))
3109N/A
3109N/A# A rule to create a helper transform package for ruby, that will insert the
3109N/A# appropriate conditional dependencies into a ruby library's
3109N/A# runtime-version-generic package to pull in the version-specific bits when the
3109N/A# corresponding version of ruby is on the system.
3817N/A$(BUILD_DIR)/mkgeneric-ruby: $(WS_MAKE_RULES)/shared-macros.mk
3109N/A $(RM) $@
3109N/A $(foreach ver,$(RUBY_VERSIONS),\
3109N/A $(call mkgeneric,runtime/ruby,$(shell echo $(ver) | \
3109N/A cut -d. -f1,2 | tr -d .)))
3109N/A
3109N/A# Build Ruby version-wrapping manifests from the generic version.
3109N/A# Creates build/manifest-*-modulename.p5m file.
3109N/A#
3449N/A# See the block comment above about why "###PYV###" is used here even
3449N/A# though this is for Ruby rather than Python.
3109N/A$(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby
3739N/A $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
5425N/A $(PKGMOGRIFY) -D RUBYV=###PYV### -D MAYBE_RUBY_VERSION_SPACE= \
5425N/A -D MAYBE_SPACE_RUBY_VERSION= $(BUILD_DIR)/mkgeneric-ruby \
3109N/A $(WS_TOP)/transforms/mkgeneric $< > $@
3109N/A if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
3109N/A
4811N/A# Rule to generate historical manifests from the $(HISTORY) file.
4811N/Adefine history-manifest-rule
4811N/A$(MANIFEST_BASE)-$(1): $(HISTORY) $(BUILD_DIR)
4811N/A $(NAWK) -v TARGET=$(1) -v FUNCTION=manifest -f $(GENERATE_HISTORY) < \
4811N/A $(HISTORY) > $$@
4811N/Aendef
4811N/A$(foreach mfst,$(HISTORICAL_MANIFESTS),$(eval $(call history-manifest-rule,$(mfst))))
4811N/A
1256N/A# mogrify non-parameterized manifests
1256N/A$(MANIFEST_BASE)-%.mogrified: %.p5m $(BUILD_DIR)
3739N/A $(PKGFMT) $(PKGFMT_CHECK_ARGS) $<
1256N/A $(PKGMOGRIFY) $(PKG_OPTIONS) $< \
1256N/A $(PUBLISH_TRANSFORMS) | \
1256N/A sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@
1256N/A
1256N/A# mogrify parameterized manifests
1256N/A$(MANIFEST_BASE)-%.mogrified: $(MANIFEST_BASE)-%.p5m $(BUILD_DIR)
53N/A $(PKGMOGRIFY) $(PKG_OPTIONS) $< \
46N/A $(PUBLISH_TRANSFORMS) | \
46N/A sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@
26N/A
181N/A# mangle the file contents
369N/A$(BUILD_DIR) $(MANGLED_DIR):
181N/A $(MKDIR) $@
181N/A
181N/APKGMANGLE_OPTIONS = -D $(MANGLED_DIR) $(PKG_PROTO_DIRS:%=-d %)
181N/A$(MANIFEST_BASE)-%.mangled: $(MANIFEST_BASE)-%.mogrified $(MANGLED_DIR)
181N/A $(PKGMANGLE) $(PKGMANGLE_OPTIONS) -m $< >$@
181N/A
76N/A# generate dependencies
99N/APKGDEPEND_GENERATE_OPTIONS = -m $(PKG_PROTO_DIRS:%=-d %)
181N/A$(MANIFEST_BASE)-%.depend: $(MANIFEST_BASE)-%.mangled
2818N/A $(ENV) $(COMPONENT_PUBLISH_ENV) $(PKGDEPEND) generate \
2818N/A $(PKGDEPEND_GENERATE_OPTIONS) $< >$@
26N/A
3817N/A# pkgdepend resolve builds a map of all installed packages by default. This
3817N/A# makes dependency resolution particularly slow. We can dramatically improve
3817N/A# performance here by creating a file with a list of packages that we know
3817N/A# are needed, dramatically reducing the overhead involved in creating and
3817N/A# searching this map.
3817N/A#
3817N/A# Generate a resolve.deps file from the dependencies in the Makefile and
3817N/A# fragments that it uses.
3817N/ARESOLVE_DEPS=$(BUILD_DIR)/resolve.deps
1549N/A
3817N/A$(RESOLVE_DEPS): $(MAKEFILE_PREREQ) $(BUILD_DIR)
3817N/A @for pkg in $(REQUIRED_PACKAGES:%=/%) ; do \
3817N/A echo $${pkg} ; \
3817N/A done | sort -u >$@
1549N/A
185N/A# resolve the dependencies all at once
3817N/A$(BUILD_DIR)/.resolved-$(MACH): $(DEPENDED) $(RESOLVE_DEPS)
3817N/A $(PKGDEPEND) resolve $(RESOLVE_DEPS:%=-e %) -m $(DEPENDED)
145N/A $(TOUCH) $@
145N/A
3817N/A#
3817N/A# Generate a set of REQUIRED_PACKAGES based on what is needed to for pkgdepend
3817N/A# to resolve properly. Automatically append this to your Makefile for the truly
3817N/A# lazy among us. This is only a piece of the REQUIRED_PACKAGES puzzle.
3817N/A# You must still include packages for tools you build and test with.
3817N/A#
3817N/AREQUIRED_PACKAGES:: $(RESOLVED)
3817N/A $(GMAKE) RESOLVE_DEPS= $(BUILD_DIR)/.resolved-$(MACH)
3817N/A @echo "# Auto-generated contents below. Please manually verify and remove this comment" >>Makefile
3817N/A @$(PKGMOGRIFY) $(WS_TRANSFORMS)/$@ $(RESOLVED) | \
3817N/A $(GSED) -e '/^[\t ]*$$/d' -e '/^#/d' | sort -u >>Makefile
3817N/A @echo "*** Please edit your Makefile and verify the new content at the end ***"
3817N/A
145N/A# lint the manifests all at once
145N/A$(BUILD_DIR)/.linted-$(MACH): $(BUILD_DIR)/.resolved-$(MACH)
145N/A @echo "VALIDATING MANIFEST CONTENT: $(RESOLVED)"
117N/A $(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)"\
2515N/A SOLARIS_VERSION=$(SOLARIS_VERSION)\
84N/A $(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
145N/A -f $(WS_TOOLS)/pkglintrc $(RESOLVED)
145N/A $(TOUCH) $@
145N/A
1392N/Alintme: FRC
1392N/A @echo "VALIDATING MANIFEST CONTENT: $(RESOLVED)"
1392N/A $(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)"\
2515N/A SOLARIS_VERSION=$(SOLARIS_VERSION)\
1392N/A $(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
1392N/A -f $(WS_TOOLS)/pkglintrc $(RESOLVED)
1392N/A
1392N/AFRC:
1392N/A
38N/A
46N/A# published
1899N/APKGSEND_PUBLISH_OPTIONS = -s $(PKG_REPO) publish --fmri-in-manifest
1899N/APKGSEND_PUBLISH_OPTIONS += --no-catalog
99N/APKGSEND_PUBLISH_OPTIONS += $(PKG_PROTO_DIRS:%=-d %)
196N/APKGSEND_PUBLISH_OPTIONS += -T \*.py
1899N/A
5436N/A# PKGREPO_REMOVE_BEFORE_PUBLISH remove previously published versions of this package
5436N/A# before publishing the new build
5436N/APKGREPO_REMOVE_BEFORE_PUBLISH ?= no
5436N/A
185N/A$(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.depend.res $(BUILD_DIR)/.linted-$(MACH)
5436N/Aifeq ($(PKGREPO_REMOVE_BEFORE_PUBLISH),yes)
5436N/A -$(PKGREPO) -s $(PKG_REPO) remove \
5436N/A $(shell $(CAT) $< $(WS_TOP)/transforms/print-pkgs | \
5436N/A $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
5436N/A sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u)
5436N/Aendif
99N/A $(PKGSEND) $(PKGSEND_PUBLISH_OPTIONS) $<
46N/A $(PKGFMT) <$< >$@
2N/A
145N/A$(BUILD_DIR)/.published-$(MACH): $(PUBLISHED)
1899N/Aifndef DISABLE_IPS_CATALOG_AND_INDEX_UPDATES
1899N/A $(PKGREPO) refresh -s $(PKG_REPO)
1899N/Aendif
26N/A $(TOUCH) $@
2N/A
32N/Aprint-package-names: canonical-manifests
1256N/A @cat $(VERSIONED_MANIFESTS) $(WS_TOP)/transforms/print-pkgs | \
32N/A $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
32N/A sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u
32N/A
32N/Aprint-package-paths: canonical-manifests
1256N/A @cat $(VERSIONED_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
32N/A $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
32N/A sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u
32N/A
38N/Ainstall-packages: publish
38N/A @if [ $(IS_GLOBAL_ZONE) = 0 -o x$(ROOT) != x ]; then \
1256N/A cat $(VERSIONED_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
38N/A $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
38N/A sed -e '/^$$/d' -e '/^#.*$$/d' -e 's;/;;' | sort -u | \
38N/A (cd $(PROTO_DIR) ; pfexec /bin/cpio -dump $(ROOT)) ; \
38N/A else ; \
38N/A echo "unsafe to install package(s) automatically" ; \
38N/A fi
38N/A
145N/A$(RESOLVED): install
38N/A
6989N/Acanonical-manifests: $(CANONICAL_MANIFESTS) $(MAKEFILE_PREREQ) $(ALL_PATCHES) \
4811N/A $(HISTORY)
26N/Aifeq ($(strip $(CANONICAL_MANIFESTS)),)
26N/A # If there were no canonical manifests in the workspace, nothing will
26N/A # be published and we should fail. A sample manifest can be generated
26N/A # with
26N/A # $ gmake sample-manifest
26N/A # Once created, it will need to be reviewed, edited, and added to the
26N/A # workspace.
26N/A $(error Missing canonical manifest(s))
26N/Aendif
5329N/A
5425N/A# Add component-specific variables and export to PKG_OPTIONS.
5329N/ACOMP_SUFFIXES = $(subst COMPONENT_NAME_,, \
5329N/A $(filter COMPONENT_NAME_%, $(.VARIABLES)))
5329N/A
5425N/A# Component variables are expanded directly to PKG_OPTIONS instead of via
5425N/A# PKG_MACROS since the values may contain whitespace.
5425N/Amkdefine = -D $(1)="$(2)"
5425N/A
5425N/A# Expand PKG_VARS into defines via PKG_OPTIONS.
5425N/A$(foreach var, $(PKG_VARS), \
5425N/A $(eval PKG_OPTIONS += $(call mkdefine,$(var),$$($(var)))) \
5425N/A)
5425N/A
5425N/A# Expand any variables ending in component _$(suffix) via PKG_OPTIONS excluding
5425N/A# variables known to always be irrelevant and TPNO_% variables as those have
5425N/A# already been processed.
5329N/A$(foreach suffix, $(COMP_SUFFIXES), \
5329N/A $(eval COMPONENT_RE_VERSION_$(suffix) ?= $(subst .,\\.,$$(COMPONENT_VERSION_$(suffix)))) \
5329N/A $(eval IPS_COMPONENT_VERSION_$(suffix) ?= $$(COMPONENT_VERSION_$(suffix))) \
5329N/A $(eval IPS_COMPONENT_RE_VERSION_$(suffix) ?= $(subst .,\\.,$$(IPS_COMPONENT_VERSION_$(suffix)))) \
5425N/A $(eval COMP_VARS=$(filter %_$(suffix), $(.VARIABLES))) \
5349N/A $(eval COMP_VARS=$(filter-out COMPONENT_POST_UNPACK_%, $(COMP_VARS))) \
5425N/A $(eval COMP_VARS=$(filter-out TPNO_%, $(COMP_VARS))) \
5337N/A $(eval COMP_VARS=$(filter-out UNPACK_ARGS_%, $(COMP_VARS))) \
5425N/A $(foreach macro, $(COMP_VARS), \
5425N/A $(eval PKG_OPTIONS += $(call mkdefine,$(macro),$$($(macro)))) \
5329N/A ) \
5329N/A)