summaryrefslogtreecommitdiff
blob: ebeaeb7aa5ac4ba20a85e98d9dafe9cb5718a6ac (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-gnome2.eclass,v 1.17 2010/04/03 11:53:34 graaff Exp $
#
# DEPRECATION NOTICE
# This eclass is deprecated because it does not properly handle
# multiple ruby targets. Please use ruby-ng-gnome2.eclass instead.
#
# This eclass simplifies installation of the various pieces of
# ruby-gnome2 since they share a very common installation procedure.
# It's possible that this could provide a foundation for a generalized
# ruby-module.eclass, but at the moment it contains some things
# specific to ruby-gnome2

# Variables:
# PATCHES	Space delimited list of patch files.

inherit multilib

EXPORT_FUNCTIONS src_compile src_install src_unpack

IUSE=""

subbinding=${PN#ruby-} ; subbinding=${subbinding%2}
S=${WORKDIR}/ruby-gnome2-all-${PV}/${subbinding}
SRC_URI="mirror://sourceforge/ruby-gnome2/ruby-gnome2-all-${PV}.tar.gz"
HOMEPAGE="http://ruby-gnome2.sourceforge.jp/"
LICENSE="Ruby"
SLOT="0"

# This eclass can currently only deal with a single ruby version, see
# bug 278012. Since the code is know to work with Ruby 1.8 we
# hard-code it to that version for now.

DEPEND="=dev-lang/ruby-1.8*"
RDEPEND="${DEPEND}"
USE_RUBY="ruby18"
RUBY=/usr/bin/ruby18

ruby-gnome2_src_unpack() {
	if [ ! -x /bin/install -a -x /usr/bin/install ]; then
		cat <<END >"${T}"/mkmf.rb
require 'mkmf'

STDERR.puts 'patching mkmf'
CONFIG['INSTALL'] = '/usr/bin/install'
END
		# save it because rubygems needs it (for unsetting RUBYOPT)
		export GENTOO_RUBYOPT="-r${T}/mkmf.rb"
		export RUBYOPT="${RUBYOPT} ${GENTOO_RUBYOPT}"
	fi

	unpack ${A}
	cd "${S}"
	# apply bulk patches
	if [[ ${#PATCHES[@]} -gt 1 ]]; then
		for x in "${PATCHES[@]}"; do
			epatch "${x}"
		done
	else
		for x in ${PATCHES}; do
			epatch "${x}"
		done
	fi
}

ruby-gnome2_src_compile() {
	${RUBY} extconf.rb || die "extconf.rb failed"
	emake CC=${CC:-gcc} CXX=${CXX:-g++} || die "emake failed"
}

ruby-gnome2_src_install() {
	# Create the directories, or the package will create them as files.
	dodir $(${RUBY} -r rbconfig -e 'print Config::CONFIG["sitearchdir"]') /usr/$(get_libdir)/pkgconfig

	make DESTDIR="${D}" install || die "make install failed"
	for doc in ../AUTHORS ../NEWS ChangeLog README; do
		[ -s "$doc" ] && dodoc $doc
	done
	if [[ -d sample ]]; then
		dodir /usr/share/doc/${PF}
		cp -a sample "${D}"/usr/share/doc/${PF} || die "cp failed"
	fi
}