# Maintainer: Oleg Titov <oleg.titov@gmail.com>

pkgname=iperf3
pkgver=3.19.1
pkgrel=1
pkgdesc='TCP, UDP, and SCTP network bandwidth measurement tool'
arch=('i686' 'x86_64')
url="https://github.com/esnet/iperf"
msys2_references=(
  "anitya: 1389"
  "cpe: cpe:2.3:a:es:iperf3"
  "cpe: cpe:2.3:a:iperf3_project:iperf3"
)
license=('BSD')
depends=('gcc-libs' 'openssl')
makedepends=('openssl-devel' 'autotools' 'gcc')
source=("https://downloads.es.net/pub/iperf/iperf-${pkgver}.tar.gz")
sha256sums=('dc63f89ec581ea99f8b558d8eb35109de06383010db5a1906c208a562ba0c270')

build() {
  cd ${srcdir}/iperf-${pkgver}
  ./configure \
    --build=${CHOST} \
    --host=${CHOST} \
    --target=${CHOST} \
    --prefix=/usr \
    ac_cv_func_SetProcessAffinityMask=no

  make
}

check() {
  cd ${srcdir}/iperf-${pkgver}
  make check
}

package() {
  cd ${srcdir}/iperf-${pkgver}
  make DESTDIR=${pkgdir} install
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 examples/*{.am,.in,.c} -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
}
