make-rules/ips.mk
changeset 3739 1ad120fc17bb
parent 2208 393dee918e3c
child 3817 30b42c38bbc4
equal deleted inserted replaced
3738:19e0324097d4 3739:1ad120fc17bb
    18 #
    18 #
    19 # CDDL HEADER END
    19 # CDDL HEADER END
    20 #
    20 #
    21 
    21 
    22 #
    22 #
    23 # Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
    23 # Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
    24 #
    24 #
    25 
    25 
    26 #
    26 #
    27 # Rules and Macros for generating an IPS package manifest and publishing an
    27 # Rules and Macros for generating an IPS package manifest and publishing an
    28 # IPS package to a pkg depot.
    28 # IPS package to a pkg depot.
    45 PKGLINT =	/usr/bin/pkglint
    45 PKGLINT =	/usr/bin/pkglint
    46 else
    46 else
    47 PKGLINT =	${WS_TOOLS}/pkglint
    47 PKGLINT =	${WS_TOOLS}/pkglint
    48 endif
    48 endif
    49 PKGMANGLE =	$(WS_TOOLS)/userland-mangler
    49 PKGMANGLE =	$(WS_TOOLS)/userland-mangler
       
    50 
       
    51 # pkgfmt has an odd behavior at present where -c means "check validity
       
    52 # against any format" whereas -d means "diffs against latest format" and
       
    53 # no arguments means "update to latest format".  Thus, 'pkgfmt -c' can
       
    54 # run clean on a v1 manifest that actually needs to be updated.  So we
       
    55 # use the explicit format version argument below.  If this behavior is
       
    56 # changed, then the -f argument below can be dropped.
       
    57 PKGFMT_CHECK_ARGS =	-c -fv2
    50 
    58 
    51 # Package headers should all pretty much follow the same format
    59 # Package headers should all pretty much follow the same format
    52 METADATA_TEMPLATE =		$(WS_TOP)/transforms/manifest-metadata-template
    60 METADATA_TEMPLATE =		$(WS_TOP)/transforms/manifest-metadata-template
    53 COPYRIGHT_TEMPLATE =		$(WS_TOP)/transforms/copyright-template
    61 COPYRIGHT_TEMPLATE =		$(WS_TOP)/transforms/copyright-template
    54 
    62 
   211 define python-manifest-rule
   219 define python-manifest-rule
   212 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY=
   220 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY=
   213 
   221 
   214 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m
   222 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m
   215 	if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; fi
   223 	if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; fi
       
   224 	$(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
   216 	$(PKGMOGRIFY) -D PYVER=$(1) -D PYV=$(shell echo $(1) | tr -d .) $$< > $$@
   225 	$(PKGMOGRIFY) -D PYVER=$(1) -D PYV=$(shell echo $(1) | tr -d .) $$< > $$@
   217 endef
   226 endef
   218 $(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver))))
   227 $(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver))))
   219 
   228 
   220 # A rule to create a helper transform package for python, that will insert the
   229 # A rule to create a helper transform package for python, that will insert the
   234 # mkgeneric-ruby further below).  The authors did not anticipate that this
   243 # mkgeneric-ruby further below).  The authors did not anticipate that this
   235 # mechanism would be extended beyond Python when they wrote it; something
   244 # mechanism would be extended beyond Python when they wrote it; something
   236 # more generic like LANGVER might make more sense, but for now we are
   245 # more generic like LANGVER might make more sense, but for now we are
   237 # sticking with something known to work.
   246 # sticking with something known to work.
   238 $(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python
   247 $(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python
       
   248 	$(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
   239 	$(PKGMOGRIFY) -D PYV=###PYV### $(BUILD_DIR)/mkgeneric-python \
   249 	$(PKGMOGRIFY) -D PYV=###PYV### $(BUILD_DIR)/mkgeneric-python \
   240 		$(WS_TOP)/transforms/mkgeneric $< > $@
   250 		$(WS_TOP)/transforms/mkgeneric $< > $@
   241 	if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
   251 	if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
   242 
   252 
   243 # Define and execute a macro that generates a rule to create a manifest for a
   253 # Define and execute a macro that generates a rule to create a manifest for a
   244 # perl module specific to a particular version of the perl runtime.
   254 # perl module specific to a particular version of the perl runtime.
   245 define perl-manifest-rule
   255 define perl-manifest-rule
   246 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PERLVER.p5m
   256 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PERLVER.p5m
       
   257 	$(PKGFMT) $(PKGFMT_CHECK_ARGS) $$<
   247 	$(PKGMOGRIFY) -D PERLVER=$(1) -D PLV=$(shell echo $(1) | tr -d .) \
   258 	$(PKGMOGRIFY) -D PERLVER=$(1) -D PLV=$(shell echo $(1) | tr -d .) \
   248 		-D PERL_ARCH=$(call PERL_ARCH_FUNC,$(PERL.$(1))) $$< > $$@
   259 		-D PERL_ARCH=$(call PERL_ARCH_FUNC,$(PERL.$(1))) $$< > $$@
   249 endef
   260 endef
   250 $(foreach ver,$(PERL_VERSIONS),$(eval $(call perl-manifest-rule,$(ver))))
   261 $(foreach ver,$(PERL_VERSIONS),$(eval $(call perl-manifest-rule,$(ver))))
   251 
   262 
   260 
   271 
   261 # Build Perl version-wrapping manifests from the generic version.
   272 # Build Perl version-wrapping manifests from the generic version.
   262 # See the block comment above about why "###PYV###" is used here even
   273 # See the block comment above about why "###PYV###" is used here even
   263 # though this is for Perl rather than Python.
   274 # though this is for Perl rather than Python.
   264 $(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl
   275 $(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl
       
   276 	$(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
   265 	$(PKGMOGRIFY) -D PLV=###PYV### $(BUILD_DIR)/mkgeneric-perl \
   277 	$(PKGMOGRIFY) -D PLV=###PYV### $(BUILD_DIR)/mkgeneric-perl \
   266 		$(WS_TOP)/transforms/mkgeneric $< > $@
   278 		$(WS_TOP)/transforms/mkgeneric $< > $@
   267 	if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
   279 	if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
   268 
   280 
   269 # Define and execute a macro that generates a rule to create a manifest for a
   281 # Define and execute a macro that generates a rule to create a manifest for a
   277 
   289 
   278 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m
   290 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m
   279 	if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \
   291 	if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \
   280 		cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \
   292 		cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \
   281 	fi
   293 	fi
       
   294 	$(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
   282 	$(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \
   295 	$(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \
   283 	    -D RUBYV=$(shell echo $(1) | tr -d .) $$< > $$@
   296 	    -D RUBYV=$(shell echo $(1) | tr -d .) $$< > $$@
   284 endef
   297 endef
   285 $(foreach ver,$(RUBY_VERSIONS),\
   298 $(foreach ver,$(RUBY_VERSIONS),\
   286 	$(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \
   299 	$(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \
   300 # Creates build/manifest-*-modulename.p5m file.
   313 # Creates build/manifest-*-modulename.p5m file.
   301 #
   314 #
   302 # See the block comment above about why "###PYV###" is used here even
   315 # See the block comment above about why "###PYV###" is used here even
   303 # though this is for Ruby rather than Python.
   316 # though this is for Ruby rather than Python.
   304 $(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby
   317 $(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby
       
   318 	$(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS)
   305 	$(PKGMOGRIFY) -D RUBYV=###PYV### $(BUILD_DIR)/mkgeneric-ruby \
   319 	$(PKGMOGRIFY) -D RUBYV=###PYV### $(BUILD_DIR)/mkgeneric-ruby \
   306 		$(WS_TOP)/transforms/mkgeneric $< > $@
   320 		$(WS_TOP)/transforms/mkgeneric $< > $@
   307 	if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
   321 	if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi
   308 
   322 
   309 # mogrify non-parameterized manifests
   323 # mogrify non-parameterized manifests
   310 $(MANIFEST_BASE)-%.mogrified:	%.p5m $(BUILD_DIR)
   324 $(MANIFEST_BASE)-%.mogrified:	%.p5m $(BUILD_DIR)
       
   325 	$(PKGFMT) $(PKGFMT_CHECK_ARGS) $<
   311 	$(PKGMOGRIFY) $(PKG_OPTIONS) $< \
   326 	$(PKGMOGRIFY) $(PKG_OPTIONS) $< \
   312 		$(PUBLISH_TRANSFORMS) | \
   327 		$(PUBLISH_TRANSFORMS) | \
   313 		sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@
   328 		sed -e '/^$$/d' -e '/^#.*$$/d' | uniq >$@
   314 
   329 
   315 # mogrify parameterized manifests
   330 # mogrify parameterized manifests