summaryrefslogtreecommitdiff
blob: 6344f9b24a60afcb2f6b6abf20baea8a0ade6e21 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-text/poppler-bindings/poppler-bindings-0.10.3.ebuild,v 1.2 2009/01/23 20:42:39 loki_val Exp $

EAPI="2"

inherit autotools eutils multilib

MY_P=${P/-bindings/}
DESCRIPTION="rendering bindings for GUI toolkits for poppler"
HOMEPAGE="http://poppler.freedesktop.org/"

# Creating the testsuite tarball
# must be done if upstream has added tests since last release.
# can be checked at cgit.freedesktop.org
#
# git clone git://anongit.freedesktop.org/git/poppler/test
# rm -rf test/.git
# tar czf poppler-test-${PV}.tar.gz test

SRC_URI="http://poppler.freedesktop.org/${MY_P}.tar.gz
	test? ( mirror://gentoo/poppler-test-0.9.2.tar.bz2 )"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
IUSE="gtk qt3 cairo qt4 test"

RDEPEND="~app-text/poppler-${PV}
	cairo? (
		>=x11-libs/cairo-1.4
		!gtk? (
			>=x11-libs/gtk+-2.8
			>=dev-libs/glib-2.8
		 )
	)
	gtk? (
		>=x11-libs/gtk+-2.8
		>=dev-libs/glib-2.8
	)
	qt3? ( >=x11-libs/qt-3.3:3 )
	qt4? (
		|| (
			( x11-libs/qt-core:4
			  x11-libs/qt-gui:4
			  x11-libs/qt-test:4 )

			=x11-libs/qt-4.3*
		)
	)"
DEPEND="${RDEPEND}
	dev-util/pkgconfig
	test? ( gtk? ( >=gnome-base/libglade-2 ) )"

S="${WORKDIR}/${MY_P}"

pkg_setup() {
	if ! { use gtk || use qt3 || use qt4 || use cairo; }
	then
		eerror "You've selected to build no bindings for poppler."
		eerror "Please select at least one of:"
		eerror "gtk, qt3, qt4, cairo"
		die "Please select a toolkit"
	fi
	use test && ewarn "Tests will fail if your locale is unset."
}

src_prepare() {
	sed -i \
		-e 's:$(top_builddir)/poppler/libpoppler.la:-lpoppler:'	\
		$(find . -name 'Makefile.am' ) || die "404"
	sed -i \
		-e '/libpoppler_la_LIBADD/,/win32_libs/d'		\
		-e '/libpoppler_la_SOURCES/,/XpdfPluginAPI.cc/d'	\
		-e '/libpoppler.la/d'					\
		-e '/libpoppler_la/d'					\
		poppler/Makefile.am || die "404"

	sed -i \
		-e '/if BUILD_SPLASH_OUTPUT/,/endif/d'			\
		-e '/poppler.pc\t/d'					\
		-e ':$(splash_pc_file):d'				\
		Makefile.am || die "404"

	eautoreconf
}

src_configure() {
	# Configure needs help finding qt libs on multilib systems
	export QTLIB="${QTDIR}/$(get_libdir)"
	echo $QTLIB

	econf	--disable-utils						\
		--disable-static					\
		$(use_enable gtk poppler-glib)				\
		$(use_enable qt3 poppler-qt)				\
		$(use_enable qt4 poppler-qt4)				\
		$(use cairo && echo "--enable-poppler-glib")		\
		$(use_enable cairo cairo-output)			\
		|| die "configuration failed"
}

src_compile() {
	cd poppler
	if use cairo; then
		emake libpoppler-cairo.la || die "cairo failed"
	fi
	if use qt4; then
		emake libpoppler-arthur.la || die "arthur failed"
	fi
	cd ..
	emake || die "compilation failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	rm -f $(find "${D}" -name '*.la')
}

pkg_postinst() {
	ewarn "You need to rebuild everything depending on poppler, use revdep-rebuild"
}