summaryrefslogtreecommitdiff
path: root/community/courier-mta/PKGBUILD
blob: 7b74f25fb472ad690c59715ab812126a9125c2de (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# $Id: PKGBUILD 75460 2010-04-01 16:56:22Z giovanni $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: tobias <tobias@archlinux.org>
# Contributor: Tobias Kieslich <tobias@justdreams.de>

# -----------  NOTE TO ALL USERS ------------
# Go read http://www.courier-mta.org/install.html b4 running or building courier


pkgname=courier-mta
pkgver=0.65.3
pkgrel=1
pkgdesc="IMAP(s)/POP3(s) and SMTP Server with ML-manager, webmail and webconfig"
arch=(i686 x86_64)
license=('GPL2')
backup=('etc/courier/imapd.cnf' 'etc/courier/pop3d.cnf' \
        'etc/courier/imapd' 'etc/courier/imapd-ssl' \
        'etc/courier/pop3d' 'etc/courier/pop3d-ssl' \
        'etc/courier/courierd' 'etc/courier/sqwebmaild' \
        'etc/courier/esmtpd' 'etc/courier/esmtpd-ssl' \
        'etc/courier/esmtpd.cnf' 'etc/courier/esmtpd-msa' \
        'etc/courier/webadmin/password' 'etc/courier/esmtpauthclient' \
        'etc/conf.d/courier-mta')
url="http://courier-mta.org"
depends=('courier-authlib>=0.63.0' 'fam' 'gcc-libs' 'gdbm' 'pcre' 'mime-types' 'ca-certificates')
optdepends=('libldap')
makedepends=('apache>=2.2.9-3' 'pam>=1.0.1-2' 'expect' 'gnupg' 'libldap' 'fam')
provides=('smtp-server' 'imap-server' 'pop3-server' 'courier-imap' 'courier-maildrop')
conflicts=('courier-imap' 'smtp-server' 'imap-server' 'courier-maildrop' 'ucspi-tcp')
options=('!libtool')
install=courier-mta.install
source=(http://downloads.sourceforge.net/project/courier/courier/${pkgver}/courier-${pkgver}.tar.bz2
        courier-mta.rc.d courier-mta.conf.d )
md5sums=('581f73ffad17e0a106177ff1209b042d'
         '6b05b7f4f633201e8ae471a185e779df'
         'f3ff70b40c7a1f7a017e8c4cc4d92f4f')

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

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

  # courier is more about configuring than compiling :-), lets start the mess
  ./configure --prefix=/usr \
    --sysconfdir=/etc/courier \
    --libdir=/usr/lib \
    --libexecdir=/usr/lib \
    --localstatedir=/var/spool/courier \
    --disable-root-check \
    --enable-unicode \
    --enable-workarounds-for-imap-client-bugs \
    --enable-mimetypes=/etc/mime.types \
    --with-piddir=/var/run/courier \
    --with-locking-method=lockf \
    --with-trashquota \
    --with-db=gdbm \
    --with-trashquota \
    --with-random=/dev/urandom --without-ispell \
    --with-mailuser=courier --with-mailgroup=courier \
    --with-certdb=/etc/ssl/certs/
  make
}

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

  #chown mail.mail ${pkgdir}/var/spool/courier
  make DESTDIR=${pkgdir} install
  # docs say we can get rid of those after make
  find ${pkgdir} -name '*\.a' -exec -rm -f {} \;
  # install the perftest-script for testings
  install -Dm755 courier/perftest1 ${pkgdir}/usr/lib/courier/perftest1
  ###############################################################################
  # this is what usually "make install-configure" does
  # *.dist files get rid of "dist"
  for distfile in ${pkgdir}/etc/courier/*.dist; do
    mv ${distfile} ${pkgdir}/etc/courier/$(basename ${distfile} .dist)
  done
  # install pam files according to the layout used in Archlinux
  for pamfile in ${pkgdir}/etc/courier/*.authpam; do
    sed -i 's|/lib/security/pam_pwdb\.so|pam_unix.so|' ${pamfile}
    #echo "password  required  pam_unix.so" >> $pamfile
    install -Dm 644 ${pamfile} \
      ${pkgdir}/etc/pam.d/$(basename ${pamfile} .authpam | sed "s/d$//")
    rm -f ${pamfile}
  done

  ###############################################################################
  # Arch Linux specific tweaks to make things easier for the user
  # create passwordfile for webadmin -> standard archwebadmin
   sed -i 's|/etc/courier/webadmin/password|$(DESTDIR)/etc/courier/webadmin/password|g' Makefile
   yes "archwebadmin" | make DESTDIR=${pkgdir} install-webadmin-password
  # arch specific scripts
   install -Dm 644 ${srcdir}/${pkgname}.conf.d ${pkgdir}/etc/conf.d/courier-mta
   install -Dm 755 ${srcdir}/${pkgname}.rc.d ${pkgdir}/etc/rc.d/courier-mta
   #install -Dm 655 ${srcdir}/courier-webmail-cleancache.cron.hourly \
   # ${pkgdir}/etc/cron.hourly/courier-webmail-cleancache
  # bug http://bugs.archlinux.org/task/5154
   find ${pkgdir}/usr/lib -name '*\.a' -exec rm -f {} \;
  # fixing some permissions
   chown -R courier:courier ${pkgdir}/usr/lib/courier/modules
   chown -R courier:courier ${pkgdir}/var/run/courier
   chown root.root ${pkgdir}/usr/{.,bin,lib,sbin,share}
  # make a link to /usr/sbin/sendmail
   install -dm 755 ${pkgdir}/usr/sbin
   cd ${pkgdir}/usr/sbin
   ln -s ../bin/sendmail ./sendmail
}