103 |
103 |
104 CANONICAL_MANIFESTS = $(wildcard *.p5m) |
104 CANONICAL_MANIFESTS = $(wildcard *.p5m) |
105 |
105 |
106 # Look for manifests which need to be duplicated for each version of python. |
106 # Look for manifests which need to be duplicated for each version of python. |
107 ifeq ($(findstring -PYVER,$(CANONICAL_MANIFESTS)),-PYVER) |
107 ifeq ($(findstring -PYVER,$(CANONICAL_MANIFESTS)),-PYVER) |
108 UNVERSIONED_MANIFESTS = $(filter-out %-GENFRAG.p5m,$(filter-out %-PYVER.p5m,$(CANONICAL_MANIFESTS))) |
108 UNVERSIONED_MANIFESTS = $(filter-out %GENFRAG.p5m,$(filter-out %-PYVER.p5m,$(CANONICAL_MANIFESTS))) |
109 PY_MANIFESTS = $(filter %-PYVER.p5m,$(CANONICAL_MANIFESTS)) |
109 PY_MANIFESTS = $(filter %-PYVER.p5m,$(CANONICAL_MANIFESTS)) |
110 PYV_MANIFESTS = $(foreach v,$(shell echo $(PYTHON_VERSIONS) | tr -d .),$(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER.p5m/-$(v).p5m/g')) |
110 PYV_MANIFESTS = $(foreach v,$(shell echo $(PYTHON_VERSIONS) | tr -d .),$(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER.p5m/-$(v).p5m/g')) |
111 PYNV_MANIFESTS = $(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER//') |
111 PYNV_MANIFESTS = $(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER//') |
112 else |
112 else |
113 UNVERSIONED_MANIFESTS = $(CANONICAL_MANIFESTS) |
113 UNVERSIONED_MANIFESTS = $(CANONICAL_MANIFESTS) |
114 endif |
114 endif |
115 |
115 |
116 # Look for manifests which need to be duplicated for each version of perl. |
116 # Look for manifests which need to be duplicated for each version of perl. |
117 ifeq ($(findstring -PERLVER,$(UNVERSIONED_MANIFESTS)),-PERLVER) |
117 ifeq ($(findstring -PERLVER,$(UNVERSIONED_MANIFESTS)),-PERLVER) |
118 NOPERL_MANIFESTS = $(filter-out %-GENFRAG.p5m,$(filter-out %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS))) |
118 NOPERL_MANIFESTS = $(filter-out %GENFRAG.p5m,$(filter-out %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS))) |
119 PERL_MANIFESTS = $(filter %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS)) |
119 PERL_MANIFESTS = $(filter %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS)) |
120 PERLV_MANIFESTS = $(foreach v,$(shell echo $(PERL_VERSIONS) | tr -d .),$(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER.p5m/-$(v).p5m/g')) |
120 PERLV_MANIFESTS = $(foreach v,$(shell echo $(PERL_VERSIONS) | tr -d .),$(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER.p5m/-$(v).p5m/g')) |
121 PERLNV_MANIFESTS = $(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER//') |
121 PERLNV_MANIFESTS = $(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER//') |
122 else |
122 else |
123 NOPERL_MANIFESTS = $(UNVERSIONED_MANIFESTS) |
123 NOPERL_MANIFESTS = $(UNVERSIONED_MANIFESTS) |
124 endif |
124 endif |
125 |
125 |
|
126 # Look for manifests which need to be duplicated for each version of ruby. |
|
127 # NOPERL_MANIFESTS represents the manifests that are not Python or |
|
128 # Perl manifests. Extract the Ruby Manifests from NOPERL_MANIFESTS. |
|
129 # Any remaining manifests are stored in NONRUBY_MANIFESTS |
|
130 ifeq ($(findstring -RUBYVER,$(NOPERL_MANIFESTS)),-RUBYVER) |
|
131 NORUBY_MANIFESTS = $(filter-out %GENFRAG.p5m,\ |
|
132 $(filter-out %-RUBYVER.p5m,$(NOPERL_MANIFESTS))) |
|
133 RUBY_MANIFESTS = $(filter %-RUBYVER.p5m,$(NOPERL_MANIFESTS)) |
|
134 RUBYV_MANIFESTS = $(foreach v,$(shell echo $(RUBY_VERSIONS)),\ |
|
135 $(shell echo $(RUBY_MANIFESTS) |\ |
|
136 sed -e 's/-RUBYVER.p5m/-$(shell echo $(v) |\ |
|
137 cut -d. -f1,2 | tr -d .).p5m/g')) |
|
138 RUBYNV_MANIFESTS = $(shell echo $(RUBY_MANIFESTS) | sed -e 's/-RUBYVER//') |
|
139 else |
|
140 NORUBY_MANIFESTS = $(NOPERL_MANIFESTS) |
|
141 endif |
|
142 |
126 VERSIONED_MANIFESTS = \ |
143 VERSIONED_MANIFESTS = \ |
127 $(PYV_MANIFESTS) $(PYNV_MANIFESTS) \ |
144 $(PYV_MANIFESTS) $(PYNV_MANIFESTS) \ |
128 $(PERLV_MANIFESTS) $(PERLNV_MANIFESTS) \ |
145 $(PERLV_MANIFESTS) $(PERLNV_MANIFESTS) \ |
129 $(NOPERL_MANIFESTS) |
146 $(RUBYV_MANIFESTS) $(RUBYNV_MANIFESTS) \ |
|
147 $(NORUBY_MANIFESTS) |
130 |
148 |
131 GENERATED = $(MANIFEST_BASE)-generated |
149 GENERATED = $(MANIFEST_BASE)-generated |
132 COMBINED = $(MANIFEST_BASE)-combined |
150 COMBINED = $(MANIFEST_BASE)-combined |
133 MANIFESTS = $(VERSIONED_MANIFESTS:%=$(MANIFEST_BASE)-%) |
151 MANIFESTS = $(VERSIONED_MANIFESTS:%=$(MANIFEST_BASE)-%) |
134 |
152 |
165 # The text of a transform that will emit a dependency conditional on the |
183 # The text of a transform that will emit a dependency conditional on the |
166 # presence of a particular version of a runtime, which will then draw in the |
184 # presence of a particular version of a runtime, which will then draw in the |
167 # runtime-version-specific version of the package we're operating on. $(1) is |
185 # runtime-version-specific version of the package we're operating on. $(1) is |
168 # the name of the runtime package, and $(2) is the version suffix. |
186 # the name of the runtime package, and $(2) is the version suffix. |
169 mkgeneric = \ |
187 mkgeneric = \ |
170 echo "<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-\#\#\#@(.*)" \ |
188 echo "<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-\#\#\#PYV\#\#\#@(.*)" \ |
171 "-> emit depend nodrop=true type=conditional" \ |
189 "-> emit depend nodrop=true type=conditional" \ |
172 "predicate=$(1)-$(2) fmri=%<1>-$(2)@%<2>>" >> $@; |
190 "predicate=$(1)-$(2) fmri=%<1>-$(2)@%<2>>" >> $@; |
173 |
191 |
174 # Define and execute a macro that generates a rule to create a manifest for a |
192 # Define and execute a macro that generates a rule to create a manifest for a |
175 # python module specific to a particular version of the python runtime. |
193 # python module specific to a particular version of the python runtime. |
|
194 # Creates build/manifest-*-modulename-##.p5m file where ## is replaced with |
|
195 # the version number. |
176 define python-manifest-rule |
196 define python-manifest-rule |
177 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY= |
197 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY= |
178 |
198 |
179 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m |
199 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m |
|
200 if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; fi |
180 $(PKGMOGRIFY) -D PYVER=$(1) -D PYV=$(shell echo $(1) | tr -d .) $$< > $$@ |
201 $(PKGMOGRIFY) -D PYVER=$(1) -D PYV=$(shell echo $(1) | tr -d .) $$< > $$@ |
181 endef |
202 endef |
182 $(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver)))) |
203 $(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver)))) |
183 |
204 |
184 # A rule to create a helper transform package for python, that will insert the |
205 # A rule to create a helper transform package for python, that will insert the |
189 $(RM) $@ |
210 $(RM) $@ |
190 $(foreach ver,$(shell echo $(PYTHON_VERSIONS) | tr -d .), \ |
211 $(foreach ver,$(shell echo $(PYTHON_VERSIONS) | tr -d .), \ |
191 $(call mkgeneric,runtime/python,$(ver))) |
212 $(call mkgeneric,runtime/python,$(ver))) |
192 |
213 |
193 # Build Python version-wrapping manifests from the generic version. |
214 # Build Python version-wrapping manifests from the generic version. |
|
215 # Creates build/manifest-*-modulename.p5m file. |
194 $(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python |
216 $(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python |
195 $(PKGMOGRIFY) -D PYV=### $(BUILD_DIR)/mkgeneric-python \ |
217 $(PKGMOGRIFY) -D PYV=###PYV### $(BUILD_DIR)/mkgeneric-python \ |
196 $(WS_TOP)/transforms/mkgeneric $< > $@ |
218 $(WS_TOP)/transforms/mkgeneric $< > $@ |
197 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
219 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
198 |
220 |
199 # Define and execute a macro that generates a rule to create a manifest for a |
221 # Define and execute a macro that generates a rule to create a manifest for a |
200 # perl module specific to a particular version of the perl runtime. |
222 # perl module specific to a particular version of the perl runtime. |
215 $(call mkgeneric,runtime/perl,$(ver))) |
237 $(call mkgeneric,runtime/perl,$(ver))) |
216 |
238 |
217 # Build Perl version-wrapping manifests from the generic version. |
239 # Build Perl version-wrapping manifests from the generic version. |
218 $(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl |
240 $(MANIFEST_BASE)-%.p5m: %-PERLVER.p5m $(BUILD_DIR)/mkgeneric-perl |
219 $(PKGMOGRIFY) -D PLV=### $(BUILD_DIR)/mkgeneric-perl \ |
241 $(PKGMOGRIFY) -D PLV=### $(BUILD_DIR)/mkgeneric-perl \ |
|
242 $(WS_TOP)/transforms/mkgeneric $< > $@ |
|
243 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
|
244 |
|
245 # Define and execute a macro that generates a rule to create a manifest for a |
|
246 # ruby module specific to a particular version of the ruby runtime. |
|
247 # Creates build/manifest-*-modulename-##.p5m file where ## is replaced with |
|
248 # the version number. |
|
249 define ruby-manifest-rule |
|
250 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: \ |
|
251 PKG_MACROS += RUBY_VERSION=$(1) RUBY_LIB_VERSION=$(2) \ |
|
252 RUBYV=$(subst .,,$(1)) |
|
253 |
|
254 $(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m |
|
255 if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \ |
|
256 cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> $$@; \ |
|
257 fi |
|
258 $(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \ |
|
259 -D RUBYV=$(shell echo $(1) | tr -d .) $$< > $$@ |
|
260 endef |
|
261 $(foreach ver,$(RUBY_VERSIONS),\ |
|
262 $(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \ |
|
263 cut -d. -f1,2),$(ver)))) |
|
264 |
|
265 # A rule to create a helper transform package for ruby, that will insert the |
|
266 # appropriate conditional dependencies into a ruby library's |
|
267 # runtime-version-generic package to pull in the version-specific bits when the |
|
268 # corresponding version of ruby is on the system. |
|
269 $(BUILD_DIR)/mkgeneric-ruby: $(WS_TOP)/make-rules/shared-macros.mk |
|
270 $(RM) $@ |
|
271 $(foreach ver,$(RUBY_VERSIONS),\ |
|
272 $(call mkgeneric,runtime/ruby,$(shell echo $(ver) | \ |
|
273 cut -d. -f1,2 | tr -d .))) |
|
274 |
|
275 # Build Ruby version-wrapping manifests from the generic version. |
|
276 # Creates build/manifest-*-modulename.p5m file. |
|
277 # |
|
278 # ###PYV### is used here as the mkgeneric() call used to create |
|
279 # mkgeneric-ruby uses this value version subsitute key. We also |
|
280 # use the same key, ###PYV###, to pick up the required entry |
|
281 # in mkgeneric when pkgmogrify is invoked |
|
282 $(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby |
|
283 $(PKGMOGRIFY) -D RUBYV=###PYV### $(BUILD_DIR)/mkgeneric-ruby \ |
220 $(WS_TOP)/transforms/mkgeneric $< > $@ |
284 $(WS_TOP)/transforms/mkgeneric $< > $@ |
221 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
285 if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> $@; fi |
222 |
286 |
223 # mogrify non-parameterized manifests |
287 # mogrify non-parameterized manifests |
224 $(MANIFEST_BASE)-%.mogrified: %.p5m $(BUILD_DIR) |
288 $(MANIFEST_BASE)-%.mogrified: %.p5m $(BUILD_DIR) |