# Contributor (Arch): Gaetan Bisson <bisson@archlinux.org>
# Contributor (Arch): Pierre Schmitz <pierre@archlinux.de>
# Contributor (Arch): Bug <Bug2000@gmail.com>
# Maintainer : Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=libotr3
pkgver=3.2.1
pkgrel=2
pkgdesc='Off-the-Record Messaging Library and Toolkit (version 3.X)'
url='http://www.cypherpunks.ca/otr/'
license=('GPL' 'LGPL')
arch=('i686' 'x86_64')
depends=('libgcrypt')
source=("http://www.cypherpunks.ca/otr/libotr-${pkgver}.tar.gz" "libotr3-soname.patch")
sha1sums=('898bf00d019f49ca34cd0116dd2e22685c67c394'
          '08c85f20fa1a0c5e8935d9a3f00b1d4e37f1b2d1')

build() {
	cd "${srcdir}/libotr-${pkgver}"
	patch -p1 -i "${srcdir}/libotr3-soname.patch"
 	./configure --prefix=/usr --mandir=/usr/share/man \
	  --program-transform-name='s/otr/otr3/'
	make 
}

package() {
	cd "${srcdir}/libotr-${pkgver}"
	make DESTDIR="${pkgdir}" install

	for i in parse sesskeys mackey readforge modify remac; do
	  rm "${pkgdir}"/usr/share/man/man1/otr_$i.1
	  ln -sf otr3_toolkit.1 "${pkgdir}"/usr/share/man/man1/otr3_$i.1
	done
}