summaryrefslogtreecommitdiff
path: root/community/courier-mta/PKGBUILD
blob: d4ceae8211fd15cd12343752947c3e7820f03eda (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# $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.66.3
pkgrel=4
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' 'gamin' 'gcc-libs' 'gdbm' 'pcre' 'mime-types' 'ca-certificates')
optdepends=('libldap')
makedepends=('apache>=2.2.9-3' 'pam>=1.0.1-2' 'expect' 'gnupg' 'libldap' 'gamin')
provides=('smtp-server' 'smtp-forwarder' 'imap-server' 'pop3-server' 'courier-imap' 'courier-maildrop')
conflicts=('courier-imap' 'smtp-forwarder' '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.rc.d
        courier-mta.rc.d 
		courier-mta.conf.d
        esmtpd.rc.d
        esmtpd-ssl.rc.d
        esmtpd-msa.rc.d
        imapd.rc.d
        imapd-ssl.rc.d
        pop3d.rc.d
        pop3d-ssl.rc.d
        webmaild.rc.d)
md5sums=('3b28f14afe3db09b74b4845323c3e982'
         '9055ba622efd37603186ce1f37277224'
         '5cbeb5c323706058e545f74ad7752ebe'
         'f3ff70b40c7a1f7a017e8c4cc4d92f4f'
         'caabce8c7b66296b602316aa5af5d4c5'
         '1c8b1b66ebafa4ff09ffc0106a9dc82c'
         'dae6c7d5ff0cce0fba5729fedf2a9051'
         'd0cc5eab5d3e0ec33dadd0392421f63e'
         '5873a96aa149edda281730010fb4db34'
         'faa09e06a5dc41ee89ab1f8fa6886b63'
         '520501daa66c0a94f2e9844ce4919a09'
         '33a93f400c3e87bcd207295b7d7333ca')

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

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 -D -m 755 ${srcdir}/courier.rc.d ${pkgdir}/etc/rc.d/courier
  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 755 ${srcdir}/esmtpd.rc.d ${pkgdir}/etc/rc.d/esmtpd
  install -D -m 755 ${srcdir}/esmtpd-ssl.rc.d ${pkgdir}/etc/rc.d/esmtpd-ssl
  install -D -m 755 ${srcdir}/esmtpd-msa.rc.d ${pkgdir}/etc/rc.d/esmtpd-msa
  install -D -m 755 ${srcdir}/webmaild.rc.d ${pkgdir}/etc/rc.d/webmaild
   #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
   rm -r ${pkgdir}/var/run
   #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
}