# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: wahnby <wahnby@yahoo.fr>

pkgname=gnunet
pkgver=0.11.6
pkgrel=1
pkgdesc="A framework for secure peer-to-peer networking"
arch=('x86_64')
url="http://gnunet.org"
license=('GPL')
depends=('libextractor' 'sqlite' 'gnurl' 'libmicrohttpd' 'libidn' 'jansson')
makedepends=('git' 'bluez-libs' 'python' 'glpk' 'libpulse' 'opus' 'gst-plugins-base-libs')
optdepends=('bluez-libs'
	    'python'
	    'glpk'
	    'libpulse'
	    'opus'
            'gst-plugins-base-libs: for gnunet-helper-audio-record')
backup=(etc/gnunetd.conf)
options=('!makeflags')
# TODO: key revoked, check for new signature on new release
# source=(https://ftp.gnu.org/gnu/gnunet/gnunet-${pkgver/_/}.tar.gz{,.sig}
#source=(https://ftp.gnu.org/gnu/gnunet/gnunet-${pkgver/_/}.tar.gz
source=(git://git.gnunet.org/gnunet.git#tag=v$pkgver
        gnunet.service
        defaults.conf)
validpgpkeys=('19647543F7861D3BF4E64FF7BF60708B48426C7E')
md5sums=('SKIP'
         '54cce3d2415d95b2e5bd1bd88db3a0ea'
         '0fe23b2ca5b3fc47a0b5645e04406da0')

build() {
  cd gnunet
  sed -i 's|contrib doc|doc|' Makefile.*
  ./bootstrap
  [ -f Makefile ] || ./configure --prefix=/usr \
    --without-mysql
  make
  make -C contrib
}

package() {
  cd gnunet
  make DESTDIR="$pkgdir" install
  make DESTDIR="$pkgdir" -C contrib install
  install -D -m0644 "$srcdir"/defaults.conf "$pkgdir"/etc/gnunetd.conf
  rm -rf "$pkgdir"/usr/include/libltdl "$pkgdir"/usr/lib/libltdl.* "$pkgdir"/usr/include/ltdl.h
  install -Dm0644 "$srcdir"/$pkgname.service "$pkgdir"/usr/lib/systemd/system/$pkgname.service
}
