# 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.4.22
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'
            'python-future: for using fetchmailconf')
source=("https://sourceforge.net/projects/fetchmail/files/branch_${pkgver%.*}/${pkgname}-${pkgver}.tar.xz"
        'fetchmail.tmpfiles'
        'fetchmail.sysusers'
        'fetchmail.service')
b2sums=('7086f8a3df263f68ae2034321f63c40fcf4759517f46c67ba4b5d3b33ba07d3bb4f512d749a67a2d76991b46847b6dd9df0795a7a28e8166842454001497cfc9'
        'b4ffb99efe4ab24a5a9ed3a27ad5a4645ef8611d66ca380e6acd36e81b34d2619142d62854fa7bd7716b8013d3ccf75ea3e1e18151ae95ff6c37c839631a5733'
        '5000d2daa40cf36e46bd602d8c1ba45840587d289d19254187f92bced1b557a948e72417bbeaa3efd85e7d19f7f257effc310a96359b85eee6ed96d97d44c1b2'
        'fca5437bec78786b9624c774015b9e0e7175973d548dbdab406af797a8c4a53b474d73b897a0009faee4dafd62190f93514c6f1ce403312b6a51afb4996dbf21')

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
  
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
}
