SUMMARY="A decoding library for GIF images"
DESCRIPTION="Libnsgif is a decoding library for GIF image file format"
HOMEPAGE="https://www.netsurf-browser.org/projects/libnsgif/"
COPYRIGHT="2003-2018 The NetSurf Developers"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://download.netsurf-browser.org/libs/releases/libnsgif-$portVersion-src.tar.gz"
CHECKSUM_SHA256="9eaea534cd70b53c5aaf45317ae957701685a6b4a88dbe34ed26f4faae879a4b"
if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then
PATCHES="libnsgif-$portVersion-gcc2.patchset"
fi

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libnsgif$secondaryArchSuffix = $portVersion
	lib:libnsgif$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libnsgif${secondaryArchSuffix}_devel = $portVersion
	devel:libnsgif$secondaryArchSuffix = $libVersion compat = $libVersionCompat
	"
REQUIRES_devel="
	libnsgif$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	netsurf_buildsystem >= 1.6
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	for linkage in lib-static lib-shared; do
		make PREFIX="$prefix" NSSHARED=/system/data/netsurf-buildsystem \
			COMPONENT_TYPE=$linkage
	done
}

INSTALL()
{
	for linkage in lib-static lib-shared; do
		make PREFIX="$prefix" NSSHARED=/system/data/netsurf-buildsystem \
			COMPONENT_TYPE=$linkage \
			INCLUDEDIR=$relativeIncludeDir install \
			LIBDIR=$relativeLibDir
	done

	prepareInstalledDevelLib libnsgif
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir"
}
