summaryrefslogtreecommitdiff
path: root/community/courier-imap/PKGBUILD
blob: 575b7d7b981a20523798c68ba8fb21cdb2971a4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# $Id: PKGBUILD 49375 2011-06-15 09:29:55Z svenstaro $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: tobias <tobias@archlinux.org>
# Committer: Manolis Tzanidakis <manolis@archlinux.org>

pkgname=courier-imap
pkgver=4.9.3
pkgrel=2
pkgdesc="IMAP(s)/POP3(s) Server"
arch=('i686' 'x86_64' 'mips64el')
license=('GPL2')
url="http://www.courier-mta.org/imap/"
depends=('courier-maildrop>=2.5.0' 'gcc-libs' 'fam' 'gdbm' 'openssl')
backup=('etc/courier-imap/imapd.cnf' 'etc/courier-imap/pop3d.cnf' \
        'etc/courier-imap/imapd' 'etc/courier-imap/imapd-ssl' \
        'etc/courier-imap/pop3d' 'etc/courier-imap/pop3d-ssl'\
        'etc/conf.d/courier-imap')
conflicts=('courier-mta')
provides=('imap-server' 'pop3-server')
options=('!libtool')
source=(http://downloads.sourceforge.net/project/courier/imap/${pkgver}/${pkgname}-${pkgver}.tar.bz2
        courier-imap.conf.d
		courier-imap.rc.d
        imapd.rc.d
        imapd-ssl.rc.d
        pop3d.rc.d
        pop3d-ssl.rc.d)
md5sums=('703ddbb090569436dbda61d0d62b1eb8'
         '3e08f017f6c5a52dea28f6f0dbd50b86'
         '3e4910c5a34af68dfdeed932e573a9f9'
         'ca799c7014d002fb9f8ff671610337bd'
         '268693ccf3f081897b78490a70cf3211'
         'c2e65d9b136f59eb0cf5377e7c46de88'
         'e07c43fdf2e5ae6d73fc3281f6332b62')
install=$pkgname.install

# MIGRATION NOTE:
# In 2012, support for courier-imap.conf.d and courier-imap.rc.d will be removed.
# Remove those files and this note and also courier-imap.install

build() {
  cd ${srcdir}/${pkgname}-${pkgver}

  # fix a tiny bug
  sed -i -e \
    's|--with-authchangepwdir=/var/tmp/dev/null|--with-authchangepwdir=$libexecdir/authlib|' \
    configure && chmod 755 configure

  ./configure --prefix=/usr \
    --sysconfdir=/etc/courier-imap \
    --libexecdir=/usr/lib/courier-imap \
    --localstatedir=/var/spool/courier-imap \
    --disable-root-check \
    --enable-unicode \
    --enable-workarounds-for-imap-client-bugs \
    --with-piddir=/var/run/courier \
    --with-trashquota \
    --with-db=gdbm \
    --with-trashquota \
    --with-mailuser=courier --with-mailgroup=courier
  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}

  make DESTDIR=${pkgdir} install

  # cleanup - provided by courier-maildrop
  rm ${pkgdir}/usr/bin/{deliverquota,maildirmake}
  rm ${pkgdir}/usr/share/man/man1/maildirmake*
  rm ${pkgdir}/usr/share/man/man8/deliverquota*
  find ${pkgdir} -name '*\.a' -exec -rm -f {} \;
  ###############################################################################
  # this is what usually "make install-configure" does
  # *.dist files get rid of "dist"
  for distfile in ${pkgdir}/etc/courier-imap/*.dist; do
    mv ${distfile} ${pkgdir}/etc/courier-imap/$(basename ${distfile} .dist)
  done
  sed -i 's|TLS_CERTFILE=/usr/share/|TLS_CERTFILE=/etc/courier-imap/|' \
    ${pkgdir}/etc/courier-imap/*-ssl
  for pamfile in imap/*.pam; do
    sed -i "s|/lib/security/||;s|pam_pwdb|pam_unix|" ${pamfile}
    install -Dm 644 ${pamfile} \
      ${pkgdir}/etc/pam.d/$(basename ${pamfile} .pam | sed "s/d$//")
  done
  # install thingies
  install -D -m 755 ${srcdir}/courier-imap.rc.d ${pkgdir}/etc/rc.d/courier-imap
  install -D -m 755 ${srcdir}/imapd.rc.d ${pkgdir}/etc/rc.d/imapd
  install -D -m 755 ${srcdir}/imapd-ssl.rc.d ${pkgdir}/etc/rc.d/imapd-ssl
  install -D -m 755 ${srcdir}/pop3d.rc.d ${pkgdir}/etc/rc.d/pop3d
  install -D -m 755 ${srcdir}/pop3d-ssl.rc.d ${pkgdir}/etc/rc.d/pop3d-ssl
  install -D -m 644 ${srcdir}/courier-imap.conf.d ${pkgdir}/etc/conf.d/courier-imap
}