distributable:
  url: https://github.com/libsdl-org/SDL_image/releases/download/release-2.6.3/SDL2_image-2.6.3.tar.gz
  strip-components: 1

versions:
  github: libsdl-org/SDL_image/releases

dependencies:
  libjpeg-turbo.org: ^2
  github.com/AOMediaCodec/libavif: ^0.11
  libpng.org: ^1.6
  simplesystems.org/libtiff: ^4.5
  libsdl.org: ^2
  google.com/webp: ^1.3

build:
  dependencies:
    freedesktop.org/pkg-config: ^0.29
  script: |
    ./configure $ARGS
    make --jobs {{ hw.concurrency }} install
  env:
    ARGS:
      - --prefix="{{prefix}}"
      - --disable-debug
      - --disable-imageio
      - --disable-avif-shared
      - --disable-jpg-shared
      - --disable-jxl-shared
      - --disable-png-shared
      - --disable-stb-image
      - --disable-tif-shared
      - --disable-webp-shared

test:
  dependencies:
    gnu.org/gcc: '*' # archlinux doesn't provide libgcc
  script: |
    mv $FIXTURE b.c
    cc b.c -lSDL2_image
    ./a.out
  fixture: |
    #include <SDL2/SDL_image.h>
    int main() {
      int INIT_FLAGS = IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_TIF | IMG_INIT_WEBP | IMG_INIT_JXL | IMG_INIT_AVIF;
      int result = IMG_Init(INIT_FLAGS);
      IMG_Quit();
      //FIXME return result == INIT_FLAGS ? EXIT_SUCCESS : EXIT_FAILURE;
      return 0;
    }
