SUMMARY="Convert ebook file formats"
DESCRIPTION="Tools for accessing and converting various ebook file formats"
HOMEPAGE="https://sourceforge.net/projects/ebook-tools/"
COPYRIGHT="2008 Ely Levy"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://sourceforge.net/projects/ebook-tools/files/ebook-tools/0.2.2/ebook-tools-0.2.2.tar.gz"
CHECKSUM_SHA256="cbc35996e911144fa62925366ad6a6212d6af2588f1e39075954973bbee627ae"
SOURCE_DIR="ebook-tools-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	ebook_tools$secondaryArchSuffix = $portVersion
	cmd:einfo$secondaryArchSuffix
	cmd:lit2epub$secondaryArchSuffix
	lib:libepub$secondaryArchSuffix = 0.2.1 compat >= 0.2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libzip$secondaryArchSuffix
	"

PROVIDES_devel="
	ebook_tools${secondaryArchSuffix}_devel
	devel:libepub$secondaryArchSuffix = 0.2.1 compat >= 0.2
	"
REQUIRES_devel="
	ebook_tools$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libxml2$secondaryArchSuffix
	devel:libzip$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	sed -i 's/-Wmissing-format-attribute//' CMakeLists.txt
	cmake -DCMAKE_INSTALL_PREFIX=$prefix
	make
}

INSTALL()
{
	mkdir -p $binDir $libDir $includeDir

	cp bin/einfo $binDir
	cp src/tools/lit2epub $binDir
	cp libs/* $libDir
	cp src/libepub/*.h $includeDir

	prepareInstalledDevelLib libepub

	packageEntries devel \
		$developDir
}
