SUMMARY="A library for the dynamic creation of images"
DESCRIPTION="GD is an open source library for the dynamic creation of images \
by programmers."
HOMEPAGE="https://www.libgd.org/"
COPYRIGHT="1999-2020 Pierre-Alain Joye"
LICENSE="Libgd"
REVISION="2"
SOURCE_URI="https://github.com/libgd/libgd/archive/gd-$portVersion.tar.gz"
CHECKSUM_SHA256="24429f9d0dbe0f865aaa4b1a63558242396ba9134e6cfd32ca5e486a84483350"
SOURCE_DIR="libgd-gd-$portVersion"
PATCHES="gd-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	gd$secondaryArchSuffix = $portVersion
	cmd:annotate$secondaryArchSuffix
	cmd:bdftogd$secondaryArchSuffix
	cmd:gd$secondaryArchSuffix
	cmd:gd2copypal$secondaryArchSuffix
	cmd:gd2togif$secondaryArchSuffix
	cmd:gd2topng$secondaryArchSuffix
	cmd:gdcmpgif$secondaryArchSuffix
	cmd:gdparttopng$secondaryArchSuffix
	cmd:gdtopng$secondaryArchSuffix
	cmd:giftogd2$secondaryArchSuffix
	cmd:pngtogd$secondaryArchSuffix
	cmd:pngtogd2$secondaryArchSuffix
	cmd:webpng$secondaryArchSuffix
	lib:libgd$secondaryArchSuffix = 3.0.8 compat >= 3
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	lib:libbz2$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libgif$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libvpx$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	gd${secondaryArchSuffix}_devel = $portVersion
	devel:libgd$secondaryArchSuffix = 3.0.8 compat >= 3
	"
REQUIRES_devel="
	gd$secondaryArchSuffix == $portVersion base
	haiku${secondaryArchSuffix}_devel
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libvpx$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libgif$secondaryArchSuffix
	devel:libharfbuzz$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libvpx$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:gettextize$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:which
	"

BUILD()
{
	bootstrap.sh
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/*.la
	prepareInstalledDevelLibs \
		libgd
	fixPkgconfig

	packageEntries devel \
		$developDir
}
