# $Id: PKGBUILD 241540 2015-06-30 20:31:03Z arojas $
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgname=kdegames-kajongg
pkgver=15.04.3
pkgrel=1
pkgdesc="The ancient Chinese board game for 4 players"
url="http://kde.org/applications/games/kajongg/"
arch=('any')
license=('GPL' 'LGPL' 'FDL')
groups=('kde-applications' 'kdegames')
depends=('kdebase-runtime' 'python2-twisted' 'kdebindings-python2' 'libkmahjongg4')
makedepends=('cmake' 'automoc4')
install=${pkgname}.install
source=("http://download.kde.org/stable/applications/${pkgver}/src/kajongg-${pkgver}.tar.xz")
sha1sums=('6f39e2de14332d7f5085163071781da528ffed01')

prepare() {
  mkdir build

  cd kajongg-${pkgver}
  sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' \
    src/{deferredutil,kajongg,kajonggserver,server}.py
}

build() {
  cd build
  cmake ../kajongg-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DKDE4_BUILD_TESTS=OFF \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DPYTHON_EXECUTABLE=/usr/bin/python2 \
    -DINSTALL_KAJONGG=TRUE
  make
}

package() {
  cd build
  make DESTDIR="${pkgdir}" install
}
