# Description: Sender Policy Framework record checking library
# URL: https://www.libspf2.org/
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: libnsl libmilter

name=libspf2
version=1.2.11
release=1
_commit=8131fe140704eaae695e76b5cd09e39bd1dd220b
source=(https://github.com/shevek/libspf2/archive/$_commit/$name-$version.tar.gz
  0001-remove-libreplace-unneeded-on-Linux.patch
  0002-add-include-string-for-memset.patch
  CVE-2023-42118-and-other-fixes.patch)

build() {
  cd $name-$_commit

  patch -Np1 -i $SRC/0001-remove-libreplace-unneeded-on-Linux.patch
  patch -Np1 -i $SRC/0002-add-include-string-for-memset.patch
  patch -Np1 -i $SRC/CVE-2023-42118-and-other-fixes.patch

  autoreconf -vfi
  ./configure --prefix=/usr
  make
  make DESTDIR=$PKG install

  rm $PKG/usr/bin/*_static $PKG/usr/bin/spfd $PKG/usr/bin/spf_example $PKG/usr/bin/spftest
}
