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="http://www.libsdl.org/projects/SDL_image" 
SOURCE_URI="https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.0.tar.gz"
CHECKSUM_SHA256="b29815c73b17633baca9f07113e8ac476ae66412dec0d29a5045825c27a47234"
REVISION="4"
LICENSE="Zlib"
COPYRIGHT="1997-2013 Sam Lantinga"

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

PROVIDES="
	sdl2_image${secondaryArchSuffix} = $portVersion
	lib:libSDL2_image_2.0${secondaryArchSuffix} = 0.0.0 compat >= 0
	"

REQUIRES="
	haiku${secondaryArchSuffix}
	lib:libSDL2_2.0${secondaryArchSuffix}
	lib:libjpeg$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libgif$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsdl2${secondaryArchSuffix}
    devel:libjpeg$secondaryArchSuffix
    devel:libpng$secondaryArchSuffix
    devel:libtiff$secondaryArchSuffix
    devel:libgif$secondaryArchSuffix
    devel:libwebp$secondaryArchSuffix
    devel:libz$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:libtoolize
	cmd:aclocal
	cmd:automake
	cmd:autoconf
	cmd:dos2unix
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

SOURCE_DIR="SDL2_image-$portVersion"

BUILD()
{
	libtoolize --copy --force --install
	aclocal --install -I acinclude
	autoconf
	dos2unix miniz.h
	runConfigure ./configure --enable-jpg-shared=no --enable-png-shared=no \
		--enable-tif-shared=no --enable-webp-shared=no
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libSDL2_image libSDL2_image-2.0
	fixPkgconfig
	rm $developLibDir/*.la

	packageEntries devel \
		$developDir
}

PROVIDES_devel="
	sdl2_image${secondaryArchSuffix}_devel = ${portVersion}
	devel:libSDL2_image_2.0$secondaryArchSuffix = 0.0.0 compat >= 0
	devel:libSDL2_image$secondaryArchSuffix
	"

REQUIRES_devel="
	sdl2_image$secondaryArchSuffix == $portVersion base
	"
