Merge remote-tracking branch 'github/pr/2235'
[gentoo.git] / dev-libs / xapian-bindings / xapian-bindings-1.4.0-r1.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
8 PYTHON_REQ_USE=threads
9 DISTUTILS_SINGLE_IMPL=yesplz
10 DISTUTILS_OPTIONAL=yesplz
11 DISTUTILS_IN_SOURCE_BUILD=yesplz
12
13 USE_PHP="php5-5 php5-6"
14
15 PHP_EXT_NAME="xapian"
16 PHP_EXT_INI="yes"
17 PHP_EXT_OPTIONAL_USE="php"
18
19 #mono violates sandbox, we disable it until we figure this out
20 #inherit distutils-r1 libtool java-pkg-opt-2 mono-env php-ext-source-r2 toolchain-funcs
21 inherit libtool java-pkg-opt-2 php-ext-source-r2 toolchain-funcs
22
23 DESCRIPTION="SWIG and JNI bindings for Xapian"
24 HOMEPAGE="http://www.xapian.org/"
25 SRC_URI="http://oligarchy.co.uk/xapian/${PV}/${P}.tar.xz"
26
27 LICENSE="GPL-2"
28 SLOT="0"
29 KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
30 #IUSE="java lua mono perl php python ruby tcl"
31 IUSE="java lua perl php python ruby tcl"
32 #REQUIRED_USE="|| ( java lua mono perl php python ruby tcl )"
33 REQUIRED_USE="|| ( java lua perl php python ruby tcl )"
34
35 COMMONDEPEND="dev-libs/xapian:0/30
36         lua? ( dev-lang/lua:= )
37         perl? ( dev-lang/perl:= )
38         python? (
39                 dev-python/sphinx
40                 ${PYTHON_DEPS}
41         )
42         ruby? ( dev-lang/ruby:= )
43         tcl? ( dev-lang/tcl:= )"
44 #       mono? ( dev-lang/mono )
45 DEPEND="${COMMONDEPEND}
46         virtual/pkgconfig
47         java? ( >=virtual/jdk-1.6 )"
48 RDEPEND="${COMMONDEPEND}
49         java? ( >=virtual/jre-1.6 )"
50
51 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
52
53 pkg_setup() {
54 #       use mono && mono-env_pkg_setup
55         use java && java-pkg-opt-2_pkg_setup
56 #       use python && python-single-r1_pkg_setup
57 }
58
59 src_prepare() {
60         use java && java-pkg-opt-2_src_prepare
61
62         # http://trac.xapian.org/ticket/702
63         export XAPIAN_CONFIG="/usr/bin/xapian-config"
64
65         # Accept ruby 2.0 - patch configure directly to avoid autoreconf
66         epatch "${FILESDIR}"/${PN}-1.3.6-allow-ruby-2.0.patch
67 }
68
69 src_configure() {
70         if use java; then
71                 export CXXFLAGS="${CXXFLAGS} $(java-pkg_get-jni-cflags)"
72         fi
73
74         if use perl; then
75                 export PERL_ARCH="$(perl -MConfig -e 'print $Config{installvendorarch}')"
76                 export PERL_LIB="$(perl -MConfig -e 'print $Config{installvendorlib}')"
77         fi
78
79         if use lua; then
80                 export LUA_LIB="$($(tc-getPKG_CONFIG) --variable=INSTALL_CMOD lua)"
81         fi
82
83         econf \
84                 --disable-documentation \
85                 $(use_with java) \
86                 $(use_with lua) \
87                 --without-csharp \
88                 $(use_with perl) \
89                 $(use_with php) \
90                 $(use_with python) \
91                 $(use_with python python3) \
92                 $(use_with ruby) \
93                 $(use_with tcl)
94 #               $(use_with mono csharp)
95 }
96
97 src_compile() {
98         local -x PYTHONDONTWRITEBYTECODE=
99         default
100 }
101
102 src_install() {
103         emake DESTDIR="${D}" install
104
105         if use java; then
106                 java-pkg_dojar java/built/xapian_jni.jar
107                 # TODO: make the build system not install this...
108                 java-pkg_doso java/.libs/libxapian_jni.so
109                 rm -rf "${D}var" || die "could not remove java cruft!"
110         fi
111
112         use php && php-ext-source-r2_createinifiles
113
114         # For some USE combinations this directory is not created
115         if [[ -d "${D}/usr/share/doc/xapian-bindings" ]]; then
116                 mv "${D}/usr/share/doc/xapian-bindings" "${D}/usr/share/doc/${PF}" || die
117         fi
118
119         dodoc AUTHORS HACKING NEWS TODO README
120 }