summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMamoru Komachi <usata@gentoo.org>2003-10-12 17:35:00 +0000
committerMamoru Komachi <usata@gentoo.org>2003-10-12 17:35:00 +0000
commit0ba54c0ab8fc5fbb1b93b71baf453c31c054ddaa (patch)
tree676b8249aaa13c56ac2d249c06c2c436c02e47b3 /eclass
parent Version bumped. (diff)
downloadgentoo-2-0ba54c0ab8fc5fbb1b93b71baf453c31c054ddaa.tar.gz
gentoo-2-0ba54c0ab8fc5fbb1b93b71baf453c31c054ddaa.tar.bz2
gentoo-2-0ba54c0ab8fc5fbb1b93b71baf453c31c054ddaa.zip
Added SLOT support.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ruby.eclass117
1 files changed, 96 insertions, 21 deletions
diff --git a/eclass/ruby.eclass b/eclass/ruby.eclass
index 545d50622482..502fce8feb6f 100644
--- a/eclass/ruby.eclass
+++ b/eclass/ruby.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby.eclass,v 1.5 2003/10/11 18:11:41 usata Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby.eclass,v 1.6 2003/10/12 17:35:00 usata Exp $
#
# Author: Mamoru KOMACHI <usata@gentoo.org>
#
@@ -9,7 +9,8 @@
ECLASS=ruby
INHERITED="${INHERITED} ${ECLASS}"
-EXPORT_FUNCTIONS src_compile src_install
+EXPORT_FUNCTIONS erubyconf erubymake erubyinstall \
+ src_unpack src_compile src_install
HOMEPAGE="http://raa.ruby-lang.org/list.rhtml?name=${PN}"
SRC_URI="mirror://gentoo/${P}.tar.gz"
@@ -18,51 +19,125 @@ SLOT="0"
LICENSE="Ruby"
newdepend ">=dev-lang/ruby-1.6.8"
-if [ -n "${WANT_RUBY_1_6}" ] ; then
+if [ "${WANT_RUBY_1_6}" ] ; then
alias ruby=ruby16
-elif [ -n "${WANT_RUBY_1_8}" ] ; then
+elif [ "${WANT_RUBY_1_8}" ] ; then
alias ruby=ruby18
fi
+if has_version '=dev-lang/ruby-1.6*' ; then
+ USE_RUBY_1_6=1
+fi
+if has_version '=dev-lang/ruby-1.8*' ; then
+ USE_RUBY_1_8=1
+fi
+
+ruby_src_unpack() {
+ if [ "${USE_RUBY_1_6}" -a "${USE_RUBY_1_8}" ] && \
+ [ ! "${WANT_RUBY_1_6}" -a ! "${WANT_RUBY_1_8}" ] ; then
+ mkdir -p ${S}/{1.6,1.8}
+ cd ${S}/1.6; unpack ${A}; cd -
+ cd ${S}/1.8; unpack ${A}; cd -
+ else
+ unpack ${A}
+ fi
+}
+
+erubyconf() {
+ local RUBY
+ if [ "$1" = ruby16 ] ; then
+ RUBY=ruby16
+ elif [ "$1" = ruby18 ] ; then
+ RUBY=ruby18
+ else
+ RUBY=ruby
+ fi
-ruby_src_compile() {
if [ -f extconf.rb ] ; then
- ruby extconf.rb || die "extconf.rb failed"
- emake || die "make failed"
+ ${RUBY} extconf.rb || die "extconf.rb failed"
elif [ -f install.rb ] ; then
- ruby install.rb config --prefix=/usr \
+ ${RUBY} install.rb config --prefix=/usr \
|| die "install.rb config failed"
- ruby install.rb setup \
+ ${RUBY} install.rb setup \
|| die "install.rb setup failed"
elif [ -f configure ] ; then
- econf || die "econf failed"
- emake || die "emake failed"
- elif [ -f Makefile ] ; then
+ econf --with-ruby=${RUBY} || die "econf failed"
+ fi
+}
+
+erubymake() {
+ if [ -f Makefile ] ; then
emake || die "emake failed"
fi
}
-ruby_src_install() {
- local siteruby rdbase=/usr/share/doc/${PF}/rd
+ruby_src_compile() {
+
+ if [ "${USE_RUBY_1_6}" -a "${USE_RUBY_1_8}" ] && \
+ [ ! "${WANT_RUBY_1_6}" -a ! "${WANT_RUBY_1_8}" ] ; then
+ einfo "src_compiling for ruby 1.6 ;)"
+ cd 1.6/${S#${WORKDIR}}
+ erubyconf ruby16 || die
+ erubymake || die
+ cd -
+ einfo "src_compiling for ruby 1.8 ;)"
+ cd 1.8/${S#${WORKDIR}}
+ erubyconf ruby18 || die
+ erubymake || die
+ cd -
+ else
+ einfo "src_compiling ;)"
+ erubyconf || die
+ erubymake || die
+ fi
+}
+
+erubyinstall() {
+ local RUBY
+ if [ "$1" = ruby16 ] ; then
+ RUBY=ruby16
+ elif [ "$1" = ruby18 ] ; then
+ RUBY=ruby18
+ else
+ RUBY=ruby
+ fi
if [ -f install.rb ] ; then
- ruby install.rb config --prefix=${D}/usr \
+ ${RUBY} install.rb config --prefix=${D}/usr \
|| die "install.rb config failed"
- ruby install.rb install \
+ ${RUBY} install.rb install \
|| die "install.rb install failed"
elif [ -f extconf.rb -o -f Makefile ] ; then
einstall DESTDIR=${D} || die "einstall failed"
else
- if [ -n "${WANT_RUBY_1_6}" ] ; then
- siteruby=$(ruby16 -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
- elif [ -n "${WANT_RUBY_1_8}" ]; then
- siteruby=$(ruby18 -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
+ if [ "${WANT_RUBY_1_6}" -o "${WANT_RUBY_1_8}" ] ; then
+ siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
else
- siteruby=$(ruby -r rbconfig -e 'print Config::CONFIG["sitedir"]')
+ siteruby=$(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitedir"]')
fi
insinto ${siteruby}
doins *.rb || "doins failed"
fi
+}
+
+ruby_src_install() {
+ local siteruby rdbase=/usr/share/doc/${PF}/rd
+
+ if [ "${USE_RUBY_1_6}" -a "${USE_RUBY_1_8}" ] && \
+ [ ! "${WANT_RUBY_1_6}" -a ! "${WANT_RUBY_1_8}" ] ; then
+ einfo "src_installing for ruby 1.6 ;)"
+ cd ${S}/1.6/${S#${WORKDIR}}
+ erubyinstall ruby16
+ cd -
+ einfo "src_installing for ruby 1.8 ;)"
+ cd ${S}/1.8/${S#${WORKDIR}}
+ erubyinstall ruby18
+ #cd -
+ else
+ einfo "src_installing ;)"
+ erubyinstall
+ fi
+ einfo "dodoc'ing ;)"
insinto ${rdbase}
find . -name '*.rd*' | xargs doins
rmdir --ignore-fail-on-non-empty ${D}${rdbase}