# Maintainer: PktSurf <smlinux@pktsurf.in>
app=dovecot
version=2.2.36
build=1sml
homepage="https://www.dovecot.org/"
download="https://dovecot.org/releases/2.2/dovecot-$version.tar.gz"
desc="Open-source IMAP and POP3 server written in C"
requires="expat libcap"

prepbuilddir() {
  mkandenterbuilddir
  rm -rf $app-$version

  tar xf $srcdir/$app-$version.tar.?z*
  cd $app-$version
  fixbuilddirpermissions
}

build() {
  CPPFLAGS="$CFLAGS -D_GNU_SOURCE" \
  lib_cv_va_copy=yes \
  lib_cv___va_copy=no \
  lib_cv_va_val_copy=no \
  i_cv_inotify_works=yes \
  i_cv_posix_fallocate_works=no \
  i_cv_signed_size_t=no \
  i_cv_gmtime_max_time_t=31 \
  i_cv_signed_time_t=yes \
  i_cv_mmap_plays_with_write=yes \
  i_cv_c99_vsnprintf=yes \
  i_cv_fd_passing=yes \
  ./configure \
    --prefix="" \
    --bindir=/bin \
    --sbindir=/bin \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --with-ioloop=poll \
    --with-notify=none \
    --without-lzma \
    --without-gc \
    --without-bzlib \
    --disable-static 

  make -j4
  make install DESTDIR=$pkg

  cp COPYING* $pkgdocs/

  install -Dm 644 $srcdir/dovecot.conf.sample $pkg/etc/dovecot/dovecot.conf.new

  preprunitservice -s dovecot -d

  mkfinalpkg
}

sha512sums="
d10d0f7d1e5ec393de9d1b3b23e80d905e9c4d7fb864cbefe27e6b359928c08b5a6827f501effaca4eee277ddb3336f0d830c0aee4a81301df962f3f491fbfd8  dovecot-2.2.36.tar.lz
"
