# $Id: PKGBUILD 71218 2012-05-25 05:04:27Z svenstaro $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Jacobo Arvelo <unix4all@ya.com>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>

pkgname=wesnoth-data
pkgver=1.10.3
pkgrel=1
pkgdesc="A turn-based strategy game on a fantasy world (data files)"
arch=('any')
license=('GPL')
url="http://www.wesnoth.org/"
makedepends=('boost' 'cmake' 'sdl_image' 'sdl_ttf' 'sdl_mixer' 'sdl_net' 'lua' 'pango')
options=(!emptydirs)
source=(http://downloads.sourceforge.net/sourceforge/wesnoth/wesnoth-${pkgver}.tar.bz2)
md5sums=('b25354c71d58f82c2c60cc12c6f09c36')

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

  mkdir build && cd build
  cmake .. \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DENABLE_OMP=ON \
      -DENABLE_TOOLS=ON \
      -DMANDIR=share/man \
      -DFIFO_DIR=/var/run/wesnothd
  make
}

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

  cd build
  make DESTDIR="$pkgdir" install

  rm -r $pkgdir/usr/bin
  rm -r $pkgdir/usr/share/man

  for file in $(grep -l "python" $pkgdir/usr/share/wesnoth/data/tools/*); do
    sed -i "s|#!/usr/bi#n/env python|#!/usr/bin/env python2|" $file;
  done
}
