98 # to install. |
98 # to install. |
99 ifeq ($(BUILD_TYPE),evaluation) |
99 ifeq ($(BUILD_TYPE),evaluation) |
100 PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/evaluation |
100 PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/evaluation |
101 endif |
101 endif |
102 |
102 |
103 PKG_MACROS += MACH=$(MACH) |
103 # For items defined as variables or that may contain whitespace, add |
104 PKG_MACROS += MACH32=$(MACH32) |
104 # them to a list to be expanded into PKG_OPTIONS later. |
105 PKG_MACROS += MACH64=$(MACH64) |
105 PKG_VARS += ARC_CASE TPNO |
106 PKG_MACROS += PUBLISHER=$(PUBLISHER) |
106 PKG_VARS += BUILD_VERSION OS_VERSION SOLARIS_VERSION PKG_SOLARIS_VERSION |
107 PKG_MACROS += PUBLISHER_LOCALIZABLE=$(PUBLISHER_LOCALIZABLE) |
107 PKG_VARS += CONSOLIDATION CONSOLIDATION_CHANGESET CONSOLIDATION_REPOSITORY_URL |
108 PKG_MACROS += CONSOLIDATION=$(CONSOLIDATION) |
108 PKG_VARS += COMPONENT_VERSION IPS_COMPONENT_VERSION HUMAN_VERSION |
109 PKG_MACROS += BUILD_VERSION=$(BUILD_VERSION) |
109 PKG_VARS += COMPONENT_ARCHIVE_URL COMPONENT_PROJECT_URL COMPONENT_NAME |
110 PKG_MACROS += SOLARIS_VERSION=$(SOLARIS_VERSION) |
110 PKG_VARS += HG_REPO HG_REV HG_URL |
111 PKG_MACROS += OS_VERSION=$(OS_VERSION) |
111 PKG_VARS += MACH MACH32 MACH64 |
112 PKG_MACROS += PKG_SOLARIS_VERSION=$(PKG_SOLARIS_VERSION) |
112 PKG_VARS += PUBLISHER PUBLISHER_LOCALIZABLE |
113 PKG_MACROS += SOLARIS_12_ONLY=$(SOLARIS_12_ONLY) |
113 PKG_VARS += SOLARIS_11_ONLY SOLARIS_12_ONLY |
114 PKG_MACROS += SOLARIS_11_ONLY=$(SOLARIS_11_ONLY) |
114 |
115 PKG_MACROS += HUMAN_VERSION=$(HUMAN_VERSION) |
115 # Include TPNO_* Makefile variables in PKG_VARS. |
116 PKG_MACROS += IPS_COMPONENT_VERSION=$(IPS_COMPONENT_VERSION) |
116 $(foreach macro, $(filter TPNO_%, $(.VARIABLES)), \ |
|
117 $(eval PKG_VARS += $(macro)) \ |
|
118 ) |
|
119 |
|
120 # For items that need special definition, add them to PKG_MACROS. |
117 # IPS_COMPONENT_VERSION suitable for use in regular expressions. |
121 # IPS_COMPONENT_VERSION suitable for use in regular expressions. |
118 PKG_MACROS += IPS_COMPONENT_RE_VERSION=$(subst .,\\.,$(IPS_COMPONENT_VERSION)) |
122 PKG_MACROS += IPS_COMPONENT_RE_VERSION=$(subst .,\\.,$(IPS_COMPONENT_VERSION)) |
119 PKG_MACROS += COMPONENT_VERSION=$(COMPONENT_VERSION) |
|
120 # COMPONENT_VERSION suitable for use in regular expressions. |
123 # COMPONENT_VERSION suitable for use in regular expressions. |
121 PKG_MACROS += COMPONENT_RE_VERSION=$(subst .,\\.,$(COMPONENT_VERSION)) |
124 PKG_MACROS += COMPONENT_RE_VERSION=$(subst .,\\.,$(COMPONENT_VERSION)) |
122 PKG_MACROS += COMPONENT_PROJECT_URL=$(COMPONENT_PROJECT_URL) |
|
123 PKG_MACROS += COMPONENT_ARCHIVE_URL=$(COMPONENT_ARCHIVE_URL) |
|
124 PKG_MACROS += COMPONENT_HG_URL=$(COMPONENT_HG_URL) |
|
125 PKG_MACROS += COMPONENT_HG_REV=$(COMPONENT_HG_REV) |
|
126 PKG_MACROS += COMPONENT_NAME=$(COMPONENT_NAME) |
|
127 PKG_MACROS += ARC_CASE=$(ARC_CASE) |
|
128 PKG_MACROS += TPNO=$(TPNO) |
|
129 PKG_MACROS += CONSOLIDATION_CHANGESET=$(CONSOLIDATION_CHANGESET) |
|
130 PKG_MACROS += CONSOLIDATION_REPOSITORY_URL=$(CONSOLIDATION_REPOSITORY_URL) |
|
131 |
|
132 # Add any TPNO_* Makefile macros to the pkgmogrify arguments. |
|
133 $(foreach macro, $(filter TPNO_%, $(.VARIABLES)), \ |
|
134 $(eval PKG_MACROS += $(macro)=$$($(macro))) \ |
|
135 ) |
|
136 |
125 |
137 PKG_MACROS += PYTHON_2.7_ONLY=\# |
126 PKG_MACROS += PYTHON_2.7_ONLY=\# |
138 PKG_MACROS += PYTHON_3.4_ONLY=\# |
127 PKG_MACROS += PYTHON_3.4_ONLY=\# |
139 PKG_MACROS += PYTHON_3.5_ONLY=\# |
128 PKG_MACROS += PYTHON_3.5_ONLY=\# |
|
129 |
|
130 # Convenience macros for quoting in manifests; necessary because pkgfmt will |
|
131 # drop literal quotes in attribute values if they do not contain whitespace |
|
132 # since the action parsing in pkg will drop them during action stringification. |
|
133 PKG_MACROS += SQ=\' |
|
134 PKG_MACROS += DQ=\" |
|
135 PKG_MACROS += Q=\" |
140 |
136 |
141 PKG_OPTIONS += $(PKG_MACROS:%=-D %) |
137 PKG_OPTIONS += $(PKG_MACROS:%=-D %) |
142 |
138 |
143 MANGLED_DIR = $(PROTO_DIR)/mangled |
139 MANGLED_DIR = $(PROTO_DIR)/mangled |
144 |
140 |
248 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY= |
244 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY= |
249 |
245 |
250 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m |
246 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m |
251 if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; fi |
247 if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; fi |
252 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
248 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
253 $(PKGMOGRIFY) -D PYVER=$(1) -D PYV=$(shell echo $(1) | tr -d .) $$< > $$@ |
249 $(PKGMOGRIFY) -D PYVER=$(1) -D MAYBE_PYVER_SPACE="$(1) " \ |
|
250 -D MAYBE_SPACE_PYVER=" $(1)" \ |
|
251 -D PYV=$(shell echo $(1) | tr -d .) $$< > $$@ |
254 endef |
252 endef |
255 $(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver)))) |
253 $(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver)))) |
256 |
254 |
257 # A rule to create a helper transform package for python, that will insert the |
255 # A rule to create a helper transform package for python, that will insert the |
258 # appropriate conditional dependencies into a python library's |
256 # appropriate conditional dependencies into a python library's |
272 # mechanism would be extended beyond Python when they wrote it; something |
270 # mechanism would be extended beyond Python when they wrote it; something |
273 # more generic like LANGVER might make more sense, but for now we are |
271 # more generic like LANGVER might make more sense, but for now we are |
274 # sticking with something known to work. |
272 # sticking with something known to work. |
275 $(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python |
273 $(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python |
276 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
274 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
277 $(PKGMOGRIFY) -D PYV=###PYV### $(BUILD_DIR)/mkgeneric-python \ |
275 $(PKGMOGRIFY) -D PYV=###PYV### -D MAYBE_PYVER_SPACE= \ |
|
276 -D MAYBE_SPACE_PYVER= $(BUILD_DIR)/mkgeneric-python \ |
278 $(WS_TOP)/transforms/mkgeneric $< > $@ |
277 $(WS_TOP)/transforms/mkgeneric $< > $@ |
279 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
278 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
280 |
279 |
281 # Define and execute a macro that generates a rule to create a manifest for a |
280 # Define and execute a macro that generates a rule to create a manifest for a |
282 # perl module specific to a particular version of the perl runtime. |
281 # perl module specific to a particular version of the perl runtime. |
283 define perl-manifest-rule |
282 define perl-manifest-rule |
284 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PERLVER.p5m |
283 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PERLVER.p5m |
285 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $$< |
284 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $$< |
286 $(PKGMOGRIFY) -D PERLVER=$(1) -D PLV=$(shell echo $(1) | tr -d .) \ |
285 $(PKGMOGRIFY) -D PERLVER=$(1) -D MAYBE_PERLVER_SPACE="$(1) " \ |
|
286 -D MAYBE_SPACE_PERLVER=" $(1)" \ |
|
287 -D PLV=$(shell echo $(1) | tr -d .) \ |
287 -D PERL_ARCH=$(call PERL_ARCH_FUNC,$(PERL.$(1))) $$< > $$@ |
288 -D PERL_ARCH=$(call PERL_ARCH_FUNC,$(PERL.$(1))) $$< > $$@ |
288 endef |
289 endef |
289 $(foreach ver,$(PERL_VERSIONS),$(eval $(call perl-manifest-rule,$(ver)))) |
290 $(foreach ver,$(PERL_VERSIONS),$(eval $(call perl-manifest-rule,$(ver)))) |
290 |
291 |
291 # A rule to create a helper transform package for perl, that will insert the |
292 # A rule to create a helper transform package for perl, that will insert the |
300 # Build Perl version-wrapping manifests from the generic version. |
301 # Build Perl version-wrapping manifests from the generic version. |
301 # See the block comment above about why "###PYV###" is used here even |
302 # See the block comment above about why "###PYV###" is used here even |
302 # though this is for Perl rather than Python. |
303 # though this is for Perl rather than Python. |
303 $(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl |
304 $(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl |
304 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
305 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
305 $(PKGMOGRIFY) -D PLV=###PYV### $(BUILD_DIR)/mkgeneric-perl \ |
306 $(PKGMOGRIFY) -D PLV=###PYV### -D MAYBE_PERLVER_SPACE= \ |
|
307 -D MAYBE_SPACE_PERLVER= $(BUILD_DIR)/mkgeneric-perl \ |
306 $(WS_TOP)/transforms/mkgeneric $< > $@ |
308 $(WS_TOP)/transforms/mkgeneric $< > $@ |
307 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
309 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
308 |
310 |
309 # Define and execute a macro that generates a rule to create a manifest for a |
311 # Define and execute a macro that generates a rule to create a manifest for a |
310 # ruby module specific to a particular version of the ruby runtime. |
312 # ruby module specific to a particular version of the ruby runtime. |
319 if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \ |
321 if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \ |
320 cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \ |
322 cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \ |
321 fi |
323 fi |
322 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
324 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
323 $(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \ |
325 $(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \ |
|
326 -D MAYBE_RUBY_VERSION_SPACE="$(1) " \ |
|
327 -D MAYBE_SPACE_RUBY_VERSION=" $(1)" \ |
324 -D RUBYV=$(shell echo $(1) | tr -d .) $$< > $$@ |
328 -D RUBYV=$(shell echo $(1) | tr -d .) $$< > $$@ |
325 endef |
329 endef |
326 $(foreach ver,$(RUBY_VERSIONS),\ |
330 $(foreach ver,$(RUBY_VERSIONS),\ |
327 $(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \ |
331 $(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \ |
328 cut -d. -f1,2),$(ver)))) |
332 cut -d. -f1,2),$(ver)))) |
342 # |
346 # |
343 # See the block comment above about why "###PYV###" is used here even |
347 # See the block comment above about why "###PYV###" is used here even |
344 # though this is for Ruby rather than Python. |
348 # though this is for Ruby rather than Python. |
345 $(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby |
349 $(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby |
346 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
350 $(PKGFMT) $(PKGFMT_CHECK_ARGS) $(CANONICAL_MANIFESTS) |
347 $(PKGMOGRIFY) -D RUBYV=###PYV### $(BUILD_DIR)/mkgeneric-ruby \ |
351 $(PKGMOGRIFY) -D RUBYV=###PYV### -D MAYBE_RUBY_VERSION_SPACE= \ |
|
352 -D MAYBE_SPACE_RUBY_VERSION= $(BUILD_DIR)/mkgeneric-ruby \ |
348 $(WS_TOP)/transforms/mkgeneric $< > $@ |
353 $(WS_TOP)/transforms/mkgeneric $< > $@ |
349 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
354 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
350 |
355 |
351 # Rule to generate historical manifests from the $(HISTORY) file. |
356 # Rule to generate historical manifests from the $(HISTORY) file. |
352 define history-manifest-rule |
357 define history-manifest-rule |
483 # Once created, it will need to be reviewed, edited, and added to the |
488 # Once created, it will need to be reviewed, edited, and added to the |
484 # workspace. |
489 # workspace. |
485 $(error Missing canonical manifest(s)) |
490 $(error Missing canonical manifest(s)) |
486 endif |
491 endif |
487 |
492 |
488 # Add component-specific variables and export to PKG_MACROS. |
493 # Add component-specific variables and export to PKG_OPTIONS. |
489 COMP_SUFFIXES = $(subst COMPONENT_NAME_,, \ |
494 COMP_SUFFIXES = $(subst COMPONENT_NAME_,, \ |
490 $(filter COMPONENT_NAME_%, $(.VARIABLES))) |
495 $(filter COMPONENT_NAME_%, $(.VARIABLES))) |
491 |
496 |
492 # The filtering out of specific variables below is to avoid component variables |
497 # Component variables are expanded directly to PKG_OPTIONS instead of via |
493 # that have spaces in their values or that have already been processed above. |
498 # PKG_MACROS since the values may contain whitespace. |
494 # PKG_MACROS with spaces in their values remain unsupported for now. |
499 mkdefine = -D $(1)="$(2)" |
|
500 |
|
501 # Expand PKG_VARS into defines via PKG_OPTIONS. |
|
502 $(foreach var, $(PKG_VARS), \ |
|
503 $(eval PKG_OPTIONS += $(call mkdefine,$(var),$$($(var)))) \ |
|
504 ) |
|
505 |
|
506 # Expand any variables ending in component _$(suffix) via PKG_OPTIONS excluding |
|
507 # variables known to always be irrelevant and TPNO_% variables as those have |
|
508 # already been processed. |
495 $(foreach suffix, $(COMP_SUFFIXES), \ |
509 $(foreach suffix, $(COMP_SUFFIXES), \ |
496 $(eval COMPONENT_RE_VERSION_$(suffix) ?= $(subst .,\\.,$$(COMPONENT_VERSION_$(suffix)))) \ |
510 $(eval COMPONENT_RE_VERSION_$(suffix) ?= $(subst .,\\.,$$(COMPONENT_VERSION_$(suffix)))) \ |
497 $(eval IPS_COMPONENT_VERSION_$(suffix) ?= $$(COMPONENT_VERSION_$(suffix))) \ |
511 $(eval IPS_COMPONENT_VERSION_$(suffix) ?= $$(COMPONENT_VERSION_$(suffix))) \ |
498 $(eval IPS_COMPONENT_RE_VERSION_$(suffix) ?= $(subst .,\\.,$$(IPS_COMPONENT_VERSION_$(suffix)))) \ |
512 $(eval IPS_COMPONENT_RE_VERSION_$(suffix) ?= $(subst .,\\.,$$(IPS_COMPONENT_VERSION_$(suffix)))) \ |
499 $(eval COMP_VARS=$(filter-out TPNO_%, $(.VARIABLES))) \ |
513 $(eval COMP_VARS=$(filter %_$(suffix), $(.VARIABLES))) \ |
500 $(eval COMP_VARS=$(filter-out COMPONENT_POST_UNPACK_%, $(COMP_VARS))) \ |
514 $(eval COMP_VARS=$(filter-out COMPONENT_POST_UNPACK_%, $(COMP_VARS))) \ |
|
515 $(eval COMP_VARS=$(filter-out TPNO_%, $(COMP_VARS))) \ |
501 $(eval COMP_VARS=$(filter-out UNPACK_ARGS_%, $(COMP_VARS))) \ |
516 $(eval COMP_VARS=$(filter-out UNPACK_ARGS_%, $(COMP_VARS))) \ |
502 $(foreach macro, $(filter %_$(suffix), $(COMP_VARS)), \ |
517 $(foreach macro, $(COMP_VARS), \ |
503 $(eval PKG_MACROS += $(macro)=$$($(macro))) \ |
518 $(eval PKG_OPTIONS += $(call mkdefine,$(macro),$$($(macro)))) \ |
504 ) \ |
519 ) \ |
505 ) |
520 ) |