# Maintainer: Sven-Hendrik Haase <svenstaro@gmail.com>
# Contributor: Jaroslaw Swierczynski <swiergot@aur.archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>
# Contributor: vande198
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>

pkgname=supertux
pkgver=0.6.2
pkgrel=4
pkgdesc="A classic 2D jump'n'run sidescroller game in a style similar to the original SuperMario games"
arch=('x86_64')
url="https://github.com/supertux/supertux"
license=('GPL')
depends=('sdl2_image' 'curl' 'openal' 'libvorbis' 'glew' 'physfs' 'freetype2' 'boost-libs' 'hicolor-icon-theme')
makedepends=('cmake' 'boost' 'mesa' 'optipng')
source=("https://github.com/SuperTux/supertux/releases/download/v${pkgver}/SuperTux-v${pkgver}-Source.tar.gz"
        missing-include-for-FLT_EPSILON.patch)
sha512sums=('5baa783ee589b42a9bbce3740659dbb7b617ebfcc00c0a038c03d31b56700e3923c8548700ccebe42b325ca03bd85186bc5edef9f6580d93dc48d8aca88cbf74'
            '4e4116cb0dc7f996cdb96484eac99bd7f5a16829f6b082cc2e4c17b22e6e2f34501b8e3e4caf3c956369c5cd6caa12179b8a4cb1f93c2c8c8b014e3829272cb3')

prepare() {
  cd "SuperTux-v${pkgver}-Source"
  patch -Np1 -i ../missing-include-for-FLT_EPSILON.patch
}

build() {
  cd "SuperTux-v${pkgver}-Source"

  cmake . \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DINSTALL_SUBDIR_BIN=bin \
      -DCMAKE_BUILD_TYPE=Release
  make
}

package() {
  cd "SuperTux-v${pkgver}-Source"

  make DESTDIR="${pkgdir}" install
}
