| 1 |
blueness |
1.1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
|
|
# $Header: /var/cvsroot/gentoo-x86/dev-libs/xapian-bindings/xapian-bindings-1.2.11.ebuild,v 1.1 2012/06/28 03:12:04 blueness Exp $ |
| 4 |
|
|
|
| 5 |
|
|
EAPI="3" |
| 6 |
|
|
|
| 7 |
|
|
PYTHON_DEPEND="python? 2" |
| 8 |
|
|
PYTHON_USE_WITH="threads" |
| 9 |
|
|
SUPPORT_PYTHON_ABIS="1" |
| 10 |
|
|
RESTRICT_PYTHON_ABIS="3.* *-jython 2.7-pypy-*" |
| 11 |
|
|
|
| 12 |
|
|
PHP_EXT_NAME="xapian" |
| 13 |
|
|
PHP_EXT_INI="yes" |
| 14 |
|
|
PHP_EXT_OPTIONAL_USE="php" |
| 15 |
|
|
|
| 16 |
|
|
inherit java-pkg-opt-2 mono php-ext-source-r2 python |
| 17 |
|
|
|
| 18 |
|
|
DESCRIPTION="SWIG and JNI bindings for Xapian" |
| 19 |
|
|
HOMEPAGE="http://www.xapian.org/" |
| 20 |
|
|
SRC_URI="http://oligarchy.co.uk/xapian/${PV}/${P}.tar.gz" |
| 21 |
|
|
|
| 22 |
|
|
LICENSE="GPL-2" |
| 23 |
|
|
SLOT="0" |
| 24 |
|
|
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86" |
| 25 |
|
|
IUSE="java lua mono perl php python ruby tcl" |
| 26 |
|
|
|
| 27 |
|
|
COMMONDEPEND="=dev-libs/xapian-${PV}* |
| 28 |
|
|
lua? ( >=dev-lang/lua-5.1 ) |
| 29 |
|
|
mono? ( >=dev-lang/mono-1.0.8 ) |
| 30 |
|
|
perl? ( dev-lang/perl ) |
| 31 |
|
|
ruby? ( dev-lang/ruby ) |
| 32 |
|
|
tcl? ( >=dev-lang/tcl-8.1 )" |
| 33 |
|
|
DEPEND="${COMMONDEPEND} |
| 34 |
|
|
java? ( >=virtual/jdk-1.3 )" |
| 35 |
|
|
RDEPEND="${COMMONDEPEND} |
| 36 |
|
|
java? ( >=virtual/jre-1.3 )" |
| 37 |
|
|
|
| 38 |
|
|
pkg_setup() { |
| 39 |
|
|
java-pkg-opt-2_pkg_setup |
| 40 |
|
|
|
| 41 |
|
|
if use python; then |
| 42 |
|
|
python_pkg_setup |
| 43 |
|
|
fi |
| 44 |
|
|
} |
| 45 |
|
|
|
| 46 |
|
|
src_prepare() { |
| 47 |
|
|
java-pkg-opt-2_src_prepare |
| 48 |
|
|
if use java; then |
| 49 |
|
|
sed \ |
| 50 |
|
|
-e 's/$(JAVAC)/$(JAVAC) $(JAVACFLAGS)/' \ |
| 51 |
|
|
-i java{/,/org/xapian/errors/,/org/xapian/}Makefile.in || die "sed failed" |
| 52 |
|
|
fi |
| 53 |
|
|
|
| 54 |
|
|
if use python; then |
| 55 |
|
|
sed \ |
| 56 |
|
|
-e 's:\(^pkgpylib_DATA = xapian/__init__.py\).*:\1:' \ |
| 57 |
|
|
-e 's|\(^xapian/__init__.py: modern/xapian.py\)|\1 xapian/_xapian$(PYTHON_SO)|' \ |
| 58 |
|
|
-i python/Makefile.in || die "sed failed" |
| 59 |
|
|
fi |
| 60 |
|
|
} |
| 61 |
|
|
|
| 62 |
|
|
src_configure() { |
| 63 |
|
|
if use java; then |
| 64 |
|
|
CXXFLAGS="${CXXFLAGS} $(java-pkg_get-jni-cflags)" |
| 65 |
|
|
fi |
| 66 |
|
|
|
| 67 |
|
|
if use perl; then |
| 68 |
|
|
export PERL_ARCH="$(perl -MConfig -e 'print $Config{installvendorarch}')" |
| 69 |
|
|
export PERL_LIB="$(perl -MConfig -e 'print $Config{installvendorlib}')" |
| 70 |
|
|
fi |
| 71 |
|
|
|
| 72 |
|
|
if use lua; then |
| 73 |
|
|
export LUA_LIB="$(pkg-config --variable=INSTALL_CMOD lua)" |
| 74 |
|
|
fi |
| 75 |
|
|
|
| 76 |
|
|
econf \ |
| 77 |
|
|
$(use_with java) \ |
| 78 |
|
|
$(use_with lua) \ |
| 79 |
|
|
$(use_with mono csharp) \ |
| 80 |
|
|
$(use_with perl) \ |
| 81 |
|
|
$(use_with php) \ |
| 82 |
|
|
$(use_with python) \ |
| 83 |
|
|
$(use_with ruby) \ |
| 84 |
|
|
$(use_with tcl) |
| 85 |
|
|
|
| 86 |
|
|
# Python bindings are built/tested/installed manually. |
| 87 |
|
|
sed -e "/SUBDIRS =/s/ python//" -i Makefile || die "sed Makefile" |
| 88 |
|
|
} |
| 89 |
|
|
|
| 90 |
|
|
src_compile() { |
| 91 |
|
|
default |
| 92 |
|
|
|
| 93 |
|
|
if use python; then |
| 94 |
|
|
python_copy_sources python |
| 95 |
|
|
building() { |
| 96 |
|
|
emake \ |
| 97 |
|
|
PYTHON="$(PYTHON)" \ |
| 98 |
|
|
PYTHON_INC="$(python_get_includedir)" \ |
| 99 |
|
|
PYTHON_LIB="$(python_get_libdir)" \ |
| 100 |
|
|
PYTHON_SO="$("$(PYTHON)" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_vars("SO")[0])')" \ |
| 101 |
|
|
pkgpylibdir="$(python_get_sitedir)/xapian" |
| 102 |
|
|
} |
| 103 |
|
|
python_execute_function -s --source-dir python building |
| 104 |
|
|
fi |
| 105 |
|
|
} |
| 106 |
|
|
|
| 107 |
|
|
src_test() { |
| 108 |
|
|
default |
| 109 |
|
|
|
| 110 |
|
|
if use python; then |
| 111 |
|
|
testing() { |
| 112 |
|
|
emake \ |
| 113 |
|
|
PYTHON="$(PYTHON)" \ |
| 114 |
|
|
PYTHON_INC="$(python_get_includedir)" \ |
| 115 |
|
|
PYTHON_LIB="$(python_get_libdir)" \ |
| 116 |
|
|
PYTHON_SO="$("$(PYTHON)" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_vars("SO")[0])')" \ |
| 117 |
|
|
pkgpylibdir="$(python_get_sitedir)/xapian" \ |
| 118 |
|
|
VERBOSE="1" \ |
| 119 |
|
|
check |
| 120 |
|
|
} |
| 121 |
|
|
python_execute_function -s --source-dir python testing |
| 122 |
|
|
fi |
| 123 |
|
|
} |
| 124 |
|
|
|
| 125 |
|
|
src_install () { |
| 126 |
|
|
emake DESTDIR="${D}" install || die "emake install failed" |
| 127 |
|
|
|
| 128 |
|
|
if use java; then |
| 129 |
|
|
java-pkg_dojar java/built/xapian_jni.jar |
| 130 |
|
|
# TODO: make the build system not install this... |
| 131 |
|
|
java-pkg_doso "${D}/${S}/java/built/libxapian_jni.so" |
| 132 |
|
|
rm "${D}/${S}/java/built/libxapian_jni.so" |
| 133 |
|
|
rmdir -p "${D}/${S}/java/built" |
| 134 |
|
|
rmdir -p "${D}/${S}/java/native" |
| 135 |
|
|
fi |
| 136 |
|
|
|
| 137 |
|
|
if use python; then |
| 138 |
|
|
installation() { |
| 139 |
|
|
emake \ |
| 140 |
|
|
DESTDIR="${D}" \ |
| 141 |
|
|
PYTHON="$(PYTHON)" \ |
| 142 |
|
|
PYTHON_INC="$(python_get_includedir)" \ |
| 143 |
|
|
PYTHON_LIB="$(python_get_libdir)" \ |
| 144 |
|
|
PYTHON_SO="$("$(PYTHON)" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_vars("SO")[0])')" \ |
| 145 |
|
|
pkgpylibdir="$(python_get_sitedir)/xapian" \ |
| 146 |
|
|
install |
| 147 |
|
|
} |
| 148 |
|
|
python_execute_function -s --source-dir python installation |
| 149 |
|
|
fi |
| 150 |
|
|
|
| 151 |
|
|
if use php; then |
| 152 |
|
|
php-ext-source-r2_createinifiles |
| 153 |
|
|
fi |
| 154 |
|
|
|
| 155 |
|
|
# For some USE combinations this directory is not created |
| 156 |
|
|
if [[ -d "${D}/usr/share/doc/xapian-bindings" ]]; then |
| 157 |
|
|
mv "${D}/usr/share/doc/xapian-bindings" "${D}/usr/share/doc/${PF}" |
| 158 |
|
|
fi |
| 159 |
|
|
|
| 160 |
|
|
dodoc AUTHORS HACKING NEWS TODO README || die "dodoc failed" |
| 161 |
|
|
} |
| 162 |
|
|
|
| 163 |
|
|
pkg_postinst() { |
| 164 |
|
|
if use python; then |
| 165 |
|
|
python_mod_optimize xapian |
| 166 |
|
|
fi |
| 167 |
|
|
} |
| 168 |
|
|
|
| 169 |
|
|
pkg_postrm() { |
| 170 |
|
|
if use python; then |
| 171 |
|
|
python_mod_cleanup xapian |
| 172 |
|
|
fi |
| 173 |
|
|
} |