SUMMARY="A websearch proxy and collaborative distributed tool "
DESCRIPTION="An Open Decentralized Platform for Collaborative Search, \
Filtering and content Curation."
HOMEPAGE="http://www.seeks-project.info/"
COPYRIGHT="2006, 2009, 2010 Emmanuel Benazera
	Camille Harang
	Mehdi Abaakouk
	Pablo Joubert
	Laurent Peuch
	Stéphane Bonhomme
	Francois Revol"
LICENSE="GNU AGPL v3"
REVISION="2"
SOURCE_URI="https://sf.net/projects/seeks/files/hippy/seeks-$portVersion.tar.gz"
CHECKSUM_SHA256="b890f2e95ab0161e0be6f82cfc224f9cf6e49ce69d18bf3decddb91fb85cebde"
PATCHES="seeks-$portVersion.patchset"

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

GLOBAL_WRITABLE_FILES="
	settings/seeks/config keep-old
	settings/seeks/img-websearch-config keep-old
	settings/seeks/lsh-config keep-old
	settings/seeks/websearch-config keep-old
	"

PROVIDES="
	seeks$secondaryArchSuffix = $portVersion
	cmd:gen_mrf_query_160$secondaryArchSuffix
	cmd:seeks$secondaryArchSuffix
	cmd:seeks_cli$secondaryArchSuffix
	cmd:test_readable$secondaryArchSuffix
	lib:libreadableplugin$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:librmd160$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libseeksdht$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libseeksimgwebsearchplugin$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libseekslsh$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libseeksplugins$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libseeksproxy$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libseeksutils$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libseekswebsearchapicompatplugin$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libseekswebsearchplugin$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libevent$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libpcre$secondaryArchSuffix
	lib:libreadableplugin$secondaryArchSuffix #for internal bin files
	lib:libseeksimgwebsearchplugin$secondaryArchSuffix #for internal bin files
	lib:libseekswebsearchapicompatplugin$secondaryArchSuffix #for internal bin files
	lib:libseekswebsearchplugin$secondaryArchSuffix #for internal bin files
	lib:libssl$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	seeks${secondaryArchSuffix}_devel = $portVersion
	devel:librmd160$secondaryArchSuffix = 0.0.0 compat >= 0
	devel:libseeksdht$secondaryArchSuffix = 0.0.0 compat >= 0
	devel:libseekslsh$secondaryArchSuffix = 0.0.0 compat >= 0
	devel:libseeksplugins$secondaryArchSuffix = 0.0.0 compat >= 0
	devel:libseeksproxy$secondaryArchSuffix = 0.0.0 compat >= 0
	devel:libseeksutils$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	seeks$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcurl$secondaryArchSuffix
	devel:libevent$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libpcre$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	export CFLAGS="-D_BSD_SOURCE"
	export LDFLAGS="-lbsd -liconv"
	export CXXLAGS="-D_BSD_SOURCE"

	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/*.la
	rm $libDir/seeks/plugins/*/*.la

	prepareInstalledDevelLibs librmd160 libseeksdht \
		libseekslsh libseeksplugins \
		libseeksproxy libseeksutils
	fixPkgconfig

	packageEntries devel \
		$developDir
}
