# $Id: PKGBUILD 95912 2013-08-18 17:24:22Z svenstaro $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: fana-m <geminin@gmx.net>
# Contributor: Andrzej Giniewicz <gginiu@gmail.com>
# Contributor: Manuel Gaul <inkaine@hotmail.com>

pkgname=gigi
pkgver=6142
pkgrel=3
pkgdesc='Small, efficient and feature rich GUI for OpenGL and C++ (freeorion fork)'
#url='http://gigi.sourceforge.net/'
url='http://freeorion.svn.sourceforge.net/viewvc/freeorion/trunk/FreeOrion/GG/'
arch=('x86_64' 'i686')
license=('LGPL')
depends=('boost' 'libpng' 'libtiff' 'ogre' 'sdl' 'python')
makedepends=('subversion' 'cmake' 'setconf' 'doxygen' 'mesa-libgl')
#https://gigi.svn.sourceforge.net/svnroot/gigi/trunk/GG/
source=("$pkgname::svn+https://freeorion.svn.sourceforge.net/svnroot/freeorion/trunk/FreeOrion/GG/")
sha256sums=('SKIP')

pkgver() {
  cd "$pkgname"

  svnversion | tr -d [A-z]
}

prepare() {
  cd "$pkgname"

  setconf cmake/GiGiOgre.pc.in prefix /usr
  setconf cmake/GiGi.pc.in prefix /usr
  setconf cmake/GiGiSDL.pc.in prefix /usr
}

build() {
  cd "$pkgname"

  cmake \
    -D CMAKE_INSTALL_PREFIX="$srcdir/pkg/usr" \
    -D BUILD_TUTORIALS=OFF \
    -D CPACK_GENERATOR=GiGiDevel \
    -D CMAKE_C_FLAGS_RELEASE='-DNDEBUG' \
    .
  make -j1
}

package() {
  cd "$pkgname"

  make install
  mv -v "$srcdir/pkg/usr" "$pkgdir/"

  # python3 fix
  for f in `find "$pkgdir/usr" -name "*.py"`; do
    sed -i "s:/env python:/python3:g" "$f"
  done
}

# vim:set ts=2 sw=2 et:
