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# See the License for the specific language governing permissions
2N/A# and limitations under the License.
2N/A# When distributing Covered Code, include this CDDL HEADER in each
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]
59N/A# Copyright (c) 2010, 2011, Oracle
and/or its affiliates. All rights reserved.
2N/A# Rules and Macros for generating an IPS package manifest and publishing an
2N/A# IPS package to a pkg depot.
2N/A# and define an "install" target appropriate to building your component.
59N/A# install: $(BUILD_DIR)/build/$(MACH32)/.installed \
59N/A# $(BUILD_DIR)/build/$(MACH64)/.installed
2N/A# This set of rules makes the "publish" target the default target for make(1)
26N/A# Package headers should all pretty much follow the same format
26N/A# order is important
26N/ACOMPARISON_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
26N/A# order is important
26N/APUBLISH_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
26N/APKG_MACROS += MACH=$(MACH)
2N/APKG_MACROS += ARCH=$(MACH)
26N/APKG_MACROS += MACH32=$(MACH32)
26N/APKG_MACROS += MACH64=$(MACH64)
26N/APKG_MACROS += PUBLISHER=$(PUBLISHER)
26N/APKG_MACROS += CONSOLIDATION=$(CONSOLIDATION)
26N/APKG_MACROS += BUILD_VERSION=$(BUILD_VERSION)
26N/APKG_MACROS += SOLARIS_VERSION=$(SOLARIS_VERSION)
26N/APKG_MACROS += OS_VERSION=$(OS_VERSION)
26N/APKG_MACROS += IPS_COMPONENT_VERSION=$(IPS_COMPONENT_VERSION)
26N/APKG_MACROS += COMPONENT_ARCHIVE_URL=$(COMPONENT_ARCHIVE_URL)
166N/APKG_OPTIONS += $(PKG_MACROS:%=-D %)
2N/AMANIFEST_BASE = $(BUILD_DIR)/manifest-$(MACH)
26N/ACANONICAL_MANIFESTS = $(wildcard *.p5m)
181N/AGENERATED = $(MANIFEST_BASE)-generated
181N/ACOMBINED = $(MANIFEST_BASE)-combined
181N/AMANIFESTS = $(CANONICAL_MANIFESTS:%=$(MANIFEST_BASE)-%)
12N/AMOGRIFIED=$(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.resolved)
30N/APUBLISHED=$(MOGRIFIED:%.resolved=%.published)
26N/ACOPYRIGHT_FILE = $(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright
26N/Aifeq ($(IPS_PKG_NAME),)
2N/A IPS_PKG_NAME = $(COMPONENT_NAME)
145N/AIPS_COMPONENT_VERSION = $(COMPONENT_VERSION)
26N/Apublish: install $(BUILD_DIR)/.published
38N/Asample-manifest: $(GENERATED).p5m
152N/A$(GENERATED).p5m: install
26N/A $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) | \
30N/A $(PKGMOGRIFY) $(PKG_OPTIONS)
/dev/fd/0 $(GENERATE_TRANSFORMS) | \
26N/A sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) | \
46N/A cat $(METADATA_TEMPLATE) - >$@
46N/A# copy the canonical manifest(s) to the build tree
64N/A$(MANIFEST_BASE)-%.generate: %.p5m canonical-manifests
64N/A cat $(METADATA_TEMPLATE) $< >$@
46N/A# mogrify the manifest
46N/A$(MANIFEST_BASE)-%.mogrified: %.p5m canonical-manifests
46N/A $(PKGMOGRIFY) $(PKG_OPTIONS) $< \
2N/A $(PUBLISH_TRANSFORMS) | \
46N/A sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@
53N/A# generate dependencies
46N/A$(MANIFEST_BASE)-%.depend: $(MANIFEST_BASE)-%.mogrified
46N/A $(PKGDEPEND) generate -m $< $(PROTO_DIR) >$@
181N/A# resolve dependencies, prepend the mogrified manifest, less the unresolved
181N/A# dependencies to the result.
181N/A$(MANIFEST_BASE)-%.resolved: $(MANIFEST_BASE)-%.depend
181N/A ($(PKGMOGRIFY) $(@:%.resolved=%.mogrified) \
181N/A sed -e '/^$$/d' -e '/^#.*$$/d' ; \
181N/A $(PKGDEPEND) resolve -o $< | sed -e '1d') | uniq >$@
76N/A# lint the manifest before we publish with it.
99N/A$(MANIFEST_BASE)-%.linted: $(MANIFEST_BASE)-%.resolved
181N/A @echo "VALIDATING MANIFEST CONTENT: $<"
99N/A PYTHONPATH=$(WS_TOOLS)/python $(PKGLINT) \
26N/A $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
46N/A -f $(WS_TOOLS)/pkglintrc $<
46N/A$(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.linted
53N/A $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
53N/A -d $(PROTO_DIR) -d $(@D) -d . $<
145N/A$(BUILD_DIR)/.published: $(PUBLISHED)
145N/Aprint-package-names: canonical-manifests
84N/A sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u
145N/Aprint-package-paths: canonical-manifests
46N/A sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u
99N/Ainstall-packages: publish
145N/A @if [ $(IS_GLOBAL_ZONE) = 0 -o x$(ROOT) != x ]; then \
2N/A sed -e '/^$$/d' -e '/^#.*$$/d' -e 's;/;;' | sort -u | \
2N/A echo "unsafe to install package(s) automatically" ; \
32N/A$(MOGRIFIED): install
32N/Acanonical-manifests: $(CANONICAL_MANIFESTS) Makefile $(PATCHES)
32N/Aifeq ($(strip $(CANONICAL_MANIFESTS)),)
32N/A # If there were no canonical manifests in the workspace, nothing will
32N/A # be published and we should fail. A sample manifest can be generated
32N/A # $ gmake sample-manifest
38N/A # Once created, it will need to be reviewed, edited, and added to the
38N/A $(error Missing canonical manifest(s))
38N/A# This converts required paths to containing package names for be able to
38N/A# properly setup the build environment for a component.
38N/A @echo "generating $@ from Makefile REQUIRED_* data"
145N/A | sed -e '
s/pkg:\/\(.*\)@.*/REQUIRED_PKGS += \1/g' >$@