ips.mk revision 2271
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# CDDL HEADER START
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# The contents of this file are subject to the terms of the
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# Common Development and Distribution License (the "License").
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# You may not use this file except in compliance with the License.
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# See the License for the specific language governing permissions
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# and limitations under the License.
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# When distributing Covered Code, include this CDDL HEADER in each
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# If applicable, add the following below this CDDL HEADER, with the
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# fields enclosed by brackets "[]" replaced with your own identifying
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# information: Portions Copyright [yyyy] [name of copyright owner]
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# CDDL HEADER END
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# Rules and Macros for generating an IPS package manifest and publishing an
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# IPS package to a pkg depot.
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# To use these rules, include ../make-rules/ips.mk in your Makefile
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# and define an "install" target appropriate to building your component.
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# install: $(BUILD_DIR)/build/$(MACH32)/.installed \
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# $(BUILD_DIR)/build/$(MACH64)/.installed
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# This set of rules makes the "publish" target the default target for make(1)
18aeb66595456f6f996a857aa636df9107d9492aJaco Joosteifeq ($(strip $(PKGLINT_COMPONENT)),)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKGLINT = ${WS_TOOLS}/pkglint
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKGMANGLE = $(WS_TOOLS)/userland-mangler
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# Package headers should all pretty much follow the same format
18aeb66595456f6f996a857aa636df9107d9492aJaco JoosteMETADATA_TEMPLATE = $(WS_TOP)/transforms/manifest-metadata-template
18aeb66595456f6f996a857aa636df9107d9492aJaco JoosteCOPYRIGHT_TEMPLATE = $(WS_TOP)/transforms/copyright-template
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# order is important
18aeb66595456f6f996a857aa636df9107d9492aJaco JoosteGENERATE_TRANSFORMS += $(WS_TOP)/transforms/generate-cleanup
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/libtool-drop
18aeb66595456f6f996a857aa636df9107d9492aJaco JoosteCOMPARISON_TRANSFORMS += $(WS_TOP)/transforms/comparison-cleanup
18aeb66595456f6f996a857aa636df9107d9492aJaco JoosteCOMPARISON_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoosteLICENSE_TRANSFORMS = $(WS_TOP)/transforms/license-changes
18aeb66595456f6f996a857aa636df9107d9492aJaco Jooste# order is important
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(LICENSE_TRANSFORMS)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(WS_TOP)/transforms/variant-cleanup
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(WS_TOP)/transforms/autopyc
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(WS_TOP)/transforms/defaults
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(WS_TOP)/transforms/actuators
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(WS_TOP)/transforms/devel
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(WS_TOP)/transforms/docs
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(WS_TOP)/transforms/locale
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePUBLISH_TRANSFORMS += $(WS_TOP)/transforms/publish-cleanup
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKG_MACROS += MACH=$(MACH)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKG_MACROS += MACH32=$(MACH32)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKG_MACROS += MACH64=$(MACH64)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKG_MACROS += PUBLISHER=$(PUBLISHER)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKG_MACROS += PUBLISHER_LOCALIZABLE=$(PUBLISHER_LOCALIZABLE)
18aeb66595456f6f996a857aa636df9107d9492aJaco JoostePKG_MACROS += CONSOLIDATION=$(CONSOLIDATION)
UNVERSIONED_MANIFESTS = $(filter-out %-GENFRAG.p5m,$(filter-out %-PYVER.p5m,$(CANONICAL_MANIFESTS)))
PY_MANIFESTS = $(filter %-PYVER.p5m,$(CANONICAL_MANIFESTS))
PYV_MANIFESTS = $(foreach v,$(shell echo $(PYTHON_VERSIONS) | tr -d .),$(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER.p5m/-$(v).p5m/g'))
PERL_MANIFESTS = $(filter %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS))
PERLV_MANIFESTS = $(foreach v,$(shell echo $(PERL_VERSIONS) | tr -d .),$(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER.p5m/-$(v).p5m/g'))
RESOLVED=$(VERSIONED_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.depend.res)
PUBLISHED=$(RESOLVED:%.depend.res=%.published)
$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 $(GENERATE_TRANSFORMS) | \
echo "<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-\#\#\#@(.*)" \
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m
$(BUILD_DIR)/mkgeneric-python: $(WS_TOP)/make-rules/shared-macros.mk
$(call mkgeneric,runtime/python,$(ver)))
$(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python
$(WS_TOP)/transforms/mkgeneric $< > $@
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PERLVER.p5m
$(BUILD_DIR)/mkgeneric-perl: $(WS_TOP)/make-rules/shared-macros.mk
$(call mkgeneric,runtime/perl,$(ver)))
$(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl
$(WS_TOP)/transforms/mkgeneric $< > $@
# depend on. Using resolve.deps is not required, but significantly speeds up
EXTDEPFILES ?= $(wildcard $(sort $(addsuffix ../resolve.deps, $(dir $(DEPENDED)))))
# we can speed up resolution by providing a dummy resolve.deps to skip loading
# accept a completely empty resolve.deps, so we pass the userland-incorporation
NULLDEPFILE = $(BUILD_DIR)/null-resolve.deps
$(PKGMOGRIFY) -O /dev/null $$i rd-trans | tr " " "\n" | sort -u > m1; \
done | sed -e 's/@[^ ]*//g' -e 's,pkg:/,,g' | sort -u > resolve.deps
@if [[ ! -s resolve.deps ]]; then \
echo "No computed dependencies found; removing empty resolve.deps."; \
$(RM) resolve.deps; \
echo 'consolidation/userland/userland-incorporation' > $(NULLDEPFILE) ; \
$(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.depend.res $(BUILD_DIR)/.linted-$(MACH)
@cat $(VERSIONED_MANIFESTS) $(WS_TOP)/transforms/print-pkgs | \
$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
@cat $(VERSIONED_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
cat $(VERSIONED_MANIFESTS) $(WS_TOP)/transforms/print-paths | \
$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
(cd $(PROTO_DIR) ; pfexec /bin/cpio -dump $(ROOT)) ; \
required-pkgs.mk: Makefile
@pkg search -H -l '<$(DEPENDS:%=% OR) /bin/true>' \
| sed -e 's/pkg:\/\(.*\)@.*/REQUIRED_PKGS += \1/g' >$@
pre-prep: required-pkgs.mk
CLEAN_PATHS += required-pkgs.mk