# Maintainer (aur): Mike Swanson <mikeonthecomputer@gmail.com>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=(freedoom freedm)
pkgbase=${pkgname[0]}
pkgver=0.12.1
pkgrel=1
pkgdesc="Free game based on the Doom engine"
arch=('any')
url="https://freedoom.github.io/"
license=('BSD3')
makedepends=('asciidoc' 'deutex' 'python' 'python-pillow')
source=(https://github.com/$pkgbase/$pkgbase/releases/download/v$pkgver/$pkgbase-$pkgver.tar.xz
        supported-engines.patch)
sha512sums=('08a8489e1bbd9418262bfefaa9afe67a281b6f3fd38f77ac822438da434229bb034077e53658c06fa93cbf3ba3c5c25dab5fe1844fe23043e310d21866e12810'
            'af579e5b34e7c59931777c7fcdfe62657d4e04dd5182aa4d81159d661200b20b7e83fed25f9061bc0ca21edc1b07195a50ead56e193dfb98512e28b24602334c')

prepare() {
  cd "$pkgbase-$pkgver"

  patch -Np1 < "$srcdir"/supported-engines.patch
}

build() {
  cd "$pkgbase-$pkgver"

  make
}

package_freedm() {
  cd "$pkgbase-$pkgver"
  make prefix=/usr DESTDIR="$pkgdir" install-freedm

  install -Dm644 COPYING.adoc "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}

package_freedoom() {
  cd "$pkgbase-$pkgver"
  make prefix=/usr DESTDIR="$pkgdir" install-freedoom

  install -Dm644 COPYING.adoc "$pkgdir/usr/share/licenses/$pkgname/COPYING"
}
