summaryrefslogtreecommitdiff
blob: 960a06035838b6c4ad2298cf7fac6e63445a9681 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-util/libconf/libconf-0.42.10-r2.ebuild,v 1.3 2009/12/09 18:30:15 scarabeus Exp $

inherit eutils multilib toolchain-funcs

MY_P=perl-Libconf-${PV}

DESCRIPTION="Centralized abstraction layer for system configuration files"
HOMEPAGE="http://damien.krotkine.com/libconf/"
SRC_URI="http://damien.krotkine.com/libconf/dist/${MY_P}.tar.bz2"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"

IUSE="python ruby"
DEPEND="dev-lang/perl
	dev-perl/DelimMatch
	dev-perl/XML-Twig
	python? ( >=dev-lang/python-2.4.2 )
	ruby? ( >=dev-lang/ruby-1.8.3 )"

S=${WORKDIR}/${MY_P}

bindings() {
	local mybindings
	mybindings="bash"
	use python && mybindings="${mybindings} python"
	# ruby bindings require c bindings - bug #117061
	use ruby && mybindings="${mybindings} c ruby"
	echo ${mybindings}
}

src_unpack() {
	unpack ${A}
	cd "${S}"

	[[ ${USERLAND} == *BSD ]] && epatch "${FILESDIR}/${PV}-fbsd.patch"
	epatch "${FILESDIR}/${PV}-perl5.10.patch"

	# Multilib fix
	sed -i \
		-e "/^LIB_DIR/ { s:lib:$(get_libdir): }" \
		-e 's/^CF=-Wall/CF=$(CFLAGS)/' \
		bindings/c/src/Makefile || die "sed failed"

	sed -i \
		-e 's/        /\t/' \
		perl-Libconf/Makefile || die "sed failed"

	sed -i \
		-e '/^MAKE =/d' \
		Makefile perl-Libconf/Makefile || die "sed failed"
}
src_compile() {
	emake \
		BINDINGS="$(bindings)" \
		CC=$(tc-getCC) \
		|| die "make failed"
}

src_install() {
	emake \
		BINDINGS="$(bindings)" \
		PREFIX="${D}/usr" DESTDIR="${D}" ROOT="${D}" \
		CPA="cp -pR" install || die "emake install failed"
	dodoc AUTHORS ChangeLog || die
	use python && { newdoc bindings/ruby/src/AUTHORS AUTHORS.python || die ; }
}