# Maintainer: PktSurf <smlinux@pktsurf.in>
app=libmilter
version=1.0.2
sapp=sendmail
sversion=8.16.1
build=1sml
homepage="https://sendmail.org"
download="https://ftp.sendmail.org/sendmail.8.16.1.tar.gz"
desc="Library for opendkim"
requires="musl db"
   
prepbuilddir() {
  mkandenterbuilddir
  rm -rf $sapp-$sversion

  tar xf $srcdir/$sapp.$sversion.tar.?z*
  cd $sapp-$sversion
  fixbuilddirpermissions

  applypatch $srcdir/default-pthread-stacksize.patch
  applypatch $srcdir/libmilter-sharedlib.patch

  cat >> devtools/Site/site.config.m4 <<-EOF
dnl enable ipv6
APPENDDEF(\`conf_libmilter_ENVDEF',\`-DNETINET6=1')
dnl getipnodebyname/getipnodebyaddr is deprecated and not part of musl libc
APPENDDEF(\`conf_libmilter_ENVDEF',\`-DNEEDSGETIPNODE=1')
EOF
}

build() {
  make -C libmilter MILTER_SOVER=$version
  mkdir -p $pkg/lib

  make -C libmilter \
    INCOWN=root INCGRP=root INCMODE=644 \
    LIBOWN=root LIBGRP=root LIBMODE=644 UBINMODE=755 \
    MILTER_SOVER=$version \
    LIBDIR="/lib" \
    INCLUDEDIR="/include" \
    DESTDIR=$pkg install
  
  cp LICENSE $pkgdocs/

  mkfinalpkg
}


sha512sums="
d7d4aac3c6d7505782abdb166204901b8b51cac000d610dfe40eda9eef7441a073af9e8e0b14c8719b07b445f55a1e2c28ac63d663d0daa7f1eafc5a101788b2  sendmail.8.16.1.tar.gz
d3e12943fe7e9babdf700a2d8c0229bc16fa2ea16097615600341dee13f137b157ffa4b03f76c92ba9c5552ca3bf01cb598f6a6201720408df3a37247001a219  default-pthread-stacksize.patch
31c36b57739946c1b9c7c85307fe5c53c45d7f8cbf427a0f2248db8b74871a6f5a30ef1af524915821aeca54310d28272bcd0a587cb918192214fa5c30e4a8da  libmilter-sharedlib.patch
"
