SUMMARY="A Desktop search daemon"
DESCRIPTION="Strigi is a desktop search daemon, which is operating \
system-independent and desktop-independent. Strigi's goals are to be fast, \
use a small amount of RAM, and use flexible backends and plug-ins. Like most \
desktop search systems, Strigi can extract information from files, such as \
the length of an audio clip, the contents of a document, or the resolution \
of a picture; plugins determine what filetypes it is capable of handling.
"
HOMEPAGE="http://strigi.sourceforge.net"
SOURCE_URI="http://downloads.sourceforge.net/project/strigi/strigi/strigi-0.7.5.tar.bz2"
CHECKSUM_SHA256="111f5e3ede171292302b906418af0175445ca01958d40fb54879f80620b5189b"
REVISION="2"
LICENSE="GNU LGPL v2.1"
COPYRIGHT="2011 Jos van den Oever"
ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi

SECONDARY_ARCHITECTURES="x86"

PATCHES="strigi-0.7.5.patch"

PROVIDES="
	strigi${secondaryArchSuffix} = $portVersion
	lib:libstreamanalyzer$secondaryArchSuffix = $portVersion
	lib:libstreams$secondaryArchSuffix = $portVersion
	lib:libsearchclient$secondaryArchSuffix = $portVersion
	lib:libstrigihtmlgui$secondaryArchSuffix = $portVersion
	cmd:deepfind
	cmd:deepgrep
	cmd:rdfindexer
	cmd:strigicmd
	cmd:strigidaemon
	cmd:xmlindexer
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	lib:libz$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	cmd:perl
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:pkg_config$secondaryArchSuffix
	cmd:perl
	cmd:make
	cmd:g++${secondaryArchSuffix}
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libz$secondaryArchSuffix
	devel:libbz2$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
PROVIDES_devel="
	strigi${secondaryArchSuffix}_devel = $portVersion
	devel:libstreamanalyzer$secondaryArchSuffix = $portVersion
	devel:libstreams$secondaryArchSuffix = $portVersion
	devel:libsearchclient$secondaryArchSuffix = $portVersion
	devel:libstrigihtmlgui$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	haiku${secondaryArchSuffix}_devel
	strigi${secondaryArchSuffix} == $portVersion base
	"

BUILD()
{		
	cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE=Release \
		-DENABLE_DBUS=off
	make $jobArgs
}

INSTALL()
{
	make install
		
	# Clean up after CMake
	mkdir -p $includeDir
	mkdir -p $libDir
	
	mkdir -p $developLibDir/pkgconfig/
	mv -f $prefix/lib/pkgconfig/* $developLibDir/pkgconfig/
	rm -rf $prefix/lib/pkgconfig/
	
	mv -f $prefix/lib/*.so* $libDir
	cp -rf $prefix/include/* $includeDir/
	rm -rf $prefix/include/
	
	mkdir -p $dataDir/cmake/Modules/
	mv $prefix/lib/libsearchclient/LibSearchClientConfig.cmake \
		$dataDir/cmake/Modules/
	mv $prefix/lib/libstreamanalyzer/LibStreamAnalyzerConfig.cmake \
		$dataDir/cmake/Modules/
	mv $prefix/lib/libstreams/LibStreamsConfig.cmake \
		$dataDir/cmake/Modules/
	mv $prefix/lib/strigi/StrigiConfig.cmake \
		$dataDir/cmake/Modules/
	rm -rf $prefix/lib/libsearchclient/
	rm -rf $prefix/lib/libstreamanalyzer/
	rm -rf $prefix/lib/libstreams/
	
	prepareInstalledDevelLibs \
		libstreamanalyzer \
		libstreams \
		libsearchclient \
		libstrigihtmlgui
	packageEntries devel \
		$developDir \
		$dataDir
}
