# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@mirantis.com>
# Contributor: Thomas Bächler <thomas@archlinux.org>

pkgname=libpcap
pkgver=1.10.1
pkgrel=2
pkgdesc='A system-independent interface for user-level packet capture'
arch=(x86_64)
url='https://www.tcpdump.org/'
license=(BSD)
depends=(glibc libnl sh)
makedepends=(bluez-libs dbus)
provides=(libpcap.so)
options=(debug)
source=("https://www.tcpdump.org/release/${pkgname}-${pkgver}.tar.gz"{,.sig})
sha512sums=('56c314f19c2b857742bf8abcb1e78066986aaa95cec339b75a3c8b70a9fa2b5167da98708352f9ec97a1cea2700cfb4e040bda108d58ac46cec9b7deab88d171'
            'SKIP')
b2sums=('0ec028e5d026a97b92ba6f23f88daf36b827eee08a752a0162fbabd1b5a2a70141ec403b6ff26dc3eb25ca5c6630c9c2f60f05b33161770da3d5e829c4eecdc6'
        'SKIP')
validpgpkeys=('1F166A5742ABB9E0249A8D30E089DEF1D9C15D0D') # The Tcpdump Group

prepare() {
  cd $pkgname-$pkgver
  autoreconf -fiv
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr \
              --enable-ipv6 \
              --enable-bluetooth \
              --enable-usb \
              --with-libnl
  make
}

package() {
  depends+=(libdbus-1.so)

  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 {CHANGES,{CONTRIBUTING,README}.md} -t "$pkgdir/usr/share/doc/$pkgname/"
}
