app-misc/lirc: Add missing PYTHON_REQUIRED_USE
[gentoo.git] / app-misc / sphinx / sphinx-2.0.10.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 inherit eutils autotools toolchain-funcs
7
8 #MY_P=${P/_/-}
9 MY_P=${P}-release
10
11 # This has been added by Gentoo, to explicitly version libstemmer.
12 # It is the date that http://snowball.tartarus.org/dist/libstemmer_c.tgz was
13 # fetched.
14 STEMMER_PV="20091122"
15 DESCRIPTION="Full-text search engine with support for MySQL and PostgreSQL"
16 HOMEPAGE="http://www.sphinxsearch.com/"
17 SRC_URI="http://sphinxsearch.com/files/${MY_P}.tar.gz
18         stemmer? ( mirror://gentoo/libstemmer_c-${STEMMER_PV}.tgz )"
19
20 LICENSE="GPL-2"
21 SLOT="0"
22 KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc x86 ~amd64-linux ~ppc-macos ~x86-macos ~sparc-solaris ~sparc64-solaris"
23 IUSE="debug id64 mysql odbc postgres stemmer test"
24
25 RDEPEND="mysql? ( virtual/mysql )
26         postgres? ( dev-db/postgresql )
27         odbc? ( dev-db/unixODBC )
28         virtual/libiconv"
29 DEPEND="${RDEPEND}
30         test? ( dev-lang/php )"
31
32 S=${WORKDIR}/${MY_P}
33
34 src_unpack() {
35         unpack ${MY_P}.tar.gz
36         if use stemmer; then
37                 cd "${S}"
38                 unpack libstemmer_c-${STEMMER_PV}.tgz
39         fi
40 }
41
42 src_prepare() {
43         epatch "${FILESDIR}"/${PN}-2.0.1_beta-darwin8.patch
44
45         # drop nasty hardcoded search path breaking Prefix
46         # We patch configure directly since otherwise we need to run
47         # eautoreconf twice and that causes problems, bug 425380
48         sed -i -e 's/\/usr\/local\//\/someplace\/nonexisting\//g' configure || die
49
50         # Fix QA compilation warnings.
51         sed -i -e '19i#include <string.h>' api/libsphinxclient/test.c || die
52
53         pushd api/libsphinxclient || die
54         eautoreconf
55         popd || die
56 }
57
58 src_configure() {
59         # fix libiconv detection
60         use !elibc_glibc && export ac_cv_search_iconv=-liconv
61
62         econf \
63                 --sysconfdir="${EPREFIX}/etc/${PN}" \
64                 $(use_enable id64) \
65                 $(use_with debug) \
66                 $(use_with mysql) \
67                 $(use_with odbc unixodbc) \
68                 $(use_with postgres pgsql) \
69                 $(use_with stemmer libstemmer)
70
71         cd api/libsphinxclient || die
72         econf STRIP=:
73 }
74
75 src_compile() {
76         emake AR="$(tc-getAR)" || die "emake failed"
77
78         emake -j 1 -C api/libsphinxclient || die "emake libsphinxclient failed"
79 }
80
81 src_test() {
82         elog "Tests require access to a live MySQL database and may require configuration."
83         elog "You will find them in /usr/share/${PN}/test and they require dev-lang/php"
84 }
85
86 src_install() {
87         emake DESTDIR="${D}" install || die "install failed"
88         emake DESTDIR="${D}" -C api/libsphinxclient install || die "install libsphinxclient failed"
89
90         dodoc doc/*
91
92         dodir /var/lib/sphinx
93         dodir /var/log/sphinx
94
95         newinitd "${FILESDIR}"/searchd.rc searchd
96
97         if use test; then
98                 insinto /usr/share/${PN}
99                 doins -r test
100         fi
101 }