| 1 |
pythonhead |
1.1 |
# Copyright 1999-2005 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
graaff |
1.23 |
# $Header: /var/cvsroot/gentoo-x86/eclass/gems.eclass,v 1.22 2008/11/14 11:59:14 graaff Exp $ |
| 4 |
pythonhead |
1.1 |
# |
| 5 |
|
|
# Author: Rob Cakebread <pythonhead@gentoo.org> |
| 6 |
caleb |
1.9 |
# Current Maintainer: Ruby Herd <ruby@gentoo.org> |
| 7 |
pythonhead |
1.1 |
# |
| 8 |
|
|
# The gems eclass is designed to allow easier installation of |
| 9 |
swegener |
1.6 |
# gems-based ruby packagess and their incorporation into |
| 10 |
pythonhead |
1.1 |
# the Gentoo Linux system. |
| 11 |
|
|
# |
| 12 |
|
|
# - Features: |
| 13 |
flameeyes |
1.14 |
# gems_location() - Set ${GEMSDIR} with gem install dir and ${GEM_SRC} with path to gem to install |
| 14 |
|
|
# gems_src_unpack() - Does nothing. |
| 15 |
pythonhead |
1.2 |
# gems_src_compile() - Does nothing. |
| 16 |
nichoj |
1.20 |
# gems_src_install() - installs a gem into ${D} |
| 17 |
pythonhead |
1.2 |
# |
| 18 |
|
|
# NOTE: |
| 19 |
|
|
# See http://dev.gentoo.org/~pythonhead/ruby/gems.html for notes on using gems with portage |
| 20 |
pythonhead |
1.1 |
|
| 21 |
|
|
|
| 22 |
nichoj |
1.20 |
inherit eutils ruby |
| 23 |
pythonhead |
1.1 |
|
| 24 |
nichoj |
1.18 |
SRC_URI="http://gems.rubyforge.org/gems/${P}.gem" |
| 25 |
|
|
|
| 26 |
|
|
IUSE="doc" |
| 27 |
pythonhead |
1.1 |
|
| 28 |
rbrown |
1.21 |
DEPEND=" |
| 29 |
|
|
>=dev-ruby/rubygems-0.9.4 |
| 30 |
|
|
!dev-ruby/rdoc |
| 31 |
|
|
" |
| 32 |
|
|
RDEPEND="${DEPEND}" |
| 33 |
pythonhead |
1.1 |
|
| 34 |
|
|
gems_location() { |
| 35 |
|
|
local sitelibdir |
| 36 |
nichoj |
1.20 |
sitelibdir=$(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]') |
| 37 |
pythonhead |
1.1 |
export GEMSDIR=${sitelibdir/site_ruby/gems} |
| 38 |
pythonhead |
1.2 |
|
| 39 |
pythonhead |
1.1 |
} |
| 40 |
|
|
|
| 41 |
|
|
gems_src_unpack() { |
| 42 |
nichoj |
1.20 |
true |
| 43 |
|
|
} |
| 44 |
|
|
|
| 45 |
|
|
gems_src_compile() { |
| 46 |
pythonhead |
1.1 |
true |
| 47 |
|
|
} |
| 48 |
|
|
|
| 49 |
|
|
gems_src_install() { |
| 50 |
|
|
gems_location |
| 51 |
pythonhead |
1.2 |
|
| 52 |
nichoj |
1.20 |
if [[ -z "${MY_P}" ]]; then |
| 53 |
|
|
[[ -z "${GEM_SRC}" ]] && GEM_SRC="${DISTDIR}/${P}" |
| 54 |
|
|
spec_path="${D}/${GEMSDIR}/specifications/${P}.gemspec" |
| 55 |
pythonhead |
1.2 |
else |
| 56 |
nichoj |
1.20 |
[[ -z "${GEM_SRC}" ]] && GEM_SRC="${DISTDIR}/${MY_P}" |
| 57 |
|
|
spec_path="${D}/${GEMSDIR}/specifications/${MY_P}.gemspec" |
| 58 |
pythonhead |
1.2 |
fi |
| 59 |
|
|
|
| 60 |
nichoj |
1.20 |
local myconf |
| 61 |
caleb |
1.8 |
if use doc; then |
| 62 |
nichoj |
1.20 |
myconf="--rdoc --ri" |
| 63 |
caleb |
1.8 |
else |
| 64 |
nichoj |
1.20 |
myconf="--no-rdoc --no-ri" |
| 65 |
pclouds |
1.12 |
fi |
| 66 |
|
|
|
| 67 |
pythonhead |
1.1 |
dodir ${GEMSDIR} |
| 68 |
graaff |
1.22 |
|
| 69 |
graaff |
1.23 |
local gte13=$(${RUBY} -rubygems -e 'puts Gem::RubyGemsVersion >= "1.3.0"') |
| 70 |
|
|
|
| 71 |
|
|
if [[ "${gte13}" == "true" ]] ; then |
| 72 |
graaff |
1.22 |
gem install ${GEM_SRC} --version ${PV} ${myconf} \ |
| 73 |
|
|
--local --install-dir "${D}/${GEMSDIR}" --sandbox-fix \ |
| 74 |
|
|
|| die "gem (>=1.3.0) install failed" |
| 75 |
|
|
else |
| 76 |
|
|
gem install ${GEM_SRC} --version ${PV} ${myconf} \ |
| 77 |
|
|
--local --install-dir "${D}/${GEMSDIR}" || die "gem (<1.3.0) install failed" |
| 78 |
|
|
fi |
| 79 |
swegener |
1.6 |
|
| 80 |
nichoj |
1.20 |
if [[ -d "${D}/${GEMSDIR}/bin" ]] ; then |
| 81 |
pythonhead |
1.1 |
exeinto /usr/bin |
| 82 |
|
|
for exe in ${D}/${GEMSDIR}/bin/* ; do |
| 83 |
|
|
doexe ${exe} |
| 84 |
|
|
done |
| 85 |
|
|
fi |
| 86 |
|
|
} |
| 87 |
|
|
|
| 88 |
pythonhead |
1.2 |
EXPORT_FUNCTIONS src_unpack src_compile src_install |