--- a/make-rules/ips.mk Thu Oct 09 07:14:28 2014 -0700
+++ b/make-rules/ips.mk Thu Oct 09 15:53:40 2014 -0700
@@ -105,7 +105,7 @@
# Look for manifests which need to be duplicated for each version of python.
ifeq ($(findstring -PYVER,$(CANONICAL_MANIFESTS)),-PYVER)
-UNVERSIONED_MANIFESTS = $(filter-out %-GENFRAG.p5m,$(filter-out %-PYVER.p5m,$(CANONICAL_MANIFESTS)))
+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'))
PYNV_MANIFESTS = $(shell echo $(PY_MANIFESTS) | sed -e 's/-PYVER//')
@@ -115,7 +115,7 @@
# Look for manifests which need to be duplicated for each version of perl.
ifeq ($(findstring -PERLVER,$(UNVERSIONED_MANIFESTS)),-PERLVER)
-NOPERL_MANIFESTS = $(filter-out %-GENFRAG.p5m,$(filter-out %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS)))
+NOPERL_MANIFESTS = $(filter-out %GENFRAG.p5m,$(filter-out %-PERLVER.p5m,$(UNVERSIONED_MANIFESTS)))
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'))
PERLNV_MANIFESTS = $(shell echo $(PERL_MANIFESTS) | sed -e 's/-PERLVER//')
@@ -123,10 +123,28 @@
NOPERL_MANIFESTS = $(UNVERSIONED_MANIFESTS)
endif
+# Look for manifests which need to be duplicated for each version of ruby.
+# NOPERL_MANIFESTS represents the manifests that are not Python or
+# Perl manifests. Extract the Ruby Manifests from NOPERL_MANIFESTS.
+# Any remaining manifests are stored in NONRUBY_MANIFESTS
+ifeq ($(findstring -RUBYVER,$(NOPERL_MANIFESTS)),-RUBYVER)
+NORUBY_MANIFESTS = $(filter-out %GENFRAG.p5m,\
+ $(filter-out %-RUBYVER.p5m,$(NOPERL_MANIFESTS)))
+RUBY_MANIFESTS = $(filter %-RUBYVER.p5m,$(NOPERL_MANIFESTS))
+RUBYV_MANIFESTS = $(foreach v,$(shell echo $(RUBY_VERSIONS)),\
+ $(shell echo $(RUBY_MANIFESTS) |\
+ sed -e 's/-RUBYVER.p5m/-$(shell echo $(v) |\
+ cut -d. -f1,2 | tr -d .).p5m/g'))
+RUBYNV_MANIFESTS = $(shell echo $(RUBY_MANIFESTS) | sed -e 's/-RUBYVER//')
+else
+NORUBY_MANIFESTS = $(NOPERL_MANIFESTS)
+endif
+
VERSIONED_MANIFESTS = \
$(PYV_MANIFESTS) $(PYNV_MANIFESTS) \
$(PERLV_MANIFESTS) $(PERLNV_MANIFESTS) \
- $(NOPERL_MANIFESTS)
+ $(RUBYV_MANIFESTS) $(RUBYNV_MANIFESTS) \
+ $(NORUBY_MANIFESTS)
GENERATED = $(MANIFEST_BASE)-generated
COMBINED = $(MANIFEST_BASE)-combined
@@ -167,16 +185,19 @@
# runtime-version-specific version of the package we're operating on. $(1) is
# the name of the runtime package, and $(2) is the version suffix.
mkgeneric = \
- echo "<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-\#\#\#@(.*)" \
+ echo "<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-\#\#\#PYV\#\#\#@(.*)" \
"-> emit depend nodrop=true type=conditional" \
"predicate=$(1)-$(2) fmri=%<1>-$(2)@%<2>>" >> [email protected];
# Define and execute a macro that generates a rule to create a manifest for a
# python module specific to a particular version of the python runtime.
+# Creates build/manifest-*-modulename-##.p5m file where ## is replaced with
+# the version number.
define python-manifest-rule
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: PKG_MACROS += PYTHON_$(1)_ONLY=
$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-PYVER.p5m
+ if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> [email protected]; fi
$(PKGMOGRIFY) -D PYVER=$(1) -D PYV=$(shell echo $(1) | tr -d .) $$< > [email protected]
endef
$(foreach ver,$(PYTHON_VERSIONS),$(eval $(call python-manifest-rule,$(ver))))
@@ -191,8 +212,9 @@
$(call mkgeneric,runtime/python,$(ver)))
# Build Python version-wrapping manifests from the generic version.
+# Creates build/manifest-*-modulename.p5m file.
$(MANIFEST_BASE)-%.p5m: %-PYVER.p5m $(BUILD_DIR)/mkgeneric-python
- $(PKGMOGRIFY) -D PYV=### $(BUILD_DIR)/mkgeneric-python \
+ $(PKGMOGRIFY) -D PYV=###PYV### $(BUILD_DIR)/mkgeneric-python \
$(WS_TOP)/transforms/mkgeneric $< > [email protected]
if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> [email protected]; fi
@@ -220,6 +242,48 @@
$(WS_TOP)/transforms/mkgeneric $< > [email protected]
if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> [email protected]; fi
+# Define and execute a macro that generates a rule to create a manifest for a
+# ruby module specific to a particular version of the ruby runtime.
+# Creates build/manifest-*-modulename-##.p5m file where ## is replaced with
+# the version number.
+define ruby-manifest-rule
+$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).mogrified: \
+ PKG_MACROS += RUBY_VERSION=$(1) RUBY_LIB_VERSION=$(2) \
+ RUBYV=$(subst .,,$(1))
+
+$(MANIFEST_BASE)-%-$(shell echo $(1) | tr -d .).p5m: %-RUBYVER.p5m
+ if [ -f $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m ]; then \
+ cat $$*-$(shell echo $(1) | tr -d .)GENFRAG.p5m >> [email protected]; \
+ fi
+ $(PKGMOGRIFY) -D RUBY_VERSION=$(1) -D RUBY_LIB_VERSION=$(2) \
+ -D RUBYV=$(shell echo $(1) | tr -d .) $$< > [email protected]
+endef
+$(foreach ver,$(RUBY_VERSIONS),\
+ $(eval $(call ruby-manifest-rule,$(shell echo $(ver) | \
+ cut -d. -f1,2),$(ver))))
+
+# A rule to create a helper transform package for ruby, that will insert the
+# appropriate conditional dependencies into a ruby library's
+# runtime-version-generic package to pull in the version-specific bits when the
+# corresponding version of ruby is on the system.
+$(BUILD_DIR)/mkgeneric-ruby: $(WS_TOP)/make-rules/shared-macros.mk
+ $(RM) [email protected]
+ $(foreach ver,$(RUBY_VERSIONS),\
+ $(call mkgeneric,runtime/ruby,$(shell echo $(ver) | \
+ cut -d. -f1,2 | tr -d .)))
+
+# Build Ruby version-wrapping manifests from the generic version.
+# Creates build/manifest-*-modulename.p5m file.
+#
+# ###PYV### is used here as the mkgeneric() call used to create
+# mkgeneric-ruby uses this value version subsitute key. We also
+# use the same key, ###PYV###, to pick up the required entry
+# in mkgeneric when pkgmogrify is invoked
+$(MANIFEST_BASE)-%.p5m: %-RUBYVER.p5m $(BUILD_DIR)/mkgeneric-ruby
+ $(PKGMOGRIFY) -D RUBYV=###PYV### $(BUILD_DIR)/mkgeneric-ruby \
+ $(WS_TOP)/transforms/mkgeneric $< > [email protected]
+ if [ -f $*-GENFRAG.p5m ]; then cat $*-GENFRAG.p5m >> [email protected]; fi
+
# mogrify non-parameterized manifests
$(MANIFEST_BASE)-%.mogrified: %.p5m $(BUILD_DIR)
$(PKGMOGRIFY) $(PKG_OPTIONS) $< \