pkgname=mendeleydesktop
pkgver=1.1.3
pkgrel=1
pkgdesc="Academic software for managing and sharing research papers (desktop client)"
url=http://www.mendeley.com/release-notes/
arch=(i686 x86_64)
depends=(python2 qt)
license=(custom:mendeley_eula)
_arch=$CARCH
[[ $CARCH = i686 ]] && _arch=i486
source=("http://s3.amazonaws.com/mendeley-desktop-download/linux/$pkgname-$pkgver-linux-$_arch.tar.bz2")
md5sums=('55719984f706e4f71718a7f1674ef046')
sha256sums=('3d686c3f2fa2db75eafe9b7aac81c68c17cbfd0d84fac7ab51dbd11204cea14a')
if [[ $CARCH = x86_64 ]]; then
md5sums=('3fc090c8d4a61154f3d1d979ff1bf09e')
sha256sums=('8d7da5f238b1ab2a8dc2611dddc1d7566e4526ef79e0334bf4d9e9601e947d62')
fi
package() {
cd "$pkgname-$pkgver-linux-$_arch"
rm -f share/doc/mendeleydesktop/*.txt
install -dm755 "$pkgdir/opt/$pkgname/"{,bin}
mv lib share "$pkgdir/opt/$pkgname/"
ln -s "../lib/mendeleydesktop/libexec/mendeleydesktop.$_arch" "$pkgdir/opt/$pkgname/bin/$pkgname"
sed -i '1s@^#!/usr/bin/python$@&2@' "bin/mendeleydesktop"
install -Dm755 "bin/mendeleydesktop" "$pkgdir/usr/bin/mendeleydesktop"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}