SUMMARY="Reads and writes MNG images"
DESCRIPTION="LibMNG reads and writes MNG format image files, a PNG-like image \
format supporting multiple image, animation and transparent JPEG."
HOMEPAGE="http://www.libmng.com"
LICENSE="LIBMNG"
REVISION="1"

ARCHITECTURES="?x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="?x86_gcc2 ?x86"

SOURCE_URI="http://prdownloads.sourceforge.net/libmng/libmng-1.0.10.tar.gz?download"
CHECKSUM_SHA256="03a79dac9b9316d37227057614a248a946f997c4d1a3437fb569e9a63897f911"
COPYRIGHT="2000-2007 Gerard Juyn"
SOURCE_FILENAME="libmng-1.0.10.tar.gz"

PROVIDES="
	libpng$secondaryArchSuffix = $portVersion compat >= 1.0
	lib:libpng$secondaryArchSuffix = 15.12.0 compat >= 1.0
	lib:libpng15$secondaryArchSuffix = 15.12.0 compat >= 1.0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
PROVIDES_devel="
	libmng${secondaryArchSuffix}_devel = $portVersion compat >= 1.0
	cmd:libmng_config$secondaryArchSuffix = $portVersion compat >= 1.0
#	cmd:libmng1_config$secondaryArchSuffix = $portVersion compat >= 1.0
#	devel:libmng$secondaryArchSuffix = 10.0 compat >= 15
#	devel:libmng15$secondaryArchSuffix = 10.0 compat >= 15
	"
REQUIRES_devel="
	libmng$secondaryArchSuffix == $portVersion base
	"
BUILD_REQUIRES="
	devel:libz$secondaryArchSuffix >= 1.0.4
	libpng >= 1.5
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:aclocal
	cmd:autoconf
	cmd:automake == 1.12
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	"

BUILD()
{
	cp unmaintained/autogen.sh .
	cp makefiles/configure.in configure.ac
	cp makefiles/Makefile.am .

	libtoolize --force --copy --install
	aclocal
	./autogen.sh
	runConfigure ./configure
	make $jobArgs

##	libtoolize --force --copy --install
##	aclocal
##	./autogen.sh
#	./configure --prefix=`finddir B_COMMON_DIRECTORY` \
#	LDFLAGS=-L/boot/common/lib \
#	CPPFLAGS=-I/boot/common/include
##	MANDIR=`finddir B_COMMON_DOCUMENTATION_DIRECTORY`/man
##	LIBDIR=`finddir B_COMMON_LIB_DIRECTORY`
##	./configure --prefix=`finddir B_COMMON_DIRECTORY` \
##		--libdir=$LIBDIR \
##		--mandir=$MANDIR
##	make
}

INSTALL()
{
	make install

#	prepareInstalledDevelLibs libmng libmng1
#	fixPkgconfig

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