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