app=sdl2
version=2.0.8
build=1sml
homepage="https://www.sdl.org"
download="https://www.libsdl.org/release/SDL2-2.0.8.tar.gz"
desc="C Library providing low-level I/O access to hardware devices via OpenGL and 2D framebuffer"
requires="alsa-lib libx11 libxcursor libxext libxrender libxinerama mesa"

build() {
  mkandenterbuilddir
  rm -rf SDL2-$version

  tar xf $srcdir/SDL2-$version.tar.?z*
  cd SDL2-$version
  fixbuilddirpermissions

  applypatch $srcdir/khronos.patch

  mkdir -p smbuild && cd smbuild
  cmake .. \
    -DCMAKE_INSTALL_PREFIX="" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_C_FLAGS="$CFLAGS" \
    -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
    -DPULSEAUDIO=OFF 

  make
  make install DESTDIR=$pkg

  cp ../COPYING.txt $pkgdocs/
  removestaticlibs

  mkfinalpkg  
}

sha512sums="
673c6058b8692a36b4a3594456b10ef6051efe79e4fb644421fc5c76b11fd68b895840a2c8b72413418c378733e2993d33f19767d0d7ed101eda6310bd70c869  SDL2-2.0.8.tar.gz
76c93659a122def05f341ba30507b546b201c84823236ca731ac801f092e769574e8f051770a76050a77ac846ed851abab604e0a6d578b382f4792ab47aa60ed  khronos.patch
"
