# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: Corrado Primier <bardo@aur.archlinux.org>
# Contributor: Aurelien Foret <orelien@chez.com>

pkgname=gammu
pkgver=1.42.0
pkgrel=1
pkgdesc="GNU All Mobile Management Utilities"
arch=('x86_64')
url="https://wammu.eu/gammu/"
license=('GPL')
depends=('glib2' 'bluez-libs' 'curl' 'libdbi' 'mariadb-libs' 'postgresql-libs' 'libusb' 'libgudev')
makedepends=('cmake' 'doxygen' 'python' 'systemd')
checkdepends=('libdbi-drivers')
optdepends=('dialog: support for the gammu-config script' 'python: for python bindings')
source=(https://dl.cihar.com/$pkgname/releases/$pkgname-$pkgver.tar.xz)
sha256sums=('d8f152314d7e4d3d643610d742845e0a016ce97c234ad4b1151574e1b09651ee')

prepare() {
  cd $pkgname-$pkgver
# bash completion dir change
  sed -i 's,COMPLETIONSDIR "/etc/bash_completion.d",COMPLETIONSDIR "/usr/share/bash-completion/completions",' contrib/CMakeLists.txt
}

build() {
  cd $pkgname-$pkgver

  cmake . -DCMAKE_INSTALL_PREFIX="/usr" -DLIB_SUFFIX=""
  make
}

check() {
  cd $pkgname-$pkgver

  # tests can be flaky on slower hardware due to timing
  make test
}

package() {
  cd $pkgname-$pkgver

  make DESTDIR="${pkgdir}" install
}
