Gentoo Archives: gentoo-commits

From: "Ladislav Láska" <ladislav.laska@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/kde-sunset:master commit in: eclass/
Date: Thu, 05 May 2011 21:11:30
Message-Id: 1a2a12373a548c85d50c0ea5320af9afba90b587.krakonos@gentoo
1 commit: 1a2a12373a548c85d50c0ea5320af9afba90b587
2 Author: Ladislav Láska <laska <AT> kam <DOT> mff <DOT> cuni <DOT> cz>
3 AuthorDate: Thu May 5 21:10:30 2011 +0000
4 Commit: Ladislav Láska <ladislav.laska <AT> gmail <DOT> com>
5 CommitDate: Thu May 5 21:10:30 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kde-sunset.git;a=commit;h=1a2a1237
7
8 Added poppler.eclass, since it was removed from main tree and some
9 ebuilds still depend on it.
10
11 ---
12 eclass/poppler.eclass | 197 +++++++++++++++++++++++++++++++++++++++++++++++++
13 1 files changed, 197 insertions(+), 0 deletions(-)
14
15 diff --git a/eclass/poppler.eclass b/eclass/poppler.eclass
16 new file mode 100644
17 index 0000000..38da37d
18 --- /dev/null
19 +++ b/eclass/poppler.eclass
20 @@ -0,0 +1,197 @@
21 +# Copyright 1999-2009 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/poppler.eclass,v 1.6 2010/01/03 19:10:49 scarabeus Exp $
24 +
25 +# @ECLASS: poppler.eclass
26 +# @MAINTAINER:
27 +# Peter Alfredsen <loki_val@g.o>
28 +# @BLURB: Reduces code duplication in the modularized poppler ebuilds.
29 +# @DESCRIPTION:
30 +# Provides an easy template for making modularized poppler-based ebuilds.
31 +
32 +inherit base multilib libtool
33 +
34 +has 2 ${EAPI} || DEPEND="EAPI-TOO-OLD"
35 +
36 +EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
37 +
38 +RDEPEND="
39 + !app-text/poppler
40 + !app-text/poppler-bindings
41 + "
42 +DEPEND="
43 + dev-util/pkgconfig
44 + userland_GNU? ( >=sys-apps/findutils-4.4.0 )
45 + "
46 +
47 +
48 +# @ECLASS-VARIABLE: HOMEPAGE
49 +# @DESCRIPTION:
50 +# Default HOMEPAGE
51 +HOMEPAGE="http://poppler.freedesktop.org/"
52 +
53 +# @ECLASS-VARIABLE: SRC_URI
54 +# @DESCRIPTION:
55 +# Default SRC_URI
56 +SRC_URI="http://poppler.freedesktop.org/poppler-${PV}.tar.gz"
57 +
58 +# @ECLASS-VARIABLE: S
59 +# @DESCRIPTION:
60 +# Default working directory
61 +S=${WORKDIR}/poppler-${PV}
62 +
63 +# @ECLASS-VARIABLE: POPPLER_MODULE
64 +# @DESCRIPTION:
65 +# The name of the poppler module. Must be set by the ebuild before inheriting
66 +# the poppler eclass.
67 +POPPLER_MODULE=${POPPLER_MODULE}
68 +
69 +# @ECLASS-VARIABLE: POPPLER_MODULE_S
70 +# @DESCRIPTION:
71 +# The working directory of the poppler module.
72 +POPPLER_MODULE_S=${S}/${POPPLER_MODULE}
73 +
74 +# @FUNCTION: pkg_check_modules_override
75 +# @USAGE: <GROUP> [package1] [package2]
76 +# @DESCRIPTION:
77 +# Will export the appropriate variables to override PKG_CHECK_MODULES autoconf
78 +# macros, with the string " " by default. If packages are specified, they will
79 +# be looked up with pkg-config and the appropriate LIBS and CFLAGS substituted.
80 +# LIBS and CFLAGS can also be specified per-package with the following syntax:
81 +# @CODE
82 +# package=LIBS%CFLAGS
83 +# @CODE
84 +# = and % have no effect unless both are specified.
85 +# Here is an example:
86 +# @CODE
87 +# pkg_check_modules_override GASH "gtk+-2.0=-jule%" gobject-2.0
88 +# @CODE
89 +# The above example will do:
90 +# @CODE
91 +# export GASH_CFLAGS+=" -jule"
92 +# export GASH_LIBS+=" "
93 +# export GASH_CFLAGS+=" $(pkg-config --cflags gobject-2.0)"
94 +# export GASH_LIBS+=" $(pkg-config --libs gobject-2.0)"
95 +# @CODE
96 +#
97 +# NOTE: If a package is not found, the string " " will be inserted in place of
98 +# <GROUP>_CFLAGS and <GROUP>_LIBS
99 +pkg_check_modules_override() {
100 + local package
101 + local group="${1}"
102 + local packages="${*:2}"
103 + export ${group}_CFLAGS=" "
104 + export ${group}_LIBS=" "
105 +
106 + if [[ ${#@} -lt 1 ]]
107 + then
108 + eerror "${FUNCNAME[0]} requires at least one parameter: GROUP"
109 + eerror "PKG_CHECK_MODULES(GROUP, package1 package2 etc)"
110 + die "${FUNCNAME[0]} requires at least one parameter: GROUP"
111 + fi
112 +
113 + for package in $packages
114 + do
115 + if [[ ${package/=} != ${package} && ${package/\%} != ${package} ]]
116 + then
117 + package_cflag_libs=${package##*=}
118 + export ${group}_CFLAGS+=" ${package_cflag_libs%%\%*}"
119 + export ${group}_LIBS+=" ${package_cflag_libs##*\%}"
120 + else
121 + if pkg-config --exists $package
122 + then
123 + export ${group}_CFLAGS+=" $(pkg-config --cflags $package)"
124 + export ${group}_LIBS+=" $(pkg-config --libs $package)"
125 + else
126 + export ${group}_CFLAGS+=" "
127 + export ${group}_LIBS+=" "
128 + fi
129 + fi
130 + done
131 +}
132 +# @FUNCTION: poppler_src_unpack
133 +# @USAGE:
134 +# @DESCRIPTION:
135 +# Runs unpack ${A}
136 +poppler_src_unpack() {
137 + unpack ${A}
138 +}
139 +
140 +# @FUNCTION: poppler_src_prepare
141 +# @USAGE:
142 +# @DESCRIPTION:
143 +# Runs autopatch from base.eclass.
144 +# Uses sed to replace libpoppler.la references with -lpoppler
145 +poppler_src_prepare() {
146 + base_src_prepare
147 + sed -i \
148 + -e 's#$(top_builddir)/poppler/libpoppler.la#-lpoppler#' \
149 + $(find . -type f -name 'Makefile.in') || die "Failed to sed proper lib into Makefile.am"
150 + elibtoolize
151 +}
152 +
153 +# @FUNCTION: poppler_src_configure
154 +# @USAGE:
155 +# @DESCRIPTION:
156 +# Makes sure we get a uniform Makefile environment by using pkg_check_modules_override to
157 +# fill out some blanks that configure wants filled. Probably not really needed, but
158 +# insures against future breakage.
159 +# Calls econf with some defaults.
160 +poppler_src_configure() {
161 + pkg_check_modules_override CAIRO cairo
162 + pkg_check_modules_override POPPLER_GLIB glib-2.0
163 + pkg_check_modules_override POPPLER_QT4 QtCore QtGui QtXml
164 + pkg_check_modules_override POPPLER_QT4_TEST QtTest
165 + pkg_check_modules_override ABIWORD libxml-2.0
166 + pkg_check_modules_override GTK_TEST gtk+-2.0 gdk-pixbuf-2.0 libglade-2.0 gthread-2.0
167 + pkg_check_modules_override POPPLER_GLIB glib-2.0 gobject-2.0
168 +
169 + econf --disable-static \
170 + --enable-poppler-qt4 \
171 + --enable-poppler-glib \
172 + --enable-xpdf-headers \
173 + --enable-libjpeg \
174 + --enable-libopenjpeg \
175 + --enable-zlib \
176 + --enable-splash-output \
177 + ${POPPLER_CONF}
178 +}
179 +
180 +# @FUNCTION: poppler_src_compile
181 +# @USAGE:
182 +# @DESCRIPTION:
183 +# Removes top_srcdir Makefile to ensure that no accidental recursion happens. The build
184 +# will just die if it tries to go through top_srcdir.
185 +# Runs emake "$@" in POPPLER_MODULE_S
186 +poppler_src_compile() {
187 + rm -f "${S}"/Makefile* &> /dev/null
188 + cd "${POPPLER_MODULE_S}" || die "POPPLER_MODULE_S=${POPPLER_MODULE_S} - cd failed"
189 + einfo "Now in $POPPLER_MODULE_S"
190 + emake "$@" || die "emake failed"
191 +}
192 +
193 +# @FUNCTION: poppler_src_install
194 +# @USAGE:
195 +# @DESCRIPTION:
196 +# Runs emake DESTDIR="${D}" ${@:-install} in POPPLER_MODULE_S
197 +# Removes .la files.
198 +poppler_src_install() {
199 + cd "${POPPLER_MODULE_S}"
200 + emake DESTDIR="${D}" ${@:-install} || die "make install failed"
201 + for pfile in "${POPPLER_PKGCONFIG[@]}"
202 + do
203 + insinto /usr/$(get_libdir)/pkgconfig
204 + if [[ ${pfile/=} != ${pfile} ]]
205 + then
206 + if use ${pfile%=*}
207 + then
208 + pfile=${pfile#*=}
209 + else
210 + pfile=false
211 + fi
212 + fi
213 + [[ ${pfile} != "false" ]] && doins "${S}/${pfile}"
214 + done
215 +
216 + find "${D}" -type f -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
217 +}