# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgbase=libmesode
pkgname=('libmesode' 'libmesode-doc')
pkgver=0.9.2
pkgrel=1
pkgdesc='Simple, lightweight C library for writing prifanity XMPP client'
url='https://github.com/boothj5/libmesode'
arch=('x86_64')
license=('GPL3' 'MIT')
makedepends=('openssl' 'expat' 'doxygen')
checkdepends=('check')
options=('staticlibs')
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/boothj5/libmesode/archive/${pkgver}.tar.gz)
sha512sums=('019f548557fcbb0943e49472a9eb36ce8aaf6caea3a443004f41339987a721073c20b9d8f3eec79c92914e25dffcb26ef1fd43921ee0df76a4d99fc474f87ba5')

prepare() {
  cd ${pkgbase}-${pkgver}
  ./bootstrap.sh
}

build() {
  cd ${pkgbase}-${pkgver}
  ./configure --prefix=/usr
  make
  doxygen
}

check() {
  make -C ${pkgbase}-${pkgver} check
}

package_libmesode() {
  depends=('openssl' 'expat')
  cd ${pkgbase}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 MIT-LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

package_libmesode-doc() {
  pkgdesc+=' (documentation and samples)'
  options=('!strip')
  optdepends=('libmesode')
  cd ${pkgbase}-${pkgver}
  install -Dm 644 docs/html/* -t "${pkgdir}/usr/share/doc/${pkgname}/html"
  install -Dm 644 examples/{README.md,*.c} -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
  install -Dm 644 MIT-LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
