SUMMARY="A PDF library that is part of MuPDF"
DESCRIPTION="
Fitz is a library that is part of MuPDF. The renderer in MuPDF is tailored for \
high quality anti-aliased graphics. It renders text with metrics and spacing \
accurate to within fractions of a pixel for the highest fidelity in \
reproducing the look of a printed page on screen.
"
HOMEPAGE="http://code.google.com/p/mupdf/"
LICENSE="GNU GPL v3"
COPYRIGHT="2007 Free Software Foundation, Inc."
SRC_URI="http://mupdf.googlecode.com/files/mupdf-1.1-source.tar.gz"
CHECKSUM_MD5="f7b5fd753f40aca207e9afd70d8f8edf"
REVISION="1"
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"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"


PROVIDES="
	fitz$secondaryArchSuffix = $portVersion compat >= 1.1
	lib:libfitz = $portVersion compat >= 1.1
	devel:libfitz$secondaryArchSuffix = $portVersion compat >= 1.1
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libjpeg$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libopenjpeg$secondaryArchSuffix
	lib:libjbig2dec$secondaryArchSuffix
	"

BUILD_REQUIRES="
	devel:libopenjpeg$secondaryArchSuffix
	devel:libjbig2dec$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	cmd:make
	cmd:gcc$secondaryArchSuffix
	"

SOURCE_DIR="mupdf-1.1-source"

PATCHES="fitz-1.1.patchset"

BUILD()
{
	# work around broken header layout in our freetype_devel package
	XCFLAGS="-I/boot/system/develop/headers/freetype2" \
	make libs
}

INSTALL()
{
	make install-libs \
		prefix=$prefix \
		bindir=$binDir \
		libdir=$libDir \
		incdir=$includeDir \
		mandir=$manDir

	prepareInstalledDevelLibs libfitz
}
