Page MenuHomeFreeBSD

D13333.id36091.diff
No OneTemporary

D13333.id36091.diff

Index: Mk/Uses/gem.mk
===================================================================
--- Mk/Uses/gem.mk
+++ Mk/Uses/gem.mk
@@ -24,7 +24,7 @@
BUILD_DEPENDS+= ${RUBYGEMBIN}:devel/ruby-gems
RUN_DEPENDS+= ${RUBYGEMBIN}:devel/ruby-gems
-PKGNAMEPREFIX?= rubygem-
+PKGNAMEPREFIX?= rubygem${RUBY_VER:S/.//}-
EXTRACT_SUFX= .gem
EXTRACT_ONLY=
DIST_SUBDIR= rubygem
Index: Mk/bsd.ruby.mk
===================================================================
--- Mk/bsd.ruby.mk
+++ Mk/bsd.ruby.mk
@@ -48,6 +48,7 @@
# expression will be set to RUBY_PROVIDED, which is
# left undefined if the result is nil, false or a
# zero-length string. Implies USE_RUBY.
+# USE_RUBY_FLAVORS - Set to build multiple flavors of ruby- port (not rubygem-)
# USE_RUBYGEMS - Do not use this -- instead USES=gem
#
# [variables that each port should not (re)define]
@@ -121,7 +122,27 @@
RUBY_DEFAULT_VER?= ${RUBY_DEFAULT}
+.if empty(FLAVOR)
RUBY_VER?= ${RUBY_DEFAULT_VER}
+.else
+RUBY_VER= ${FLAVOR:S/^ruby//:C/(.)/\1.\2/}
+.endif
+
+_VALID_RUBY_VERSIONS= 2.2 2.3 2.4
+
+# cheat and force gems to use flavors
+.if ${USES:Mgem}
+USE_RUBY_FLAVORS= yes
+.endif
+
+.if defined(USE_RUBY_FLAVORS)
+FLAVORS= ${RUBY_DEFAULT_VER:S/.//:S/^/ruby/}
+.for _VALID_RUBY_VERSION in ${_VALID_RUBY_VERSIONS}
+.if !${_VALID_RUBY_VERSION:M${RUBY_DEFAULT_VER}}
+FLAVORS+= ${_VALID_RUBY_VERSION:S/.//:S/^/ruby/}
+.endif
+.endfor
+.endif
.if defined(RUBY)
.if !exists(${RUBY})
Index: devel/ruby-gems/Makefile
===================================================================
--- devel/ruby-gems/Makefile
+++ devel/ruby-gems/Makefile
@@ -24,6 +24,7 @@
NO_ARCH= yes
NO_BUILD= yes
USE_RUBY= yes
+USE_RUBY_FLAVORS= yes
RUBY_SETUP= setup.rb
USES= tar:tgz
@@ -57,9 +58,19 @@
DOCS_VARS_OFF= RUBY_SETUP_OPTIONS="--destdir=${STAGEDIR} --no-ri --no-rdoc"
DOCS_VARS= RUBY_SETUP_OPTIONS="--destdir=${STAGEDIR}"
+.include <bsd.port.pre.mk>
+
+.if ${RUBY_VER} == ${RUBY_DEFAULT_VER}
+PLIST_SUB+= IF_DEFAULT=""
+.else
+PLIST_SUB+= IF_DEFAULT="@comment "
+.endif
+
do-install:
cd ${WRKSRC}/ && ${SETENV} ${GEMS_ENV} ${RUBY} ${RUBY_SETUP} ${RUBY_SETUP_OPTIONS}
+.if ${RUBY_VER} == ${RUBY_DEFAULT_VER}
${LN} -sf gem${RUBY_VER_SHORT} ${STAGEDIR}${PREFIX}/bin/gem
+.endif
#
# Find all RDOC and RI files
@@ -67,4 +78,4 @@
post-install-DOCS-on:
cd ${STAGEDIR}${PREFIX}/ && ${FIND} -ds ${GEMS_DOC_DIR}/ ! -type d >> ${TMPPLIST}
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Index: devel/ruby-gems/pkg-plist
===================================================================
--- devel/ruby-gems/pkg-plist
+++ devel/ruby-gems/pkg-plist
@@ -1,4 +1,4 @@
-bin/gem
+%%IF_DEFAULT%%bin/gem
bin/gem%%RUBY_VER_SHORT%%
%%RUBY_SITELIBDIR%%/rubygems.rb
%%RUBY_SITELIBDIR%%/rubygems/available_set.rb

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 22, 9:59 AM (8 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35360294
Default Alt Text
D13333.id36091.diff (2 KB)

Event Timeline