SUMMARY="Web-centric format for distributing documents and images"
DESCRIPTION="
DjVu is a web-centric format and software platform for distributing documents \
and images.
"
HOMEPAGE="http://djvulibre.sourceforge.net/"
LICENSE="GNU GPL v2"
COPYRIGHT="2002  Leon Bottou and Yann Le Cun.
	2001  AT&T
	1999-2001 LizardTech, Inc."
SRC_URI="http://downloads.sourceforge.net/project/djvu/DjVuLibre/3.5.25/djvulibre-3.5.25.2.tar.gz"
CHECKSUM_SHA256="619becf24cf2b9289d5102a19bb81424f68008f90ded841085f07c32e5d48158"
REVISION="1"
ARCHITECTURES="x86 x86_64"
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"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	djvulibre$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:any2djvu$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:bzz$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:c44$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:cjb2$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:cpaldjvu$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:csepdjvu$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:ddjvu$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvm$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvmcvt$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvudigital$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvudump$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvuextract$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvumake$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvups$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvused$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvuserve$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvutoxml$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvutxt$secondaryArchSuffix = $portVersion compat >= 3.5
	cmd:djvuxmlparser$secondaryArchSuffix = $portVersion compat >= 3.5
	lib:libdjvulibre$secondaryArchSuffix = $portVersion compat >= 3.5
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libjpeg$secondaryArchSuffix
	"
# haiku_x86 doesn't claim to provide lib:libtiff_x86 on gcc2 builds
if [ "$targetArchitecture" != x86_gcc2 ];then
    REQUIRES="$REQUIRES lib:libtiff$secondaryArchSuffix"
fi

BUILD_REQUIRES="
	devel:libjpeg$secondaryArchSuffix
	"
#needs devel:libtiff too but that isn't provided by anything

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	cmd:make
	cmd:gcc$secondaryArchSuffix
	cmd:aclocal
	cmd:autoconf
	cmd:libtoolize
	cmd:libtool
	"

PROVIDES_devel="
	djvulibre${secondaryArchSuffix}_devel = $portVersion compat >= 3.5
	devel:libdjvulibre$secondaryArchSuffix = $portVersion compat >= 3.5
	"

REQUIRES_devel="
	djvulibre$secondaryArchSuffix == $portVersion
	"

SOURCE_DIR="djvulibre-3.5.25"

PATCHES="djvulibre-3.5.25.patch"

BUILD()
{
	aclocal
	libtoolize -fci
	autoconf
	runConfigure ./configure
	make
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libdjvulibre

	fixPkgconfig

	packageEntries devel $developDir
}
