SUMMARY="A decoding library for BMP and ICO images"
DESCRIPTION="Libnsbmp is a decoding library for BMP and ICO image file formats"
HOMEPAGE="https://www.netsurf-browser.org/projects/libnsbmp/"
COPYRIGHT="2003-2020 The NetSurf Developers"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://download.netsurf-browser.org/libs/releases/libnsbmp-$portVersion-src.tar.gz"
CHECKSUM_SHA256="79c49365f860ed451bfc4109eddec8de3e9b7ce5a3be069596bd2aa19279324f"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

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

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	netsurf_buildsystem >= 1.9
	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 libnsbmp
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir"
}
