dev-libs/xapian-bindings-1.4.4-r0: add amd64 keyword
[gentoo.git] / dev-libs / xapian-bindings / xapian-bindings-1.4.4.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 PYTHON_COMPAT=( python{2_7,3_4,3_5} )
7 PYTHON_REQ_USE="threads(+)"
8
9 USE_PHP="php5-6"
10
11 PHP_EXT_NAME="xapian"
12 PHP_EXT_INI="yes"
13 PHP_EXT_OPTIONAL_USE="php"
14
15 inherit distutils-r1 libtool java-pkg-opt-2 mono-env php-ext-source-r2 toolchain-funcs
16
17 DESCRIPTION="SWIG and JNI bindings for Xapian"
18 HOMEPAGE="http://www.xapian.org/"
19 SRC_URI="http://oligarchy.co.uk/xapian/${PV}/${P}.tar.xz"
20
21 LICENSE="GPL-2"
22 SLOT="0"
23 KEYWORDS="~alpha amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
24 IUSE="java lua mono perl php python ruby tcl"
25 REQUIRED_USE="|| ( java lua mono perl php python ruby tcl )"
26
27 COMMONDEPEND="dev-libs/xapian:0/30
28         lua? ( dev-lang/lua:= )
29         perl? ( dev-lang/perl:= )
30         python? (
31                 dev-python/sphinx[${PYTHON_USEDEP}]
32                 ${PYTHON_DEPS}
33         )
34         ruby? ( dev-lang/ruby:= )
35         tcl? ( dev-lang/tcl:= )
36         mono? ( dev-lang/mono )"
37 DEPEND="${COMMONDEPEND}
38         virtual/pkgconfig
39         java? ( >=virtual/jdk-1.6 )"
40 RDEPEND="${COMMONDEPEND}
41         java? ( >=virtual/jre-1.6 )"
42
43 pkg_setup() {
44         use mono && mono-env_pkg_setup
45         use java && java-pkg-opt-2_pkg_setup
46 }
47
48 src_prepare() {
49         use java && java-pkg-opt-2_src_prepare
50
51         # http://trac.xapian.org/ticket/702
52         export XAPIAN_CONFIG="/usr/bin/xapian-config"
53
54         # Accept ruby 2.0 - patch configure directly to avoid autoreconf
55         epatch "${FILESDIR}"/${PN}-1.3.6-allow-ruby-2.0.patch
56
57         if use python; then
58                 python_copy_sources
59         fi
60 }
61
62 src_configure() {
63         local conf=(
64                 --disable-documentation
65                 --without-csharp
66                 --without-python
67                 --without-python3
68         )
69
70         if use java; then
71                 export CXXFLAGS="${CXXFLAGS} $(java-pkg_get-jni-cflags)"
72                 conf+=( --with-java )
73         fi
74
75         if use perl; then
76                 export PERL_ARCH="$(perl -MConfig -e 'print $Config{installvendorarch}')"
77                 export PERL_LIB="$(perl -MConfig -e 'print $Config{installvendorlib}')"
78                 conf+=( --with-perl )
79         fi
80
81         if use lua; then
82                 export LUA_LIB="$($(tc-getPKG_CONFIG) --variable=INSTALL_CMOD lua)"
83                 conf+=( --with-lua )
84         fi
85
86         if use php; then
87                 if has_version "=dev-lang/php-7*"; then
88                         conf+=( --with-php7 )
89                 else
90                         conf+=( --with-php )
91                 fi
92         fi
93
94         use ruby && conf+=( --with-ruby )
95         use tcl  && conf+=( --with-tcl )
96         use mono && conf+=( --with-csharp )
97
98         econf ${conf[@]}
99
100         python_configure() {
101                 local myconf=(
102                         --disable-documentation
103                         --without-java
104                         --without-lua
105                         --without-csharp
106                         --without-perl
107                         --without-php
108                         --without-ruby
109                         --without-tcl
110                 )
111                 if python_is_python3; then
112                         myconf+=( --with-python3 )
113                 else
114                         myconf+=( --with-python )
115                 fi
116
117                 # Avoid sandbox failures when compiling modules
118                 addpredict "$(python_get_sitedir)"
119
120                 econf "${myconf[@]}"
121         }
122
123         if use python; then
124                 python_foreach_impl run_in_build_dir python_configure
125         fi
126 }
127
128 src_compile() {
129         default
130         if use python; then
131                 unset PYTHONDONTWRITEBYTECODE
132                 python_foreach_impl run_in_build_dir emake
133         fi
134 }
135
136 src_install() {
137         emake DESTDIR="${D}" install
138
139         if use java; then
140                 java-pkg_dojar java/built/xapian_jni.jar
141                 # TODO: make the build system not install this...
142                 java-pkg_doso java/.libs/libxapian_jni.so
143                 rm -rf "${D}var" || die "could not remove java cruft!"
144         fi
145
146         use php && php-ext-source-r2_createinifiles
147
148         if use python; then
149                 python_foreach_impl run_in_build_dir emake DESTDIR="${D}" install
150         fi
151
152         # For some USE combinations this directory is not created
153         if [[ -d "${D}/usr/share/doc/xapian-bindings" ]]; then
154                 mv "${D}/usr/share/doc/xapian-bindings" "${D}/usr/share/doc/${PF}" || die
155         fi
156
157         dodoc AUTHORS HACKING NEWS TODO README
158 }