| 1 |
# Copyright 1999-2013 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.12-r1.ebuild,v 1.8 2013/02/12 16:56:59 ago Exp $
|
| 4 |
|
| 5 |
EAPI="4"
|
| 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="~alpha amd64 arm ~ia64 ~mips ppc ppc64 ~sparc x86"
|
| 25 |
IUSE="java lua mono perl php python ruby tcl"
|
| 26 |
REQUIRED_USE="|| ( java lua mono perl php python ruby tcl )"
|
| 27 |
|
| 28 |
COMMONDEPEND="=dev-libs/xapian-${PV}*
|
| 29 |
lua? ( >=dev-lang/lua-5.1 )
|
| 30 |
mono? ( >=dev-lang/mono-1.0.8 )
|
| 31 |
perl? ( dev-lang/perl )
|
| 32 |
ruby? ( dev-lang/ruby )
|
| 33 |
tcl? ( >=dev-lang/tcl-8.1 )"
|
| 34 |
DEPEND="${COMMONDEPEND}
|
| 35 |
java? ( >=virtual/jdk-1.3 )"
|
| 36 |
RDEPEND="${COMMONDEPEND}
|
| 37 |
java? ( >=virtual/jre-1.3 )"
|
| 38 |
|
| 39 |
pkg_setup() {
|
| 40 |
java-pkg-opt-2_pkg_setup
|
| 41 |
|
| 42 |
if use python; then
|
| 43 |
python_pkg_setup
|
| 44 |
fi
|
| 45 |
}
|
| 46 |
|
| 47 |
src_prepare() {
|
| 48 |
java-pkg-opt-2_src_prepare
|
| 49 |
if use java; then
|
| 50 |
sed \
|
| 51 |
-e 's/$(JAVAC)/$(JAVAC) $(JAVACFLAGS)/' \
|
| 52 |
-i java{/,/org/xapian/errors/,/org/xapian/}Makefile.in || die "sed failed"
|
| 53 |
fi
|
| 54 |
|
| 55 |
if use python; then
|
| 56 |
sed \
|
| 57 |
-e 's:\(^pkgpylib_DATA = xapian/__init__.py\).*:\1:' \
|
| 58 |
-e 's|\(^xapian/__init__.py: modern/xapian.py\)|\1 xapian/_xapian$(PYTHON_SO)|' \
|
| 59 |
-i python/Makefile.in || die "sed failed"
|
| 60 |
fi
|
| 61 |
}
|
| 62 |
|
| 63 |
src_configure() {
|
| 64 |
if use java; then
|
| 65 |
CXXFLAGS="${CXXFLAGS} $(java-pkg_get-jni-cflags)"
|
| 66 |
fi
|
| 67 |
|
| 68 |
if use perl; then
|
| 69 |
export PERL_ARCH="$(perl -MConfig -e 'print $Config{installvendorarch}')"
|
| 70 |
export PERL_LIB="$(perl -MConfig -e 'print $Config{installvendorlib}')"
|
| 71 |
fi
|
| 72 |
|
| 73 |
if use lua; then
|
| 74 |
export LUA_LIB="$(pkg-config --variable=INSTALL_CMOD lua)"
|
| 75 |
fi
|
| 76 |
|
| 77 |
econf \
|
| 78 |
$(use_with java) \
|
| 79 |
$(use_with lua) \
|
| 80 |
$(use_with mono csharp) \
|
| 81 |
$(use_with perl) \
|
| 82 |
$(use_with php) \
|
| 83 |
$(use_with python) \
|
| 84 |
$(use_with ruby) \
|
| 85 |
$(use_with tcl)
|
| 86 |
|
| 87 |
# Python bindings are built/tested/installed manually.
|
| 88 |
sed -e "/SUBDIRS =/s/ python//" -i Makefile || die "sed Makefile"
|
| 89 |
}
|
| 90 |
|
| 91 |
src_compile() {
|
| 92 |
default
|
| 93 |
|
| 94 |
if use python; then
|
| 95 |
python_copy_sources python
|
| 96 |
building() {
|
| 97 |
emake \
|
| 98 |
PYTHON="$(PYTHON)" \
|
| 99 |
PYTHON_INC="$(python_get_includedir)" \
|
| 100 |
PYTHON_LIB="$(python_get_libdir)" \
|
| 101 |
PYTHON_SO="$("$(PYTHON)" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_vars("SO")[0])')" \
|
| 102 |
pkgpylibdir="$(python_get_sitedir)/xapian"
|
| 103 |
}
|
| 104 |
python_execute_function -s --source-dir python building
|
| 105 |
fi
|
| 106 |
}
|
| 107 |
|
| 108 |
src_test() {
|
| 109 |
default
|
| 110 |
|
| 111 |
if use python; then
|
| 112 |
testing() {
|
| 113 |
emake \
|
| 114 |
PYTHON="$(PYTHON)" \
|
| 115 |
PYTHON_INC="$(python_get_includedir)" \
|
| 116 |
PYTHON_LIB="$(python_get_libdir)" \
|
| 117 |
PYTHON_SO="$("$(PYTHON)" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_vars("SO")[0])')" \
|
| 118 |
pkgpylibdir="$(python_get_sitedir)/xapian" \
|
| 119 |
VERBOSE="1" \
|
| 120 |
check
|
| 121 |
}
|
| 122 |
python_execute_function -s --source-dir python testing
|
| 123 |
fi
|
| 124 |
}
|
| 125 |
|
| 126 |
src_install () {
|
| 127 |
emake DESTDIR="${D}" install || die "emake install failed"
|
| 128 |
|
| 129 |
if use java; then
|
| 130 |
java-pkg_dojar java/built/xapian_jni.jar
|
| 131 |
# TODO: make the build system not install this...
|
| 132 |
java-pkg_doso "${D}/${S}/java/built/libxapian_jni.so"
|
| 133 |
rm "${D}/${S}/java/built/libxapian_jni.so"
|
| 134 |
rmdir -p "${D}/${S}/java/built"
|
| 135 |
rmdir -p "${D}/${S}/java/native"
|
| 136 |
fi
|
| 137 |
|
| 138 |
if use python; then
|
| 139 |
installation() {
|
| 140 |
emake \
|
| 141 |
DESTDIR="${D}" \
|
| 142 |
PYTHON="$(PYTHON)" \
|
| 143 |
PYTHON_INC="$(python_get_includedir)" \
|
| 144 |
PYTHON_LIB="$(python_get_libdir)" \
|
| 145 |
PYTHON_SO="$("$(PYTHON)" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_vars("SO")[0])')" \
|
| 146 |
pkgpylibdir="$(python_get_sitedir)/xapian" \
|
| 147 |
install
|
| 148 |
}
|
| 149 |
python_execute_function -s --source-dir python installation
|
| 150 |
fi
|
| 151 |
|
| 152 |
if use php; then
|
| 153 |
php-ext-source-r2_createinifiles
|
| 154 |
fi
|
| 155 |
|
| 156 |
# For some USE combinations this directory is not created
|
| 157 |
if [[ -d "${D}/usr/share/doc/xapian-bindings" ]]; then
|
| 158 |
mv "${D}/usr/share/doc/xapian-bindings" "${D}/usr/share/doc/${PF}"
|
| 159 |
fi
|
| 160 |
|
| 161 |
dodoc AUTHORS HACKING NEWS TODO README || die "dodoc failed"
|
| 162 |
}
|
| 163 |
|
| 164 |
pkg_postinst() {
|
| 165 |
if use python; then
|
| 166 |
python_mod_optimize xapian
|
| 167 |
fi
|
| 168 |
}
|
| 169 |
|
| 170 |
pkg_postrm() {
|
| 171 |
if use python; then
|
| 172 |
python_mod_cleanup xapian
|
| 173 |
fi
|
| 174 |
}
|