Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/xapian-bindings/
Date: Mon, 20 Nov 2017 10:37:02
Message-Id: 1511174190.2e2154546c2cc9b71ddccef7d6717829a8bd575f.blueness@gentoo
1 commit: 2e2154546c2cc9b71ddccef7d6717829a8bd575f
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 20 10:36:14 2017 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 20 10:36:30 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e215454
7
8 dev-libs/xapian-bindings: improve multislot support, bug #635826
9
10 Package-Manager: Portage-2.3.13, Repoman-2.3.3
11
12 .../xapian-bindings/xapian-bindings-1.4.5.ebuild | 221 +++++++++++++++++----
13 1 file changed, 183 insertions(+), 38 deletions(-)
14
15 diff --git a/dev-libs/xapian-bindings/xapian-bindings-1.4.5.ebuild b/dev-libs/xapian-bindings/xapian-bindings-1.4.5.ebuild
16 index 2a25212d28d..8124da90fde 100644
17 --- a/dev-libs/xapian-bindings/xapian-bindings-1.4.5.ebuild
18 +++ b/dev-libs/xapian-bindings/xapian-bindings-1.4.5.ebuild
19 @@ -3,16 +3,19 @@
20
21 EAPI="6"
22
23 -PYTHON_COMPAT=( python{2_7,3_4,3_5} )
24 +PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
25 PYTHON_REQ_USE="threads(+)"
26
27 -USE_PHP="php5-6"
28 +USE_PHP="php5-6 php7-0 php7-1 php7-2"
29
30 PHP_EXT_NAME="xapian"
31 PHP_EXT_INI="yes"
32 PHP_EXT_OPTIONAL_USE="php"
33
34 -inherit distutils-r1 libtool java-pkg-opt-2 mono-env php-ext-source-r3 toolchain-funcs
35 +USE_RUBY="ruby22 ruby23 ruby24"
36 +RUBY_OPTIONAL="yes"
37 +
38 +inherit java-pkg-opt-2 mono-env multibuild php-ext-source-r3 python-r1 ruby-ng toolchain-funcs
39
40 DESCRIPTION="SWIG and JNI bindings for Xapian"
41 HOMEPAGE="http://www.xapian.org/"
42 @@ -22,7 +25,9 @@ LICENSE="GPL-2"
43 SLOT="0"
44 KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
45 IUSE="java lua mono perl php python ruby tcl"
46 -REQUIRED_USE="|| ( java lua mono perl php python ruby tcl )"
47 +REQUIRED_USE="|| ( java lua mono perl php python ruby tcl )
48 + python? ( ${PYTHON_REQUIRED_USE} )
49 + ruby? ( || ( $(ruby_get_use_targets) ) )"
50
51 COMMONDEPEND="dev-libs/xapian:0/30
52 lua? ( dev-lang/lua:= )
53 @@ -31,7 +36,7 @@ COMMONDEPEND="dev-libs/xapian:0/30
54 dev-python/sphinx[${PYTHON_USEDEP}]
55 ${PYTHON_DEPS}
56 )
57 - ruby? ( dev-lang/ruby:= )
58 + ruby? ( $(ruby_implementations_depend) )
59 tcl? ( dev-lang/tcl:= )
60 mono? ( dev-lang/mono )"
61 DEPEND="${COMMONDEPEND}
62 @@ -40,64 +45,140 @@ DEPEND="${COMMONDEPEND}
63 RDEPEND="${COMMONDEPEND}
64 java? ( >=virtual/jre-1.6 )"
65
66 +S="${WORKDIR}/${P}"
67 +
68 +has_basic_bindings() {
69 + # Update this list if new bindings are added that are not built
70 + # multiple times for multiple versions like php, python and ruby are
71 + return $(use mono || use java || use lua || use perl || use tcl)
72 +}
73 +
74 +php_copy_sources() {
75 + local MULTIBUILD_VARIANTS=($(php_get_slots))
76 + multibuild_copy_sources
77 +}
78 +
79 +php_foreach_impl() {
80 + local MULTIBUILD_VARIANTS=($(php_get_slots))
81 + multibuild_foreach_variant "$@"
82 +}
83 +
84 +ruby_copy_sources() {
85 + local MULTIBUILD_VARIANTS=($(ruby_get_use_implementations))
86 + multibuild_copy_sources
87 +}
88 +
89 +ruby_foreach_impl() {
90 + local MULTIBUILD_VARIANTS=($(ruby_get_use_implementations))
91 + multibuild_foreach_variant "$@"
92 +}
93 +
94 pkg_setup() {
95 use mono && mono-env_pkg_setup
96 use java && java-pkg-opt-2_pkg_setup
97 }
98
99 +src_unpack() {
100 + default
101 +
102 + if use php; then
103 + local php_slot
104 + for php_slot in $(php_get_slots); do
105 + # Unfortunately required for php-ext-source-r3_createinifiles().
106 + mkdir "${WORKDIR}/${php_slot}"
107 + done
108 + fi
109 +}
110 +
111 src_prepare() {
112 use java && java-pkg-opt-2_src_prepare
113
114 # http://trac.xapian.org/ticket/702
115 export XAPIAN_CONFIG="/usr/bin/xapian-config"
116
117 - # Accept ruby 2.0 - patch configure directly to avoid autoreconf
118 - epatch "${FILESDIR}"/${PN}-1.3.6-allow-ruby-2.0.patch
119 + if use php; then
120 + php_copy_sources
121 + fi
122
123 if use python; then
124 python_copy_sources
125 fi
126
127 + if use ruby; then
128 + ruby_copy_sources
129 + fi
130 +
131 eapply_user
132 }
133
134 src_configure() {
135 - local conf=(
136 - --disable-documentation
137 - --without-csharp
138 - --without-python
139 - --without-python3
140 - )
141 + if has_basic_bindings ; then
142 + local conf=(
143 + --disable-documentation
144 + $(use_with mono csharp)
145 + $(use_with java)
146 + $(use_with lua)
147 + $(use_with perl)
148 + $(use_with tcl)
149 + --without-php
150 + --without-php7
151 + --without-python
152 + --without-python3
153 + --without-ruby
154 + )
155
156 - if use java; then
157 - export CXXFLAGS="${CXXFLAGS} $(java-pkg_get-jni-cflags)"
158 - conf+=( --with-java )
159 - fi
160 + if use java; then
161 + local -x CXXFLAGS="${CXXFLAGS} $(java-pkg_get-jni-cflags)"
162 + fi
163
164 - if use perl; then
165 - export PERL_ARCH="$(perl -MConfig -e 'print $Config{installvendorarch}')"
166 - export PERL_LIB="$(perl -MConfig -e 'print $Config{installvendorlib}')"
167 - conf+=( --with-perl )
168 - fi
169 + if use perl; then
170 + local -x PERL_ARCH="$(perl -MConfig -e 'print $Config{installvendorarch}')"
171 + local -x PERL_LIB="$(perl -MConfig -e 'print $Config{installvendorlib}')"
172 + fi
173 +
174 + if use lua; then
175 + local -x LUA_INC="$("$(tc-getPKG_CONFIG)" --variable=INSTALL_INC lua)"
176 + local -x LUA_LIB="$("$(tc-getPKG_CONFIG)" --variable=INSTALL_CMOD lua)"
177 + fi
178
179 - if use lua; then
180 - export LUA_LIB="$($(tc-getPKG_CONFIG) --variable=INSTALL_CMOD lua)"
181 - conf+=( --with-lua )
182 + econf "${conf[@]}"
183 fi
184
185 - if use php; then
186 - if has_version "=dev-lang/php-7*"; then
187 - conf+=( --with-php7 )
188 - else
189 - conf+=( --with-php )
190 + php_configure() {
191 + local myconf=(
192 + --disable-documentation
193 + --without-java
194 + --without-lua
195 + --without-csharp
196 + --without-perl
197 + --without-python
198 + --without-python3
199 + --without-ruby
200 + --without-tcl
201 + )
202 + if [[ ${MULTIBUILD_VARIANT} == php5.* ]]; then
203 + myconf+=(
204 + --with-php
205 + --without-php7
206 + )
207 + local -x PHP_CONFIG="${EPREFIX}/usr/$(get_libdir)/${MULTIBUILD_VARIANT/-/.}/bin/php-config"
208 + elif [[ ${MULTIBUILD_VARIANT} == php7.* ]]; then
209 + myconf+=(
210 + --without-php
211 + --with-php7
212 + )
213 + local -x PHP_CONFIG7="${EPREFIX}/usr/$(get_libdir)/${MULTIBUILD_VARIANT/-/.}/bin/php-config"
214 fi
215 - fi
216
217 - use ruby && conf+=( --with-ruby )
218 - use tcl && conf+=( --with-tcl )
219 - use mono && conf+=( --with-csharp )
220 + econf "${myconf[@]}"
221 + }
222 +
223 + if use php; then
224 + addpredict /usr/share/snmp/mibs/.index
225 + addpredict /var/lib/net-snmp/mib_indexes
226
227 - econf ${conf[@]}
228 + php_foreach_impl run_in_build_dir php_configure
229 + fi
230
231 python_configure() {
232 local myconf=(
233 @@ -107,6 +188,7 @@ src_configure() {
234 --without-csharp
235 --without-perl
236 --without-php
237 + --without-php7
238 --without-ruby
239 --without-tcl
240 )
241 @@ -125,18 +207,72 @@ src_configure() {
242 if use python; then
243 python_foreach_impl run_in_build_dir python_configure
244 fi
245 +
246 + ruby_configure() {
247 + local myconf=(
248 + --disable-documentation
249 + --without-java
250 + --without-lua
251 + --without-csharp
252 + --without-perl
253 + --without-php
254 + --without-php7
255 + --without-python
256 + --without-python3
257 + --with-ruby
258 + --without-tcl
259 + )
260 + local -x RUBY="${EPREFIX}/usr/bin/${MULTIBUILD_VARIANT}"
261 +
262 + econf "${myconf[@]}"
263 + }
264 +
265 + if use ruby; then
266 + ruby_foreach_impl run_in_build_dir ruby_configure
267 + fi
268 }
269
270 src_compile() {
271 - default
272 + if has_basic_bindings ; then
273 + default
274 + fi
275 +
276 + if use php; then
277 + php_foreach_impl run_in_build_dir emake
278 + fi
279 +
280 if use python; then
281 unset PYTHONDONTWRITEBYTECODE
282 python_foreach_impl run_in_build_dir emake
283 fi
284 +
285 + if use ruby; then
286 + ruby_foreach_impl run_in_build_dir emake
287 + fi
288 +}
289 +
290 +src_test() {
291 + if has_basic_bindings ; then
292 + default
293 + fi
294 +
295 + if use php; then
296 + php_foreach_impl run_in_build_dir emake check
297 + fi
298 +
299 + if use python; then
300 + python_foreach_impl run_in_build_dir emake check
301 + fi
302 +
303 + if use ruby; then
304 + ruby_foreach_impl run_in_build_dir emake check
305 + fi
306 }
307
308 src_install() {
309 - emake DESTDIR="${D}" install
310 + if has_basic_bindings ; then
311 + emake DESTDIR="${D}" install
312 + fi
313
314 if use java; then
315 java-pkg_dojar java/built/xapian_jni.jar
316 @@ -145,12 +281,21 @@ src_install() {
317 rm -rf "${D}var" || die "could not remove java cruft!"
318 fi
319
320 - use php && php-ext-source-r3_createinifiles
321 + if use php; then
322 + php_foreach_impl run_in_build_dir emake DESTDIR="${D}" install
323 + php-ext-source-r3_createinifiles
324 + # php-ext-source-r3_createinifiles() changes current directory.
325 + cd "${S}"
326 + fi
327
328 if use python; then
329 python_foreach_impl run_in_build_dir emake DESTDIR="${D}" install
330 fi
331
332 + if use ruby; then
333 + ruby_foreach_impl run_in_build_dir emake DESTDIR="${D}" install
334 + fi
335 +
336 # For some USE combinations this directory is not created
337 if [[ -d "${D}/usr/share/doc/xapian-bindings" ]]; then
338 mv "${D}/usr/share/doc/xapian-bindings" "${D}/usr/share/doc/${PF}" || die