# $Id: PKGBUILD 113772 2014-06-29 21:49:00Z heftig $
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Mateusz Herych <heniekk@gmail.com>
# Contributor: Charles Lindsay <charles@chaoslizard.org>

pkgname=cdemu-client
pkgver=3.0.0
pkgrel=1
pkgdesc="Simple command-line client for controlling cdemu-daemon"
arch=(any)
url="http://cdemu.sourceforge.net/"
license=(GPL)
depends=(python2 dbus-python cdemu-daemon desktop-file-utils)
makedepends=(intltool cmake)
conflicts=('cdemu')
install=cdemu-client.install
source=("http://downloads.sourceforge.net/cdemu/$pkgname-$pkgver.tar.bz2")
sha256sums=('359310a57422d5c59c8f93be0da827a2437edb1e62f455f5614089c28e34ae88')

prepare() {
  mkdir build
  cd $pkgname-$pkgver

  # python2 fix
  sed -i '1s|^#!.*python$|&2|' src/cdemu

  # fix text domain
  sed -i '/^project /s/cdemu/&-client/' CMakeLists.txt
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr
  make
}

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