# Description: SDL graphics drawing primitives and other support functions.
# URL: https://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx/
# Maintainer: John McQuah, jmcquah at disroot dot org
# Depends on: libsdl

name=sdl_gfx
version=2.0.27
release=1
source=(https://sourceforge.net/projects/sdlgfx/files/SDL_gfx-$version.tar.gz/download)
renames=($name-$version.tar.gz)

build() {
    cd SDL_gfx-$version

    # shipped configure was not regenerated since 2.0.25, resulting in bad soname
    sed -e 's/-O //' -e '/^MICRO_VERSION=/s/26/27/' -i configure.in
    mv configure.in configure.ac
    autoreconf -fvi

    ./configure --prefix=/usr
    make
    make DESTDIR=$PKG install
    rm $PKG/usr/lib/*.la

    # not sure why this path is wrong, it breaks mjpegtools
    sed -e 's|^#include <SDL.h>|#include <SDL/SDL.h>|' \
        -i $PKG/usr/include/SDL/SDL_gfxPrimitives.h
}
