| 1 |
# Copyright 1999-2005 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/gems.eclass,v 1.11 2006/12/30 16:40:11 pclouds Exp $ |
| 4 |
# |
| 5 |
# Author: Rob Cakebread <pythonhead@gentoo.org> |
| 6 |
# Current Maintainer: Ruby Herd <ruby@gentoo.org> |
| 7 |
# |
| 8 |
# The gems eclass is designed to allow easier installation of |
| 9 |
# gems-based ruby packagess and their incorporation into |
| 10 |
# the Gentoo Linux system. |
| 11 |
# |
| 12 |
# - Features: |
| 13 |
# gems_location() - Set ${GEMSDIR} with gem install dir and ${GEM_SRC} with path to gem to install |
| 14 |
# gems_src_install() - installs a gem into ${D} |
| 15 |
# gems_src_unpack() - Does nothing. |
| 16 |
# gems_src_compile() - Does nothing. |
| 17 |
# |
| 18 |
# NOTE: |
| 19 |
# See http://dev.gentoo.org/~pythonhead/ruby/gems.html for notes on using gems with portage |
| 20 |
|
| 21 |
|
| 22 |
inherit ruby eutils |
| 23 |
|
| 24 |
|
| 25 |
DEPEND=">=dev-ruby/rubygems-0.8.4-r1 |
| 26 |
!dev-ruby/rdoc" |
| 27 |
|
| 28 |
S=${WORKDIR} |
| 29 |
|
| 30 |
IUSE="doc" |
| 31 |
|
| 32 |
gems_location() { |
| 33 |
local sitelibdir |
| 34 |
sitelibdir=`ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]'` |
| 35 |
export GEMSDIR=${sitelibdir/site_ruby/gems} |
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
gems_src_unpack() { |
| 40 |
true |
| 41 |
} |
| 42 |
|
| 43 |
gems_src_install() { |
| 44 |
gems_location |
| 45 |
|
| 46 |
if [ -z "${MY_P}" ]; then |
| 47 |
GEM_SRC=${DISTDIR}/${P} |
| 48 |
spec_path=${D}/${GEMSDIR}/specifications/${P}.gemspec |
| 49 |
else |
| 50 |
GEM_SRC=${DISTDIR}/${MY_P} |
| 51 |
spec_path=${D}/${GEMSDIR}/specifications/${MY_P}.gemspec |
| 52 |
fi |
| 53 |
|
| 54 |
if use doc; then |
| 55 |
myconf="--rdoc" |
| 56 |
else |
| 57 |
myconf="--no-rdoc" |
| 58 |
fi |
| 59 |
|
| 60 |
# RI documentation installation: bug #145222 |
| 61 |
if gem --version|grep -q ^0.9; then |
| 62 |
if use doc; then |
| 63 |
myconf="--ri ${myconf}" |
| 64 |
else |
| 65 |
myconf="--no-ri ${myconf}" |
| 66 |
fi |
| 67 |
fi |
| 68 |
|
| 69 |
|
| 70 |
dodir ${GEMSDIR} |
| 71 |
gem install ${GEM_SRC} -v ${PV} ${myconf} -l -i ${D}/${GEMSDIR} || die "gem install failed" |
| 72 |
|
| 73 |
# This is a workaround for <=rubygems-0.9.0.8 because it's exitstatus equals 0 |
| 74 |
# even if the dependencies are not found. So we are testing if rubygems at |
| 75 |
# least installed the gemspec (which should always occur otherwise). |
| 76 |
# See bug #104733 |
| 77 |
test -f ${spec_path} || die "gem install failed" |
| 78 |
|
| 79 |
if [ -d ${D}/${GEMSDIR}/bin ] ; then |
| 80 |
exeinto /usr/bin |
| 81 |
for exe in ${D}/${GEMSDIR}/bin/* ; do |
| 82 |
doexe ${exe} |
| 83 |
done |
| 84 |
fi |
| 85 |
} |
| 86 |
|
| 87 |
gems_src_compile() { |
| 88 |
true |
| 89 |
} |
| 90 |
|
| 91 |
EXPORT_FUNCTIONS src_unpack src_compile src_install |