summaryrefslogtreecommitdiff
blob: 2bfbcc52ddada169763ce14bce7c11fd43bef396 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# 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.4 2003/09/21 21:13:45 usata Exp $
#
# Author: Mamoru KOMACHI <usata@gentoo.org>
#
# The ruby eclass is designed to allow easier installation of ruby
# softwares, and their incorporation into the Gentoo Linux system.

ECLASS=ruby
INHERITED="${INHERITED} ${ECLASS}"
EXPORT_FUNCTIONS src_compile src_install

HOMEPAGE="http://raa.ruby-lang.org/list.rhtml?name=${PN}"
SRC_URI="mirror://gentoo/${P}.tar.gz"

SLOT="0"
LICENSE="Ruby"

newdepend ">=dev-lang/ruby-1.6.8"

ruby_src_compile() {
	if [ -f extconf.rb ] ; then
		ruby extconf.rb || die "extconf.rb failed"
		emake || die "make failed"
	elif [ -f install.rb ] ; then
		ruby install.rb config --prefix=/usr \
			|| die "install.rb config failed"
		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
		emake || die "emake failed"
	fi
}

ruby_src_install() {
	local siteruby rdbase=/usr/share/doc/${PF}/rd

	if [ -f install.rb ] ; then
		ruby install.rb config --prefix=${D}/usr \
			|| die "install.rb config failed"
		ruby install.rb install \
			|| die "install.rb install failed"
	elif [ -f extconf.rb -o -f Makefile ] ; then
		einstall DESTDIR=${D} || die "einstall failed"
	else
		siteruby=$(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]')
		insinto ${siteruby}/${PN}
		doins *.rb || "doins failed"
	fi

	insinto ${rdbase}
	find . -name '*.rd*' | xargs doins
	rmdir --ignore-fail-on-non-empty ${D}${rdbase}
	if [ -d doc -o -d docs -o examples ] ; then
		dohtml -r doc/* docs/* examples/*
	else
		dohtml -r *
	fi
	if [ -d sample ] ; then
		dodir /usr/share/doc/${PF}
		cp -a sample ${D}/usr/share/doc/${PF} || "cp failed"
	fi
	dodoc ChangeLog* [A-Z][A-Z]*
}