SUMMARY="A PDF viewer" 
DESCRIPTION="
BePDF is a PDF viewer for the BeOS, Haiku & Zeta.
Besides viewing, it supports annotating and user-defined bookmarking for \
unencrypted PDFs. It's fully localized for 20 languages at the moment with \
additional languages being easily added via text files.
"
HOMEPAGE="http://bepdf.sourceforge.net/" 
SRC_URI="cvs://:pserver:anonymous@bepdf.cvs.sourceforge.net:/cvsroot/bepdf/BePDF#04/28/13"
COPYRIGHT="
	1997 Benoit Triquet
	1999-2000 Hubert Figuiere
	2000-2010 Michael Pfeiffer"
LICENSE="GNU GPL v2"
REVISION="2"
ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	bepdf = $portVersion
	app:BePDF = $portVersion
	"

REQUIRES="
	haiku >= $haikuVersion
	lib:liblayout
	"

BUILD_REQUIRES="
	haiku_devel >= $haikuVersion
	devel:liblayout
	"

BUILD_PREREQUIRES="
	cmd:gcc
	cmd:jam
	cmd:htmldoc
	cmd:ld
	cmd:sed
	"

PATCHES="bepdf-1.1.1~beta5_2013_04_28.patchset"

PATCH()
{
	if [ "$targetArchitecture" = x86 ];then
		sed -i 's/stdc++.r4/stdc++/' bepdf/Jamfile
	fi
}

BUILD()
{
	if [ $targetArchitecture == 'x86_gcc2' ]; then
		export BEPDF_BUILD_GCC=gcc2
	else
		export BEPDF_BUILD_GCC=gcc4
	fi
	
	./build.sh
}

INSTALL()
{
	bepdfArch=$targetArchitecture
	if [ $bepdfArch == 'x86_gcc2' ]; then
		bepdfArch='x86'
	fi
	mkdir -p $appsDir
	rm -f generated/$bepdfArch/*Deskbar
	rm -rf generated/$bepdfArch/lib
	cp -dR generated/$bepdfArch $appsDir/BePDF

	addAppDeskbarSymlink $appsDir/BePDF/BePDF
}
