SUMMARY="An open-source, C++ search engine"
DESCRIPTION="CLucene is a high-performance, scalable, cross platform, \
full-featured, open-source indexing and searching API. Specifically, CLucene \
is the guts of a search engine, the hard stuff. You write the easy stuff: the \
UI and the process of selecting and parsing your data files to pump them into \
the search engine yourself, and any specialized queries to pull it back for \
display or further processing.

CLucene is a port of the very popular Java Lucene text search engine API. \
CLucene aims to be a good alternative to Java Lucene when performance really \
matters or if you want to stick to good old C++. CLucene is faster than Lucene \
as it is written in C++, meaning it is being compiled into machine code, has \
no background GC operations, and requires no any extra setup procedures.

Being written in pure cross-platform C++ code, and utilizing the flexible \
CMake build system, CLucene can virtually be used for any purpose, on any \
machine. From PCs running Windows or Linux to Mobile devices. The sky is the \
limit."
HOMEPAGE="http://clucene.sourceforge.net/"
COPYRIGHT="2003-2006 Ben van Klinken
	2003-2006 CLucene Team
	2003-2006 Jos van den Oever"
LICENSE="Apache v2"
REVISION="4"
SOURCE_URI="http://downloads.sourceforge.net/clucene/clucene-core-$portVersion.tar.gz"
CHECKSUM_SHA256="ddfdc433dd8ad31b5c5819cc4404a8d2127472a3b720d3e744e8c51d79732eab"
SOURCE_DIR="clucene-core-$portVersion"
PATCHES="clucene-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	clucene$secondaryArchSuffix = $portVersion
	lib:libclucene_contribs_lib$secondaryArchSuffix = $portVersion
	lib:libclucene_core$secondaryArchSuffix = $portVersion
	lib:libclucene_shared$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	clucene${secondaryArchSuffix}_devel = $portVersion
	devel:libclucene_contribs_lib$secondaryArchSuffix = $portVersion
	devel:libclucene_core$secondaryArchSuffix = $portVersion
	devel:libclucene_shared$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	clucene$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_atomic$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	mkdir -p build && cd build
	cmake -G "Unix Makefiles" .. \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DCMAKE_BUILD_TYPE=Release \
		-DLIB_DESTINATION:PATH=$libDir \
		-DLUCENE_SYS_INCLUDES:PATH=$relativeIncludeDir \
		-DBUILD_CONTRIBS_LIB:BOOL=ON \
		-DDISABLE_MULTITHREADING=OFF
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	rm -rf $libDir/CLuceneConfig.cmake

	mv $prefix/lib $prefix/lib2
	mkdir -p $(dirname $libDir)
	mv $prefix/lib2 $libDir

	prepareInstalledDevelLibs libclucene-core libclucene-shared \
		libclucene-contribs-lib
	fixPkgconfig

	packageEntries devel \
		$developDir
}
