# Maintainer: Kevin MacMartin <prurigro@gmail.com>

pkgname=force_bind
pkgver=0.13
pkgrel=1
pkgdesc='Force binding on a specific IP and/or port, change TTL/TOS/KA/MSS/REUSEADDR/FWMARK/PRIORITY. Works with both IPv4 and IPv6. Also, you can enforce bandwidth per process or per socket'
url='http://kernel.embedromix.ro/us/'
license=('GPL3')
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
depends=('glibc')

source=(
  "http://kernel.embedromix.ro/us/$pkgname/$pkgname-$pkgver.tar.gz"
  "$pkgname.1"
  "${pkgname}_null-to-strcmp-fix.patch"
)

sha512sums=(
  '37aaac1407118bbeb2ec484318afb1d517979c620ace9eca87b609cf99e7c9cfdc03863d42f017f28567fcbb7f8a23fac33aa70fad379c7841da31be16143da1'
  '4eac471df6329f09ba4f8e66fbdd12daaff58221fbbfacf37d10d5017d9afcf8dd79d9330ca3044310c7c7cf4106f645fea81329d32f76cc15c8524d2677b0ad'
  '3e33eb1158dd89737fa62c018ff5af0419a3900315875363f30194c8ae0cceecd943d2c8e1f139127f5b092c428597f1a570ff072c0c29a60082bc6b990f4be9'
)

prepare() {
  cd $pkgname-$pkgver
  patch -p1 < ../${pkgname}_null-to-strcmp-fix.patch
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  make
}

package() {
  install -Dm644 $pkgname.1 "$pkgdir/usr/share/man/man1/$pkgname.1"
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  mv "$pkgdir/usr/lib64" "$pkgdir/usr/lib"
}
