# Template file for 'SDL2_image'
pkgname=SDL2_image
version=2.0.3
revision=1
build_style=gnu-configure
configure_args="--disable-static --disable-jpg-shared
 --disable-png-shared --disable-webp-shared --disable-tif-shared"
hostmakedepends="pkg-config"
makedepends="libpng-devel tiff-devel SDL2-devel libwebp-devel"
short_desc="Load images as SDL surfaces (SDL 2.x)"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="Zlib"
homepage="http://www.libsdl.org/projects/SDL_image/"
distfiles="http://www.libsdl.org/projects/SDL_image/release/$pkgname-$version.tar.gz"
checksum=3510c25da735ffcd8ce3b65073150ff4f7f9493b866e85b83738083b556d2368

# Package build options
build_options="gles"

case "$XBPS_TARGET_MACHINE" in
	arm*)
		# Enable OpenGL/ES on rpi platforms
		build_options_default="gles"
		;;
esac


if [ "$build_option_gles" ]; then
	case "$XBPS_TARGET_MACHINE" in
	armv[67]*)
		# RaspberryPi, use Videocore IV
		makedepends+=" rpi-userland-devel"
		LDFLAGS="-L${XBPS_CROSS_BASE}/opt/vc/lib -lbcm_host"
		;;
	esac
fi

post_install() {
	vlicense COPYING.txt COPYING
}

SDL2_image-devel_package() {
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
