SUMMARY="Portable Network Graphics library"
DESCRIPTION="
libpng is the official PNG reference library. It supports almost all PNG \
features, is extensible, and has been extensively tested for over 17 years
"
HOMEPAGE="http://www.libpng.org"
COPYRIGHT="
	1998-2011 Glenn Randers-Pehrson
	1996-1997 Andreas Dilger
	1995-1996 Guy Eric Schalnat, Group 42, Inc.
	"
LICENSE="LibPNG"
SRC_URI="http://prdownloads.sourceforge.net/libpng/libpng-1.5.12.tar.gz?download"
CHECKSUM_MD5="8ea7f60347a306c5faf70b977fa80e28"
REVISION="3"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PATCHES="libpng-1.5.12.patchset"

PROVIDES="
	libpng$secondaryArchSuffix = $portVersion compat >= 1.5
	lib:libpng$secondaryArchSuffix = 15.12.0 compat >= 15
	lib:libpng15$secondaryArchSuffix = 15.12.0 compat >= 15
	"
REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libz$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	devel:libz$secondaryArchSuffix >= 1.0.4
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	"

BUILD()
{
	aclocal
	libtoolize --force --copy --install
	./autogen.sh
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libpng libpng15
	fixPkgconfig

	# devel package
	packageEntries devel \
		$binDir \
		$developDir \
		$manDir/man3
}

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

PROVIDES_devel="
	libpng${secondaryArchSuffix}_devel = $portVersion compat >= 1.5
	cmd:libpng_config$secondaryArchSuffix = $portVersion compat >= 1.5
	cmd:libpng15_config$secondaryArchSuffix = $portVersion compat >= 1.5
	devel:libpng$secondaryArchSuffix = 15.12.0 compat >= 15
	devel:libpng15$secondaryArchSuffix = 15.12.0 compat >= 15
	"
REQUIRES_devel="
	libpng$secondaryArchSuffix == $portVersion base
	"
