# Maintainer (arch): Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Alexander Fehr <pizzapunk gmail com>
# Contributor: Lucien Immink <l.immink@student.fnt.hvu.nl>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor: bill-auger <bill-auger@programmer.net>


# parabola changes and rationale:
# - in [libre] for pbot
# NOTE: this PKGBUILD is actually 'pidgin'


pkgname='pidgin-bridgin'
pkgver=0.5.1
_pidginname=pidgin
_pidginver=2.14.4
pkgrel=1
pkgdesc="plugin for bridging pidgin/finch conversations"
arch=('x86_64')
arch+=('armv7h' 'i686')
url="https://pidgin.im/"
license=('GPL')
makedepends=('startup-notification' 'gtkspell' 'libxss' 'nss' 'libsasl' 'libsm'
             'libidn' 'libgadu' 'python' 'hicolor-icon-theme' 'farstream' 'tk'
             'libnsl' 'avahi' 'ca-certificates' 'intltool' 'libnm' 'dbus-glib'
             'libgnt' 'libxcrypt')
depends=('libpurple')
options=('!emptydirs')
source=(https://downloads.sourceforge.net/project/pidgin/Pidgin/$_pidginver/$_pidginname-$_pidginver.tar.bz2{,.asc})
source+=(bridgin-$pkgver.tar.gz::https://github.com/bill-auger/bridgin/archive/v$pkgver.tar.gz)
#sha256sums=('f132e18d551117d9e46acce29ba4f40892a86746c366999166a3862b51060780' # 2.14.1
sha256sums=('67c1a0104b0624a50100c6d73cd5504d53c9d221922b1b28fa86020531a9904e' # 2.14.4
            'SKIP')
# sha256sums+=('25dd0f14b58939dbf9bcc4b95f1471f2a2438b5c9e5f9aca717d48c337229981'
# sha256sums+=('49b54d48ada9008b88c16af0cb059f307a2e90ad81a2d0f9f727cf573784962e'
#             '5af57d228d07ac4f2169642855f525749687fc5039c72d3fe8a6e4de49b30c96') # 0.5.0
#             'b18469a34e0ef2158ccf7a26469181df8934c0f2ff3106bd817a081847b8dd5b') # 0.0.6?
#              '1c07a6421a9640898125b0248453ef9a004f0dad1fa32e8219390b7d614b16fb')  # 0.5.1-prev
#              'c9c3b9824def963d7c3bee9c7d1e5684cc67f747ca4791ba93e55b667352d965') # 0.5.1
sha256sums+=('c9c3b9824def963d7c3bee9c7d1e5684cc67f747ca4791ba93e55b667352d965')
validpgpkeys=('40DE1DC7288FE3F50AB938C548F66AFFD9BDB729') # Gary Kramlich <grim@reaperworld.com>


prepare() {
  cd ${_pidginname}-${_pidginver}

  # copy bridgin sources into plugins/ workdir
  cp "${srcdir}"/bridgin-$pkgver/* libpurple/plugins/
}

build() {
  cd ${_pidginname}-${_pidginver}

  # compile libpurple/pidgin/finch
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --disable-schemas-install \
    --disable-gevolution \
    --disable-meanwhile \
    --disable-gnutls \
    --enable-cyrus-sasl \
    --disable-doxygen \
    --enable-nm \
    --with-system-ssl-certs=/etc/ssl/certs
    make

  # compile bridgin plugin
  cd libpurple/plugins/
  make ./bridgin.so
}

package()
{
  cd ${_pidginname}-${_pidginver}

  install -Dm644 libpurple/plugins/bridgin.so "${pkgdir}"/usr/lib/purple-2/bridgin.so
}
