# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
pkgname=sdl2_image
pkgver=2.8.8
pkgrel=1.1
pkgdesc="A simple library to load images of various formats as SDL surfaces (Version 2)"
arch=('x86_64' 'aarch64')
url="https://github.com/libsdl-org/SDL_image"
license=('MIT')
depends=('sdl2' 'libpng' 'libtiff' 'libjpeg-turbo' 'libwebp' 'libavif' 'libjxl')
makedepends=('cmake')
source=("https://github.com/libsdl-org/SDL_image/releases/download/release-${pkgver}/SDL2_image-${pkgver}.tar.gz"{,.sig})
sha512sums=('5c521ae6a053e1eb6b42dce3ccccdbdb353eb7e9d1bd89392b1913bfc9fbb6b8a9d5506c80e5b7924b51637bb95cd270657ca87dafe60edd5534e333524bc901'
            'SKIP')
validpgpkeys=('1528635D8053A57F77D1E08630A59377A7763BE6')

build() {
  cd "${srcdir}/SDL2_image-${pkgver}/"
  ./configure --disable-static --prefix=/usr \
    --disable-avif-shared \
    --disable-jpg-shared \
    --disable-png-shared \
    --disable-stb-image \
    --disable-tif-shared \
    --disable-jxl-shared \
    --disable-webp-shared
  make
}

package() {
  cd "${srcdir}/SDL2_image-${pkgver}/"

  make DESTDIR="${pkgdir}/" install
  install -Dm644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
