# Maintainer: Frederik Schwan <freswa at archlinux dot org>
# Contributor: Amish <contact at via dot aur>
# Contributor: Victor3D <webmaster@victor3d.com.br>

pkgname=fetchmail
pkgver=6.5.6
pkgrel=1
pkgdesc='A remote-mail retrieval utility'
arch=('x86_64')
url='https://www.fetchmail.info'
license=('GPL')
depends=('openssl')
makedepends=('python')
optdepends=('tk: for using fetchmailconf')
source=("https://sourceforge.net/projects/fetchmail/files/branch_${pkgver%.*}/${pkgname}-${pkgver}.tar.xz"{,.asc}
        'fetchmail.tmpfiles'
        'fetchmail.sysusers'
        'fetchmail@.service'
        'fetchmail.service')
b2sums=('cef4a2d2f7611cea3ab689c3cd6cedd7f598fef7f28908621b74d788fa8a3b747fb5b70fb3637052bce4f75eaa35f910ea7c41444becf9330248a6548a6cc984'
        'SKIP'
        'b4ffb99efe4ab24a5a9ed3a27ad5a4645ef8611d66ca380e6acd36e81b34d2619142d62854fa7bd7716b8013d3ccf75ea3e1e18151ae95ff6c37c839631a5733'
        '0f413bcc148ce342036d780d321cd6303928903f22f819a9920ab5ec66304241f4ed340338042e625dc7c03b845e35b9c06aac566b46d64dfe614af3a9cdb2dc'
        'b8740cab8a59cc6c3082973e60d3eb262e3a76aa2b0517336d8f95fd4214a5ccbb2e292301d9112ede0747335f7f8d2815eb38b958085f702c01be30aa107f72'
        'a86822f27f5f4c7b97f24baebcd383b5cc2a4fa7810226139e2c588368637417dbfa52f884a8fcc04b904fc1ac865189feb2070a215a8abf9c0192584c2dbbef')
validpgpkeys=('DC4A655BD993CD4871FA8210E412B156EFF3855A') # Matthias Andree

build() {
  cd ${pkgname}-${pkgver}
  ./configure --prefix=/usr --with-ssl=/usr
  make
}

package() {
  install -D -m644 fetchmail.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/fetchmail.conf
  install -D -m644 fetchmail.sysusers "${pkgdir}"/usr/lib/sysusers.d/fetchmail.conf
  install -D -m644 fetchmail.service "${pkgdir}"/usr/lib/systemd/system/fetchmail.service
  install -D -m644 fetchmail@.service "${pkgdir}"/usr/lib/systemd/system/fetchmail@.service

  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
