# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Baptiste Jonglez <baptiste--aur at jonglez dot org>
# Contributor: Anatol Pomozov <anatol dot pomozov at gmail>
# Contributor: Gustavo Alvarez <s1pkn07@gmail.com>
# Contributor: Kristjan Reinloo <mail at kreinloo dot net>
# Contributor: Pierre Bourdon <delroth@gmail.com>

pkgname=libnatpmp
pkgver=20230423
pkgrel=3.1
pkgdesc='A portable and fully compliant implementation of the NAT-PMP protocol'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='http://miniupnp.free.fr/libnatpmp.html'
license=(BSD)
depends=(glibc)
source=("https://miniupnp.tuxfamily.org/files/libnatpmp-$pkgver.tar.gz")
sha256sums=('0684ed2c8406437e7519a1bd20ea83780db871b3a3a5d752311ba3e889dbfc70')

prepare() {
  cd $pkgname-$pkgver
  sed -e 's/CFLAGS = /CFLAGS += /' -i Makefile
}

build() {
  cd $pkgname-$pkgver
  make
}

package() {
  cd $pkgname-$pkgver
  make INSTALLPREFIX="$pkgdir/usr" INSTALLDIRINC="$pkgdir/usr/include" install
# Install missing header
  install -Dm644 natpmp_declspec.h -t "$pkgdir"/usr/include
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 natpmpc.1 "$pkgdir/usr/share/man/man1/natpmpc.1"
}
