SUMMARY="Simple Direct Media Layer Image Library"
DESCRIPTION="
SDL_image is an image file loading library. It loads images as SDL surfaces, \
and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, \
TIFF, WEBP, XCF, XPM, XV
to include those shared libraries. libpng depends on libz, and libtiff depends \
on both libz and libjpeg."
HOMEPAGE="https://www.libsdl.org/projects/SDL_image"
COPYRIGHT="1997-2018 Sam Lantinga"
LICENSE="Zlib"
REVISION="2"
SOURCE_URI="https://www.libsdl.org/projects/SDL_image/release/SDL2_image-$portVersion.tar.gz"
CHECKSUM_SHA256="bdd5f6e026682f7d7e1be0b6051b209da2f402a2dd8bd1c4bd9c25ad263108d0"
SOURCE_DIR="SDL2_image-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86 x86_gcc2"

PROVIDES="
	sdl2_image$secondaryArchSuffix = $portVersion compat >= 2
	lib:libSDL2_image_2.0$secondaryArchSuffix = 0.2.3 compat >= 0
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	lib:libgif$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	sdl2_image${secondaryArchSuffix}_devel = $portVersion compat >= 2
	devel:libSDL2_image$secondaryArchSuffix = $portVersion compat >= 2
	devel:libSDL2_image_2.0$secondaryArchSuffix = 0.2.3 compat >= 0
	"
REQUIRES_devel="
	sdl2_image$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgif$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix >= 0.8.0
	devel:libtiff$secondaryArchSuffix
	devel:libwebp$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	touch INSTALL NEWS README AUTHORS ChangeLog COPYING
	autoreconf -fi
	runConfigure ./configure --enable-jpg-shared=no --enable-png-shared=no \
		--enable-tif-shared=no --enable-webp-shared=no
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/*.la

	prepareInstalledDevelLibs libSDL2_image libSDL2_image-2.0
	fixPkgconfig

	packageEntries devel \
		$developDir
}
