# Maintainer (Arch): schuay <jakob.gruber@gmail.com>
# Contributor (Arch): Mike Sampson <mike at sambodata dot com>
# Contributor (Arch): Adrian Stratulat <adrian.stratulat at inboxcom>
# Contributor (Arch): Anton Bazhenov <anton.bazhenov at gmail>
# Contributor (Arch): KillaB <xGenoBlast@gmail.com>
# Contributor (Arch): Callan Barrett <wizzomafizzo@gmail.com>
# Contributor (Arch): Christian Schmidt <xmucknertx@googlemail.com>
# Contributor (Arch): Sebastian Sareyko <public@nooms.de>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Isaac David <isacdaavid@at@isacdaavid@dot@info>
# Contributor: André Silva <emulatorman@parabola.nu>
# Contributor: Márcio Silva <coadde@parabola.nu>

# parabola changes and rationale:
#  - removed nonfree artwork and sound effects

pkgname=angband
pkgver=4.1.3
pkgrel=1
pkgrel+=.par1
pkgdesc="A roguelike dungeon exploration game based on the writings of JRR Tolkien"
pkgdesc+=", without nonfree artwork and sound effects"
arch=('x86_64')
arch+=('i686' 'armv7h')
url="http://rephial.org/"
license=('GPL2' 'custom')
depends=('sdl_image' 'sdl_ttf' 'sdl_mixer' 'ncurses' 'xorg-fonts-misc')
makedepends=('python-docutils')
source=("http://rephial.org/downloads/${pkgver:0:3}/${pkgname}-${pkgver}.tar.gz"
        "libre.patch")

prepare() {
  cd "${srcdir}/angband-${pkgver}"

  # Fix detection of ncurses config script for ncurses 6.0
  sed -i 's/ncursesw5-config/ncursesw6-config/g' acinclude.m4

  # remove nonfree artwork and sound effects
  rm -v lib/sounds/*.mp3
  rm -v lib/tiles/shockbolt/64x64.png
  patch -Np1 -i ../libre.patch
}

build() {
  cd "${srcdir}/angband-${pkgver}"

  ./autogen.sh

  ./configure \
    --prefix=/usr \
    --bindir=/usr/bin \
    --sysconfdir=/usr/share/angband \
    --with-configpath=/usr/share/angband \
    --with-libpath=/usr/share/angband \
    --enable-gtk \
    --enable-sdl \
    --enable-sdl-mixer

  make
}

package() {
  cd "${srcdir}/angband-${pkgver}"

  make DESTDIR="${pkgdir}" install

  rm -f "${pkgdir}/usr/share/angband/*/delete.me"
  install -Dm644 copying.txt "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}

sha256sums=('9402c4f8da691edbd4567a948c5663e1066bee3fcb4a62fbcf86b5454918406f'
            'fa1524d1a3c5768b9090630d16393274fe007f87f3c0a00c4ffb5fc66e84fee9')
