# Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header$ NEED_PYTHON=2.5 JAVA_PKG_IUSE="source" inherit eutils versionator python distutils java-osgi java-pkg-2 java-ant-2 # Note: as this package uses a Makefile we couldn't use on gentoo. Thus we've # had to recreate it within the ebuild. Though distutils standard functions are # not used here, note that setuptools *is* used within JCC to build and install. MY_PN="PyLucene" MY_PV="$(replace_version_separator 3 '-')" MY_P=${MY_PN}-${MY_PV} LUCENE_PV="$(get_version_component_range 1-3)" S="${WORKDIR}/${MY_P}" DESCRIPTION="Python bindings od Lucene search engine" HOMEPAGE="http://pylucene.osafoundation.org/" SRC_URI="http://downloads.osafoundation.org/PyLucene/jcc/${MY_PN}-${MY_PV}-src-jcc.tar.gz" RESTRICT="mirror" LICENSE="Apache-2.0" SLOT="2.4" KEYWORDS="~x86" IUSE="debug jakarta" # FIXME test and samples useflag needed to finish replacing Makefile use jakarta && JAKARTA="$(java-pkg_get-jar lucene-regex-${SLOT} jakarta-regexp.jar)" # FIXME I just found the following for slot 2.3 (all use an interesting # lucene-contrib eclass) at: # https://overlays.gentoo.org/svn/proj/java/java-experimental/dev-java/ # dev-java/lucene-analyzers # dev-java/lucene-highlighter # dev-java/lucene-queries # dev-java/lucene-regex # # Missing: # dev-java/lucene-instantiated # dev-java/lucene-snowball COMMON_DEPEND="~dev-java/lucene-${LUCENE_PV} =dev-java/lucene-analyzers-${SLOT}* =dev-java/lucene-snowball-${SLOT}* =dev-java/lucene-highlighter-${SLOT}* =dev-java/lucene-regex-${SLOT}*[jakarta=] =dev-java/lucene-queries-${SLOT}* =dev-java/lucene-instantiated-${SLOT}*" DEPEND=">=virtual/jdk-1.4 dev-java/ant-core dev-python/pylucene-jcc ${COMMON_DEPEND}" RDEPEND=">=virtual/jre-1.4 ${COMMON_DEPEND}" EANT_GENTOO_CLASSPATH="lucene-${SLOT},\ lucene-analyzers-${SLOT},\ lucene-snowball-${SLOT},\ lucene-highlighter-${SLOT},\ lucene-regex-${SLOT},\ lucene-queries-${SLOT},\ lucene-instantiated-${SLOT}" NUM_FILES=2 GENERATE="${python} -m jcc --jar lucene-core.jar \ --jar lucene-analyzers.jar \ --jar lucene-snowball.jar \ --jar lucene-highlighter.jar \ --jar lucene-regex.jar \ --jar lucene-queries.jar \ --jar lucene-instantiated.jar \ --jar extensions.jar \ --package java.lang java.lang.System java.lang.Runtime \ --package java.util java.text.SimpleDateFormat \ --package java.io java.io.StringReader java.io.InputStreamReader java.io.FileInputStream \ --exclude org.apache.lucene.queryParser.Token \ --exclude org.apache.lucene.queryParser.TokenMgrError \ --exclude org.apache.lucene.queryParser.QueryParserTokenManager \ --exclude org.apache.lucene.queryParser.ParseException \ --python lucene \ --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' \ --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' \ --sequence org.apache.lucene.search.Hits 'length:()I' 'doc:(I)Lorg/apache/lucene/document/Document;' \ --version ${LUCENE_PV} \ --files ${NUM_FILES}" if use debug; then DEBUG_OPT="--debug" fi src_unpack() { unpack ${A} cd ${S} java-ant_xml-rewrite -f build.xml --delete \ -e javac -a classpathref java-ant_rewrite-classpath } src_compile() { cd ${S} # This creates extensions.jar java-pkg-2_src_compile -Dversion=${MY_PV} || die "Compile failed" java-pkg_jar-from ${EANT_GENTOO_CLASSPATH} ln -s build/jar/extensions.jar extensions.jar # We need to know if lucene-regex was built with it's jakarta files if use jakarta; then BUILD_OPTS="--classpath ${JAKARTA}" fi #BUILD_CLASSPATH="$(java-pkg_getjars ${EANT_GENTOO_CLASSPATH}):${S}/extensions.jar" #BUILD_OPTS="--classpath ${BUILD_CLASSPATH}" ${GENERATE} --build ${DEBUG_OPT} ${BUILD_OPTS}\ || die "JCC could not build the PyLucene wrappers" # TODO once setuptools has the shared library patch, JCC should use the # --shared flag #${GENERATE} --build --shared ${DEBUG_OPT} || die "JCC build failed" } src_install() { java-osgi_newjar-fromfile "${S}/extensions.jar" \ "${FILESDIR}/manifest" "Apache PyLucene Extensions" DOCS="CHANGES CREDITS INSTALL" # We need to know if lucene-regex was built with it's jakarta files if use jakarta; then INSTALL_OPTS="--classpath ${JAKARTA}" fi #INSTALL_CLASSPATH="$(java-pkg_getjars ${EANT_GENTOO_CLASSPATH}):${D}/usr/share/${PN}-${SLOT}/lib/extensions.jar" #INSTALL_OPTS="--classpath ${INSTLL_CLASSPATH}" INSTALL_OPTS="${INSTALL_OPTS} --root ${D}" ${GENERATE} --install ${DEBUG_OPT} ${INSTALL_OPTS}\ || die "JCC could not install the PyLucene wrappers." # FIXME What about the python sources? are there C sources? use source && java-pkg_dosrc "${S}/java/org" } pkg_postinst() { distutils_pkg_postinst } pkg_postrm() { distutils_pkg_postrm }