SUMMARY="C/C++ library for PDF generation"
DESCRIPTION="
Haru is a free, cross platform, open-sourced software library for generating \
PDF. It supports the following features.
   1. Generating PDF files with lines, text, images.
   2. Outline, text annotation, link annotation.
   3. Compressing document with deflate-decode.
   4. Embedding PNG, Jpeg images.
   5. Embedding Type1 font and TrueType font.
   6. Creating encrypted PDF files.
   7. Using various character set (ISO8859-1~16, MSCP1250~8, KOI8-R).
   8. Supporting CJK fonts and encodings.
"
HOMEPAGE="http://www.libharu.org/"
COPYRIGHT="
	2000-2006 Takeshi Kanno
	2007-2009 Antony Dovgal et al.
	"
LICENSE="Zlib"
SRC_URI="https://github.com/libharu/libharu/archive/RELEASE_2_3_0.tar.gz"
SRC_FILENAME="libharu-2.3.0.tar.gz"
CHECKSUM_SHA256="8f9e68cc5d5f7d53d1bc61a1ed876add1faf4f91070dbc360d8b259f46d9a4d2"
REVISION="1"
ARCHITECTURES="x86_gcc2 x86 ?x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PATCHES="libharu-$portVersion.patchset"

PROVIDES="
	libharu$secondaryArchSuffix = $portVersion compat >= 2
	lib:libhpdf$secondaryArchSuffix = 2.3.0 compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libpng$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	devel:libpng$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

SOURCE_DIR="libharu-RELEASE_2_3_0"

BUILD()
{
	rm -rf build
	mkdir build 
	cd build
	
	cmake -DCMAKE_INSTALL_PREFIX=$prefix ..
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
	
	mv $libDir/libhpdfs.a $libDir/libhpdf.a
	mv $libDir/libhpdf.so $libDir/libhpdf.so.2.3
	ln -s libhpdf.so.2.3 $libDir/libhpdf.so
	prepareInstalledDevelLibs libhpdf

	# devel package
	packageEntries devel \
		$developDir
}

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	libharu${secondaryArchSuffix}_devel = $portVersion compat >= 2
	devel:libhpdf$secondaryArchSuffix = 2.3.0 compat >= 2
	"
REQUIRES_devel="
	libharu$secondaryArchSuffix == $portVersion base
	"
