# $Id: PKGBUILD 287876 2017-02-01 15:04:41Z bpiotrowski $
# Maintainer (arch): Dave Reisner <dreisner@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
# Contributor: Jeff 'codemac' Mickey <jeff@archlinux.org>
# Contributor: simo <simo@archlinux.org>
# Contributor: FUBAR <mrfubar@gmail.com>
# Maintainer: Márcio Silva <coadde@hyperbola.info>

pkgname=bitlbee
pkgver=3.5.1
pkgrel=1.parabola1.nonprism1
pkgdesc='Brings XMPP to IRC, without nonfree Skype support and support for unsafe and dangerous for privacy protocols'
url='http://www.bitlbee.org/'
license=('GPL')
arch=('i686' 'x86_64' 'armv7h')
depends=('gnutls' 'glib2')
makedepends=('python' 'libotr')
optdepends=('libotr: for OTR encryption support')
replaces=("${pkgname}-libre" "${pkgname}-parabola" "${pkgname}-coherence" "${pkgname}-libre-nonprism" "${pkgname}-nonprism")
conflicts=("${pkgname}-libre" "${pkgname}-parabola" "${pkgname}-coherence" "${pkgname}-libre-nonprism" "${pkgname}-nonprism")
source=("http://get.bitlbee.org/src/$pkgname-$pkgver.tar.gz"
        'bitlbee.tmpfiles')
sha1sums=('de0767facdb7729253ae4d6ef6e3637ebd54939a'
          '3695ed2fe22436c4d0fc3ead829f7d1f89bc491c')
backup=('etc/bitlbee/bitlbee.conf'
        'etc/bitlbee/motd.txt')
install=bitlbee.install

build() {
  cd "$pkgname-$pkgver"

  ./configure \
    --prefix=/usr \
    --etcdir=/etc/bitlbee \
    --sbindir=/usr/bin \
    --pidfile=/run/bitlbee/bitlbee.pid \
    --ipcsocket=/run/bitlbee/bitlbee.sock \
    --systemdsystemunitdir=/usr/lib/systemd/system \
    --jabber=1 \
    --msn=0 \
    --oscar=0 \
    --yahoo=0 \
    --twitter=0 \
    --ssl=gnutls \
    --strip=0 \
    --otr=plugin \
    --skype=0

  make
}

package() {
  make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install{,-etc,-dev,-systemd}

  install -o65 -g65 -dm770 "$pkgdir/var/lib/bitlbee"
  install -Dm644 "$srcdir/bitlbee.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/bitlbee.conf"
}
