summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authortaca <taca>2004-11-27 13:57:20 +0000
committertaca <taca>2004-11-27 13:57:20 +0000
commita68408ce69dfde860693cf808ec596eb7874f031 (patch)
treee6bbcf0368943306532453acfc6edaecdd56e7eb /lang
parent2c7865a2b694599a32f7945a8db701f8c1a90652 (diff)
downloadpkgsrc-a68408ce69dfde860693cf808ec596eb7874f031.tar.gz
Importing files for Ruby's new framework.
Diffstat (limited to 'lang')
-rw-r--r--lang/ruby/Makefile.common67
-rw-r--r--lang/ruby/buildlink3.mk74
-rw-r--r--lang/ruby/modules.mk142
-rw-r--r--lang/ruby/replace.mk63
-rw-r--r--lang/ruby/rubyversion.mk142
5 files changed, 488 insertions, 0 deletions
diff --git a/lang/ruby/Makefile.common b/lang/ruby/Makefile.common
new file mode 100644
index 00000000000..19221aecd7c
--- /dev/null
+++ b/lang/ruby/Makefile.common
@@ -0,0 +1,67 @@
+# $NetBSD: Makefile.common,v 1.1.1.1 2004/11/27 13:57:20 taca Exp $
+#
+# Ruby base distribution common definition
+
+#
+# Ruby distribution sites.
+#
+MASTER_SITE_RUBY?= \
+ ftp://ftp.ruby-lang.org/pub/ruby/${RUBY_VER}/ \
+ ftp://www.ibiblio.org/pub/languages/ruby/${RUBY_VER}/ \
+ ftp://xyz.lcs.mit.edu/pub/ruby/${RUBY_VER}/ \
+ ftp://gd.tuwien.ac.at/languages/ruby/${RUBY_VER}/ \
+ ftp://ftp.fu-berlin.de/unix/languages/ruby/${RUBY_VER}/ \
+ ftp://ftp.easynet.be/ruby/ruby/${RUBY_VER}/ \
+ ftp://ftp.ntua.gr/pub/lang/ruby/${RUBY_VER}/ \
+ ftp://sunsite.dk/mirrors/ruby/${RUBY_VER}/ \
+ ftp://ruby.cdpa.nsysu.edu.tw/ruby/${RUBY_VER}/ \
+ ftp://ftp.chg.ru/pub/lang/ruby/${RUBY_VER}/ \
+ ftp://ftp.ring.gr.jp/pub/lang/ruby/${RUBY_VER}/ \
+ ftp://ftp.iij.ad.jp/pub/lang/ruby/${RUBY_VER}/ \
+ ftp://ftp.idaemons.org/pub/mirror/ftp.ruby-lang.org/ruby/${RUBY_VER}/
+
+# Ruby distribution
+RUBY_DISTINFO_FILE= ${.CURDIR}/../../lang/ruby${RUBY_VER}/distinfo
+
+RUBY_HOMEPAGE= http://www.ruby-lang.org/en/
+
+# common default
+RUBY_DISTNAME?= ruby-${RUBY_VERSION}
+RUBY_WRKSRC?= ${WRKDIR}/${RUBY_DISTNAME}
+DIST_SUBDIR?= ruby
+STRIP?= strip
+DIST_SUBDIR?= ${RUBY_DIST_SUBDIR}
+
+#
+# Ruby shared library version handling.
+#
+RUBY_SHLIBMAJOR?= ${_RUBY_VER_MAJOR}
+RUBY_SHLIBVER?= ${RUBY_VERSION}
+
+.if ${OPSYS} == "NetBSD"
+RUBY_SHLIBMAJOR= ${RUBY_VER}
+RUBY_SHLIBVER= ${RUBY_VER}.${_RUBY_VERS_TEENY}
+.elif ${OPSYS} == "FreeBSD"
+RUBY_SHLIBMAJOR= # unused
+RUBY_SHLIBVER= ${_RUBY_VERS_TEENY}
+.elif ${OPSYS} == "IRIX"
+RUBY_SHLIBMAJOR= # unused
+.elif ${OPSYS} == "Linux"
+RUBY_SHLIBMAJOR= ${_RUBY_VER_MAJOR}.${_RUBY_VER_MINOR}
+.endif
+
+.if empty(RUBY_SHLIBMAJOR)
+RUBY_NOSHLIBMAJOR= "@comment "
+.else
+RUBY_NOSHLIBMAJOR=
+.endif
+
+#
+# PLIST substitution
+#
+PLIST_SUBST+= RUBY_SHLIBVER="${RUBY_SHLIBVER}" \
+ RUBY_SHLIBMAJOR="${RUBY_SHLIBMAJOR}" \
+ RUBY_NOSHLIBMAJOR=${RUBY_NOSHLIBMAJOR} \
+ RUBY_NAME="${RUBY_NAME}"
+
+.include "replace.mk"
diff --git a/lang/ruby/buildlink3.mk b/lang/ruby/buildlink3.mk
new file mode 100644
index 00000000000..eaab74033ac
--- /dev/null
+++ b/lang/ruby/buildlink3.mk
@@ -0,0 +1,74 @@
+# $NetBSD: buildlink3.mk,v 1.1.1.1 2004/11/27 13:57:21 taca Exp $
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
+RUBY_BASE_BUILDLINK3_MK:= ${RUBY_BASE_BUILDLINK3_MK}+
+
+.include "../../lang/ruby/rubyversion.mk"
+
+RUBY_MD_LIBDIR= ${RUBY_ARCH}
+
+.if !empty(BUILDLINK_DEPTH:M+)
+BUILDLINK_DEPENDS+= ${RUBY_NAME}
+.endif
+
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nruby}
+BUILDLINK_PACKAGES+= ${RUBY_NAME}
+
+.if !empty(RUBY_BASE_BUILDLINK3_MK:M+)
+.if ${RUBY_VER} == "16"
+RUBYSRCDIR= ../../lang/ruby16
+BUILDLINK_DEPENDS.ruby16?= ruby16>=1.6.8
+BUILDLINK_PKGSRCDIR.ruby16?= ${RUBYSRCDIR}
+EVAL_PREFIX+= BUILDLINK_PREFIX.ruby16=ruby16
+BUILDLINK_PREFIX.ruby16_DEFAULT= ${LOCALBASE}
+BUILDLINK_FILES.ruby16= lib/libruby${RUBY_VER}.*
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/config.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/defines.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/dln.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/env.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/intern.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/libruby${RUBY_VER}.a
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/node.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/rbconfig.rb
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/re.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/regex.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/ruby.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/rubyio.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/rubysig.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/st.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/util.h
+BUILDLINK_FILES.ruby16+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/version.h
+.elif ${RUBY_VER} == "18"
+RUBYSRCDIR= ../../lang/ruby18
+BUILDLINK_DEPENDS.ruby18?= ruby18>=1.8.1
+BUILDLINK_PKGSRCDIR.ruby18?= ${RUBYSRCDIR}
+EVAL_PREFIX+= BUILDLINK_PREFIX.ruby18=ruby18
+BUILDLINK_FILES.ruby18= lib/libruby${RUBY_VER}.*
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/config.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/defines.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/dl.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/dlconfig.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/dln.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/env.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/intern.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/libruby${RUBY_VER}.a
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/missing.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/node.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/rbconfig.rb
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/re.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/regex.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/ruby.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/rubyio.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/rubysig.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/st.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/util.h
+BUILDLINK_FILES.ruby18+= lib/ruby/${RUBY_VER_DIR}/${RUBY_MD_LIBDIR}/version.h
+.endif
+
+BUILDLINK_PREFIX.ruby-base_DEFAULT= ${LOCALBASE}
+
+.endif # RUBY_BASE_BUILDLINK3_MK
+
+.include "../../devel/ncurses/buildlink3.mk"
+
+BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff --git a/lang/ruby/modules.mk b/lang/ruby/modules.mk
new file mode 100644
index 00000000000..e3155dad115
--- /dev/null
+++ b/lang/ruby/modules.mk
@@ -0,0 +1,142 @@
+# $NetBSD: modules.mk,v 1.1.1.1 2004/11/27 13:57:21 taca Exp $
+
+.if !defined(_RUBY_MODULE_MK)
+_RUBY_MODULE_MK= # defined
+
+.include "../../lang/ruby/rubyversion.mk"
+.if empty(USE_BUILDLINK3:M[nN][oO])
+.include "../../lang/ruby/buildlink3.mk"
+.elif !empty(RUBY_NOVERSION:M[nN][oO])
+DEPENDS+= ruby${RUBY_VER}>=${RUBY_REQD}:../../lang/ruby${RUBY_VER}
+.endif
+
+CONFIGURE_ENV+= RUBY=${RUBY} RDOC=${RDOC}
+
+#
+# make ruby module package to common DIST_SUBDIR
+#
+DIST_SUBDIR?= ${RUBY_DIST_SUBDIR}
+
+#
+# extconf.rb support
+#
+# RUBY_EXTCONF specify extconf script name (default: extconf.rb).
+# RUBY_EXTCONF_CHECK make sure to check existence of Makefile after
+# executing extconf script (default: yes).
+# RUBY_EXTCONF_MAKEFILE name of Makefile checked by RUBY_EXTCONF_CHECK
+# (default: Makefile)
+#
+.if defined(USE_RUBY_EXTCONF) && empty(USE_RUBY_EXTCONF:M[nN][oO])
+
+RUBY_EXTCONF?= extconf.rb
+INSTALL_TARGET?= site-install
+CONFIGURE_ARGS+= --with-opt-dir="${LOCALBASE}"
+RUBY_EXTCONF_CHECK?= yes
+RUBY_EXTCONF_MAKEFILE?= Makefile
+
+do-configure: ruby-extconf-configure
+
+.if defined(RUBY_EXTCONF_SUBDIRS)
+ruby-extconf-configure:
+.for d in ${RUBY_EXTCONF_SUBDIRS}
+ @${ECHO_MSG} "===> Running ${RUBY_EXTCONF} in ${d} to configure"
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}/${d}; \
+ ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_EXTCONF} ${CONFIGURE_ARGS}
+.if empty(RUBY_EXTCONF_CHECK:M[nN][oO])
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}/${d}; \
+ ${TEST} -f ${RUBY_EXTCONF_MAKEFILE}
+.endif
+.endfor
+
+.if !target(do-build)
+do-build: ruby-extconf-build
+
+ruby-extconf-build:
+.for d in ${RUBY_EXTCONF_SUBDIRS}
+ @${ECHO_MSG} "===> Building ${d}"
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}/${d}; ${SETENV} ${MAKE_ENV} ${MAKE} ${ALL_TARGET}
+.endfor
+.endif
+
+.if !target(do-install)
+do-install: ruby-extconf-install
+
+ruby-extconf-install:
+.for d in ${RUBY_EXTCONF_SUBDIRS}
+ @${ECHO_MSG} "===> Installing ${d}"
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}/${d}; ${SETENV} ${MAKE_ENV} ${MAKE} ${INSTALL_TARGET}
+.endfor
+.endif
+
+.else
+ruby-extconf-configure:
+ @${ECHO_MSG} "===> Running ${RUBY_EXTCONF} to configure"
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}; \
+ ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_EXTCONF} ${CONFIGURE_ARGS}
+.if empty(RUBY_EXTCONF_CHECK:M[nN][oO])
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}/${d}; \
+ ${TEST} -f ${RUBY_EXTCONF_MAKEFILE}
+.endif
+.endif
+
+#
+# setup.rb support
+#
+# RUBY_SETUP specify setup script name (default: setup.rb).
+#
+.elif defined(USE_RUBY_SETUP) && empty(USE_RUBY_SETUP:M[nN][oO])
+
+RUBY_SETUP?= setup.rb
+
+.if !target(do-configure)
+do-configure: ruby-setup-configure
+
+ruby-setup-configure:
+ @${ECHO_MSG} "===> Running ${RUBY_SETUP} to configure"
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}; \
+ ${SETENV} ${CONFIGURE_ENV} ${RUBY} ${RUBY_SETUP} config ${CONFIGURE_ARGS}
+.endif
+
+.if !target(do-build)
+do-build: ruby-setup-build
+
+ruby-setup-build:
+ @${ECHO_MSG} "===> Running ${RUBY_SETUP} to build"
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}; \
+ ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_SETUP} setup
+.endif
+
+.if !target(do-install)
+do-install: ruby-setup-install
+
+ruby-setup-install:
+ @${ECHO_MSG} "===> Running ${RUBY_SETUP} to ${INSTALL_TARGET}"
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}; \
+ ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_SETUP} ${INSTALL_TARGET}
+.endif
+
+#
+# install.rb support
+#
+# USE_RUBY_INSTALL use simple install.rb script to install
+# (default: undefined)
+# RUBY_SIMPLE_INSTALL name of simple install.rb script (default: install.rb)
+#
+.elif defined(USE_RUBY_INSTALL) && empty(USE_RUBY_INSTALL:M[nN][oO])
+
+RUBY_SIMPLE_INSTALL?= install.rb
+INSTALL_TARGET?= # empty
+
+.if !target(do-install)
+do-install: ruby-simple-install
+
+ruby-simple-install:
+ @${ECHO_MSG} "===> Running ${RUBY_SIMPLE_INSTALL} to ${INSTALL_TARGET}"
+ ${_PKG_SILENT}${_PKG_DEBUG}cd ${WRKSRC}; \
+ ${SETENV} ${MAKE_ENV} ${RUBY} ${RUBY_SIMPLE_INSTALL} ${INSTALL_TARGET}
+.endif
+.endif # USE_RUBY_INSTALL
+
+.include "replace.mk"
+
+.endif
diff --git a/lang/ruby/replace.mk b/lang/ruby/replace.mk
new file mode 100644
index 00000000000..4ee9ae2168f
--- /dev/null
+++ b/lang/ruby/replace.mk
@@ -0,0 +1,63 @@
+# $NetBSD: replace.mk,v 1.1.1.1 2004/11/27 13:57:21 taca Exp $
+#
+
+.ifndef _RUBY_REPLACE_MK
+_RUBY_REPLACE_MK= # defined
+
+# fix shebang line.
+#
+# REPLACE_RUBY replace shebang line of specified files.
+# REPLACE_RUBY_DIRS replace shebang line of files under specified
+# directories.
+# REPLACE_FILE_PAT specify pattern to match target files under
+# REPLACE_RUBY_DIRS directories.
+#
+REPLACE_FILE_PAT?= *.rb
+
+.if defined(REPLACE_RUBY) || defined(REPLACE_RUBY_DIRS)
+pre-configure: replace-ruby-scripts replace-ruby-dirs
+
+.if defined(REPLACE_RUBY) && !empty(REPLACE_RUBY)
+replace-ruby-scripts:
+ ${_PKG_SILENT}${_PKG_DEBUG}for s in ${REPLACE_RUBY}; do \
+ case $${s} in \
+ /*) f=$${s};; \
+ *) f=${WRKSRC}/$${s};; \
+ esac; \
+ ${ECHO_MSG} "===> Fixing the #! line of $${s}"; \
+ ${SED} -e '1s| *[a-z0-9_/\.-][a-z0-9_/\.-]*/env *||g' \
+ -e '1s| *[a-z0-9_/\.-]*ruby|${RUBY}|' $$f > $$f.tmp; \
+ if ${CMP} -s $$f $$f.tmp; then \
+ ${RM} $$f.tmp; \
+ else \
+ ${MV} $$f.tmp $$f; \
+ fi; \
+ done
+.else
+replace-ruby-scripts:
+.endif
+
+.for f in ${REPLACE_FILE_PAT}
+_REPLACE_FILE_PAT+= -o -name "${f}"
+.endfor
+_REPLACE_FILE_FIND_ARGS=\( ${_REPLACE_FILE_PAT:S/-o//1} \)
+
+.if defined(REPLACE_RUBY_DIRS) && !empty(REPLACE_RUBY_DIRS)
+replace-ruby-dirs:
+ ${_PKG_SILENT}${_PKG_DEBUG}${FIND} ${REPLACE_RUBY_DIRS} \
+ -type f ${_REPLACE_FILE_FIND_ARGS} -print | \
+ while read f; do \
+ ${SED} -e '1s| *[a-z0-9_/\.-][a-z0-9_/\.-]*/env *||g' \
+ -e '1s| *[a-z0-9_/\.-]*ruby|${RUBY}|' $$f > $$f.tmp; \
+ if ${CMP} -s $$f $$f.tmp; then \
+ ${RM} $$f.tmp; \
+ else \
+ ${MV} $$f.tmp $$f; \
+ fi; \
+ done
+.else
+replace-ruby-dirs:
+.endif
+
+.endif # defined(REPLACE_RUBY) || defined(REPLACE_RUBY_DIRS)
+.endif # _RUBY_REPLACE_MK
diff --git a/lang/ruby/rubyversion.mk b/lang/ruby/rubyversion.mk
new file mode 100644
index 00000000000..aad900cfe69
--- /dev/null
+++ b/lang/ruby/rubyversion.mk
@@ -0,0 +1,142 @@
+# $NetBSD: rubyversion.mk,v 1.1.1.1 2004/11/27 13:57:21 taca Exp $
+#
+
+.ifndef _RUBYVERSION_MK
+_RUBYVERSION_MK= # defined
+
+.include "../../mk/bsd.prefs.mk"
+
+# current supported Ruby's version
+RUBY16_VERSION?= 1.6.8
+RUBY18_VERSION?= 1.8.1
+
+# default Ruby packages
+RUBY_VER_DEFAULT= 18
+
+# RUBY_VERSION_DEFAULT defines default version for Ruby related
+# packages and user can define in mk.conf. (1.6 or 1.8)
+#
+RUBY_VERSION_DEFAULT?= 1.8
+
+# RUBY_VERSION defines the specific Ruby's version which is supported
+# by the package. It should be defined by packages whose distfiles
+# are contained by Ruby's release distribution.
+#
+# Default value is set to ${RUBY_VERSION_DEFAULT}
+#
+.if !defined(RUBY_VERSION)
+.if ${RUBY_VERSION_DEFAULT} == "1.6"
+RUBY_REQD?= 1.6.8
+RUBY_VERSION?= ${RUBY16_VERSION}
+.elif ${RUBY_VERSION_DEFAULT} == "1.8"
+RUBY_REQD?= 1.8.1
+RUBY_VERSION?= ${RUBY18_VERSION}
+.endif
+.endif
+
+# RUBY_VERSION_SUPPORTED defines the list of ${RUBY_VER} which is
+# supported by the package. It should be defined by The pacakges
+# for specific version Ruby.
+#
+RUBY_VERSION_SUPPORTED?= 16 18
+
+# RUBY_NOVERSION should be set to "Yes" if the package dosen't depend on
+# any specific version of ruby command. In this case, package's
+# name begin with "ruby-".
+# If RUBY_NOVERSION is "No" (default), the package's name is begin
+# with ${RUBY_NAME}; "ruby16-", "ruby18" and so on.
+#
+# It also affects to RUBY_DOCDIR, RUBY_EXAMPLESDIR...
+#
+RUBY_NOVERSION?= No
+
+# _RUBY_VER_MAJOR, _RUBY_VER_MINOR, _RUBY_VERS_TEENY is defined from
+# version of Ruby. It could be used in packages' Makefile but
+# it isn't recommended.
+#
+_RUBY_VER_MAJOR= ${RUBY_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/}
+_RUBY_VER_MINOR= ${RUBY_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/}
+_RUBY_VERS_TEENY= ${RUBY_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\3/}
+
+# RUBY_VER defines Ruby base release.
+#
+RUBY_VER= ${_RUBY_VER_MAJOR}${_RUBY_VER_MINOR}
+
+# RUBY_SUFFIX is appended to Ruby's commands; ruby, irb and so on.
+#
+RUBY_SUFFIX?= ${RUBY_VER}
+
+# RUBY_NAME defines executable's name of Ruby itself.
+#
+RUBY_NAME?= ruby${RUBY_SUFFIX}
+
+# RUBY_PKGPREFIX is prefix part for ruby based packages.
+#
+RUBY_PKGPREFIX?= ${RUBY_NAME}
+
+# RUBY_VER_DIR is used as part of Ruby's library directories.
+#
+RUBY_VER_DIR?= ${_RUBY_VER_MAJOR}.${_RUBY_VER_MINOR}
+
+# Simple check for package availability with Ruby's version.
+#
+.if empty(RUBY_VERSION_SUPPORTED:M${RUBY_VER})
+PKG_FAIL_REASON+= "This package isn't supported by ${RUBY_NAME}."
+.endif
+
+# RUBY_NOVERSION specifies that package dosen't depends on any
+# version of Ruby.
+#
+.if empty(RUBY_NOVERSION:M[nN][oO])
+RUBY_SUFFIX=
+RUBY_NAME= ruby
+.endif
+
+# RUBY related command's full pathname.
+#
+RUBY?= ${LOCALBASE}/bin/${RUBY_NAME}
+RDOC?= ${LOCALBASE}/bin/rdoc${RUBY_VER}
+
+#
+# RUBY_ARCH is used architecture depended direcotry name.
+#
+.if ${OPSYS} != "Linux"
+RUBY_ARCH?= ${LOWER_ARCH}-${LOWER_OPSYS}${APPEND_ELF}${LOWER_OPSYS_VERSUFFIX}
+.else
+RUBY_ARCH?= ${LOWER_ARCH}-${LOWER_OPSYS}-gnu
+.endif
+
+#
+# common PATH
+#
+RUBY_LIBDIR?= ${LOCALBASE}/lib/ruby/${RUBY_VER_DIR}
+RUBY_ARCHLIBDIR?= ${RUBY_LIBDIR}/${RUBY_ARCH}
+RUBY_SITELIBDIR?= ${LOCALBASE}/lib/ruby/site_ruby/${RUBY_VER_DIR}
+RUBY_SITEARCHLIBDIR?= ${RUBY_SITELIBDIR}/${RUBY_ARCH}
+RUBY_DOCDIR?= ${LOCALBASE}/share/doc/${RUBY_NAME}
+RUBY_EXAMPLESDIR?= ${LOCALBASE}/share/examples/${RUBY_NAME}
+
+#
+# make ruby based packages' distfiles to one place.
+#
+RUBY_DIST_SUBDIR?= ruby
+
+#
+# MAKE_ENV
+#
+MAKEFLAGS+= RUBY_VER=${RUBY_VER}
+
+#
+# PLIST
+#
+PLIST_RUBY_DIRS= RUBY_LIBDIR="${RUBY_LIBDIR}" \
+ RUBY_ARCHLIBDIR="${RUBY_ARCHLIBDIR}" \
+ RUBY_SITELIBDIR="${RUBY_SITELIBDIR}" \
+ RUBY_SITEARCHLIBDIR="${RUBY_SITEARCHLIBDIR}" \
+ RUBY_DOCDIR="${RUBY_DOCDIR}" \
+ RUBY_EXAMPLESDIR="${RUBY_EXAMPLESDIR}"
+
+PLIST_SUBST+= RUBY_VER="${RUBY_VER}" \
+ ${PLIST_RUBY_DIRS:S,DIR="${LOCALBASE}/,DIR=",}
+
+.endif # _RUBY_MK