SUMMARY="A C library for image processing and analysis operations"
DESCRIPTION="
A powerful open source C library for efficient image processing \
and image analysis operations. It's long list of features includes:
* image transformations (scaling, rotation, etc.)
* change scale and pixel depth
* pixelwise masking, blending, and enhancement
* can open and save standard image formats
"
HOMEPAGE="http://code.google.com/p/leptonica"
SRC_URI="http://www.leptonica.org/source/leptonica-1.69.tar.gz"
CHECKSUM_SHA256="3eb7669dcda7e417f399bb3698414ea523270797dfd36c59b08ef37a3fe0a72d"
LICENSE="BSD (2-clause)"
COPYRIGHT="2001-2012 Dan Bloomberg"
REVISION="1"
ARCHITECTURES="x86 x86_64"
SECONDARY_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"
fi

PROVIDES="
	leptonica$secondaryArchSuffix = $portVersion
	lib:leptonica$secondaryArchSuffix = 3.0.0
	lib:liblept$secondaryArchSuffix = 3.0.0
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libgif$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	devel:libgif$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libwebp$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:ar$secondaryArchSuffix
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:makeinfo
	"

PATCHES="
	giflib6.patch
	leptonica-1.69.patch
	"

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	autoconf
	automake -a
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
	prepareInstalledDevelLibs liblept

	packageEntries devel \
				$developDir

	packageEntries tools \
				$binDir
}

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

PROVIDES_devel="
	leptonica${secondaryArchSuffix}_devel = $portVersion
	devel:leptonica$secondaryArchSuffix = 3.0.0
	devel:liblept$secondaryArchSuffix = 3.0.0
	"

REQUIRES_devel="
	haiku$secondaryArchSuffix >= $haikuVersion
	leptonica$secondaryArchSuffix == $portVersion base
	"

# ----- tools package -------------------------------------------------------

PROVIDES_tools="
	leptonica${secondaryArchSuffix}_tools = $portVersion
	cmd:adaptmaptest$secondaryArchSuffix = $portVersion
	cmd:adaptnorm_reg$secondaryArchSuffix = $portVersion
	cmd:affine_reg$secondaryArchSuffix = $portVersion
	cmd:alltests_reg$secondaryArchSuffix = $portVersion
	cmd:alphaops_reg$secondaryArchSuffix = $portVersion
	cmd:alphaxform_reg$secondaryArchSuffix = $portVersion
	cmd:arithtest$secondaryArchSuffix = $portVersion
	cmd:barcodetest$secondaryArchSuffix = $portVersion
	cmd:baselinetest$secondaryArchSuffix = $portVersion
	cmd:bilinear_reg$secondaryArchSuffix = $portVersion
	cmd:binarize_reg$secondaryArchSuffix = $portVersion
	cmd:bincompare$secondaryArchSuffix = $portVersion
	cmd:binmorph1_reg$secondaryArchSuffix = $portVersion
	cmd:binmorph2_reg$secondaryArchSuffix = $portVersion
	cmd:binmorph3_reg$secondaryArchSuffix = $portVersion
	cmd:binmorph4_reg$secondaryArchSuffix = $portVersion
	cmd:binmorph5_reg$secondaryArchSuffix = $portVersion
	cmd:blend_reg$secondaryArchSuffix = $portVersion
	cmd:blend2_reg$secondaryArchSuffix = $portVersion
	cmd:blendcmaptest$secondaryArchSuffix = $portVersion
	cmd:blendtest1$secondaryArchSuffix = $portVersion
	cmd:buffertest$secondaryArchSuffix = $portVersion
	cmd:byteatest$secondaryArchSuffix = $portVersion
	cmd:ccbordtest$secondaryArchSuffix = $portVersion
	cmd:cctest1$secondaryArchSuffix = $portVersion
	cmd:ccthin1_reg$secondaryArchSuffix = $portVersion
	cmd:ccthin2_reg$secondaryArchSuffix = $portVersion
	cmd:cmapquant_reg$secondaryArchSuffix = $portVersion
	cmd:coloring_reg$secondaryArchSuffix = $portVersion
	cmd:colormask_reg$secondaryArchSuffix = $portVersion
	cmd:colormorphtest$secondaryArchSuffix = $portVersion
	cmd:colorquant_reg$secondaryArchSuffix = $portVersion
	cmd:colorseg_reg$secondaryArchSuffix = $portVersion
	cmd:colorsegtest$secondaryArchSuffix = $portVersion
	cmd:colorspacetest$secondaryArchSuffix = $portVersion
	cmd:compare_reg$secondaryArchSuffix = $portVersion
	cmd:comparepages$secondaryArchSuffix = $portVersion
	cmd:comparetest$secondaryArchSuffix = $portVersion
	cmd:compfilter_reg$secondaryArchSuffix = $portVersion
	cmd:conncomp_reg$secondaryArchSuffix = $portVersion
	cmd:contrasttest$secondaryArchSuffix = $portVersion
	cmd:conversion_reg$secondaryArchSuffix = $portVersion
	cmd:convertfilestopdf$secondaryArchSuffix = $portVersion
	cmd:convertfilestops$secondaryArchSuffix = $portVersion
	cmd:convertformat$secondaryArchSuffix = $portVersion
	cmd:convertsegfilestopdf$secondaryArchSuffix = $portVersion
	cmd:convertsegfilestops$secondaryArchSuffix = $portVersion
	cmd:converttogray$secondaryArchSuffix = $portVersion
	cmd:converttops$secondaryArchSuffix = $portVersion
	cmd:convolve_reg$secondaryArchSuffix = $portVersion
	cmd:convolvetest$secondaryArchSuffix = $portVersion
	cmd:cornertest$secondaryArchSuffix = $portVersion
	cmd:croptext$secondaryArchSuffix = $portVersion
	cmd:dewarp_reg$secondaryArchSuffix = $portVersion
	cmd:dewarptest1$secondaryArchSuffix = $portVersion
	cmd:dewarptest2$secondaryArchSuffix = $portVersion
	cmd:dewarptest3$secondaryArchSuffix = $portVersion
	cmd:digitprep1$secondaryArchSuffix = $portVersion
	cmd:distance_reg$secondaryArchSuffix = $portVersion
	cmd:dithertest$secondaryArchSuffix = $portVersion
	cmd:dna_reg$secondaryArchSuffix = $portVersion
	cmd:dwalineargen$secondaryArchSuffix = $portVersion
	cmd:dwamorph1_reg$secondaryArchSuffix = $portVersion
	cmd:dwamorph2_reg$secondaryArchSuffix = $portVersion
	cmd:edgetest$secondaryArchSuffix = $portVersion
	cmd:enhance_reg$secondaryArchSuffix = $portVersion
	cmd:equal_reg$secondaryArchSuffix = $portVersion
	cmd:expand_reg$secondaryArchSuffix = $portVersion
	cmd:extrema_reg$secondaryArchSuffix = $portVersion
	cmd:falsecolortest$secondaryArchSuffix = $portVersion
	cmd:fcombautogen$secondaryArchSuffix = $portVersion
	cmd:fhmtauto_reg$secondaryArchSuffix = $portVersion
	cmd:fhmtautogen$secondaryArchSuffix = $portVersion
	cmd:fileinfo$secondaryArchSuffix = $portVersion
	cmd:findpattern_reg$secondaryArchSuffix = $portVersion
	cmd:findpattern1$secondaryArchSuffix = $portVersion
	cmd:findpattern2$secondaryArchSuffix = $portVersion
	cmd:findpattern3$secondaryArchSuffix = $portVersion
	cmd:flipdetect_reg$secondaryArchSuffix = $portVersion
	cmd:flipselgen$secondaryArchSuffix = $portVersion
	cmd:fmorphauto_reg$secondaryArchSuffix = $portVersion
	cmd:fmorphautogen$secondaryArchSuffix = $portVersion
	cmd:fpix_reg$secondaryArchSuffix = $portVersion
	cmd:fpixcontours$secondaryArchSuffix = $portVersion
	cmd:gammatest$secondaryArchSuffix = $portVersion
	cmd:genfonts$secondaryArchSuffix = $portVersion
	cmd:gifio_reg$secondaryArchSuffix = $portVersion
	cmd:graphicstest$secondaryArchSuffix = $portVersion
	cmd:grayfill_reg$secondaryArchSuffix = $portVersion
	cmd:graymorph1_reg$secondaryArchSuffix = $portVersion
	cmd:graymorph2_reg$secondaryArchSuffix = $portVersion
	cmd:graymorphtest$secondaryArchSuffix = $portVersion
	cmd:grayquant_reg$secondaryArchSuffix = $portVersion
	cmd:hardlight_reg$secondaryArchSuffix = $portVersion
	cmd:heap_reg$secondaryArchSuffix = $portVersion
	cmd:histotest$secondaryArchSuffix = $portVersion
	cmd:inserttest$secondaryArchSuffix = $portVersion
	cmd:ioformats_reg$secondaryArchSuffix = $portVersion
	cmd:iotest$secondaryArchSuffix = $portVersion
	cmd:jbcorrelation$secondaryArchSuffix = $portVersion
	cmd:jbrankhaus$secondaryArchSuffix = $portVersion
	cmd:jbwords$secondaryArchSuffix = $portVersion
	cmd:kernel_reg$secondaryArchSuffix = $portVersion
	cmd:lineremoval$secondaryArchSuffix = $portVersion
	cmd:listtest$secondaryArchSuffix = $portVersion
	cmd:livre_adapt$secondaryArchSuffix = $portVersion
	cmd:livre_hmt$secondaryArchSuffix = $portVersion
	cmd:livre_makefigs$secondaryArchSuffix = $portVersion
	cmd:livre_orient$secondaryArchSuffix = $portVersion
	cmd:livre_pageseg$secondaryArchSuffix = $portVersion
	cmd:livre_seedgen$secondaryArchSuffix = $portVersion
	cmd:livre_tophat$secondaryArchSuffix = $portVersion
	cmd:locminmax_reg$secondaryArchSuffix = $portVersion
	cmd:logicops_reg$secondaryArchSuffix = $portVersion
	cmd:lowaccess_reg$secondaryArchSuffix = $portVersion
	cmd:maketile$secondaryArchSuffix = $portVersion
	cmd:maze_reg$secondaryArchSuffix = $portVersion
	cmd:misctest1$secondaryArchSuffix = $portVersion
	cmd:modifyhuesat$secondaryArchSuffix = $portVersion
	cmd:morphseq_reg$secondaryArchSuffix = $portVersion
	cmd:morphtest1$secondaryArchSuffix = $portVersion
	cmd:mtifftest$secondaryArchSuffix = $portVersion
	cmd:numa_reg$secondaryArchSuffix = $portVersion
	cmd:numaranktest$secondaryArchSuffix = $portVersion
	cmd:otsutest1$secondaryArchSuffix = $portVersion
	cmd:otsutest2$secondaryArchSuffix = $portVersion
	cmd:overlap_reg$secondaryArchSuffix = $portVersion
	cmd:pagesegtest1$secondaryArchSuffix = $portVersion
	cmd:pagesegtest2$secondaryArchSuffix = $portVersion
	cmd:paint_reg$secondaryArchSuffix = $portVersion
	cmd:paintmask_reg$secondaryArchSuffix = $portVersion
	cmd:partitiontest$secondaryArchSuffix = $portVersion
	cmd:pdfiotest$secondaryArchSuffix = $portVersion
	cmd:pdfseg_reg$secondaryArchSuffix = $portVersion
	cmd:pixa1_reg$secondaryArchSuffix = $portVersion
	cmd:pixa2_reg$secondaryArchSuffix = $portVersion
	cmd:pixaatest$secondaryArchSuffix = $portVersion
	cmd:pixadisp_reg$secondaryArchSuffix = $portVersion
	cmd:pixalloc_reg$secondaryArchSuffix = $portVersion
	cmd:pixcomp_reg$secondaryArchSuffix = $portVersion
	cmd:pixmem_reg$secondaryArchSuffix = $portVersion
	cmd:pixserial_reg$secondaryArchSuffix = $portVersion
	cmd:pixtile_reg$secondaryArchSuffix = $portVersion
	cmd:plottest$secondaryArchSuffix = $portVersion
	cmd:pngio_reg$secondaryArchSuffix = $portVersion
	cmd:printimage$secondaryArchSuffix = $portVersion
	cmd:printsplitimage$secondaryArchSuffix = $portVersion
	cmd:printtiff$secondaryArchSuffix = $portVersion
	cmd:projection_reg$secondaryArchSuffix = $portVersion
	cmd:projective_reg$secondaryArchSuffix = $portVersion
	cmd:psio_reg$secondaryArchSuffix = $portVersion
	cmd:psioseg_reg$secondaryArchSuffix = $portVersion
	cmd:pta_reg$secondaryArchSuffix = $portVersion
	cmd:ptra1_reg$secondaryArchSuffix = $portVersion
	cmd:ptra2_reg$secondaryArchSuffix = $portVersion
	cmd:quadtreetest$secondaryArchSuffix = $portVersion
	cmd:rank_reg$secondaryArchSuffix = $portVersion
	cmd:rankbin_reg$secondaryArchSuffix = $portVersion
	cmd:rankhisto_reg$secondaryArchSuffix = $portVersion
	cmd:ranktest$secondaryArchSuffix = $portVersion
	cmd:rasterop_reg$secondaryArchSuffix = $portVersion
	cmd:rasteropip_reg$secondaryArchSuffix = $portVersion
	cmd:reducetest$secondaryArchSuffix = $portVersion
	cmd:removecmap$secondaryArchSuffix = $portVersion
	cmd:renderfonts$secondaryArchSuffix = $portVersion
	cmd:rotate1_reg$secondaryArchSuffix = $portVersion
	cmd:rotate2_reg$secondaryArchSuffix = $portVersion
	cmd:rotatefastalt$secondaryArchSuffix = $portVersion
	cmd:rotateorth_reg$secondaryArchSuffix = $portVersion
	cmd:rotateorthtest1$secondaryArchSuffix = $portVersion
	cmd:rotatetest1$secondaryArchSuffix = $portVersion
	cmd:runlengthtest$secondaryArchSuffix = $portVersion
	cmd:scale_reg$secondaryArchSuffix = $portVersion
	cmd:scaleandtile$secondaryArchSuffix = $portVersion
	cmd:scaletest1$secondaryArchSuffix = $portVersion
	cmd:scaletest2$secondaryArchSuffix = $portVersion
	cmd:seedfilltest$secondaryArchSuffix = $portVersion
	cmd:seedspread_reg$secondaryArchSuffix = $portVersion
	cmd:selio_reg$secondaryArchSuffix = $portVersion
	cmd:sharptest$secondaryArchSuffix = $portVersion
	cmd:shear_reg$secondaryArchSuffix = $portVersion
	cmd:shear2_reg$secondaryArchSuffix = $portVersion
	cmd:sheartest$secondaryArchSuffix = $portVersion
	cmd:showedges$secondaryArchSuffix = $portVersion
	cmd:skew_reg$secondaryArchSuffix = $portVersion
	cmd:skewtest$secondaryArchSuffix = $portVersion
	cmd:smallpix_reg$secondaryArchSuffix = $portVersion
	cmd:smoothedge_reg$secondaryArchSuffix = $portVersion
	cmd:snapcolortest$secondaryArchSuffix = $portVersion
	cmd:sorttest$secondaryArchSuffix = $portVersion
	cmd:splitcomp_reg$secondaryArchSuffix = $portVersion
	cmd:splitimage2pdf$secondaryArchSuffix = $portVersion
	cmd:string_reg$secondaryArchSuffix = $portVersion
	cmd:subpixel_reg$secondaryArchSuffix = $portVersion
	cmd:sudokutest$secondaryArchSuffix = $portVersion
	cmd:textlinemask$secondaryArchSuffix = $portVersion
	cmd:threshnorm_reg$secondaryArchSuffix = $portVersion
	cmd:translate_reg$secondaryArchSuffix = $portVersion
	cmd:trctest$secondaryArchSuffix = $portVersion
	cmd:viewertest$secondaryArchSuffix = $portVersion
	cmd:warper_reg$secondaryArchSuffix = $portVersion
	cmd:warpertest$secondaryArchSuffix = $portVersion
	cmd:watershedtest$secondaryArchSuffix = $portVersion
	cmd:wordsinorder$secondaryArchSuffix = $portVersion
	cmd:writemtiff$secondaryArchSuffix = $portVersion
	cmd:writetext_reg$secondaryArchSuffix = $portVersion
	cmd:xformbox_reg$secondaryArchSuffix = $portVersion
	cmd:xtractprotos$secondaryArchSuffix = $portVersion
	cmd:xvdisp$secondaryArchSuffix = $portVersion
	cmd:yuvtest$secondaryArchSuffix = $portVersion
	"
REQUIRES_tools="
	haiku$secondaryArchSuffix >= $haikuVersion
	leptonica$secondaryArchSuffix == $portVersion base
	"
