1 # Maintainer: David Runge <dvzrv@archlinux.org>
2 # Contributor: Gaetan Bisson <bisson@archlinux.org>
3 # Contributor: Jeff Brodnax <tullyarcher@bellsouth.net>
4 # Contributor: Paul Mattal <paul@archlinux.org>
7 pkgname=(postfix postfix-cdb postfix-ldap postfix-lmdb postfix-mysql
8 postfix-pcre postfix-pgsql postfix-sqlite)
11 pkgdesc="Fast, easy to administer, secure mail server"
13 url="http://www.postfix.org/"
16 makedepends=(db icu libldap libnsl libsasl lmdb mariadb-libs openssl pcre2
17 postgresql-libs sqlite tinycdb zlib)
20 https://de.postfix.org/ftpmirror/official/$pkgname-$pkgver.tar.gz
21 $pkgname-$pkgver.tar.gz.sig::https://de.postfix.org/ftpmirror/official/$pkgname-$pkgver.tar.gz.gpg2
22 $pkgname-3.5.8-main_defaults.patch
27 sha512sums=('23bb1af6bf3743c741f108da136f64613f9062d121dc459944ac192275335952cd309ffec6c380f5d36430605eec538c2549c3fdee9d4597f739d9d1b0a033fc'
29 '7b2785aa8120ca3ff91b405baf675e9e11f8d58b18a9b842672e7ae30932febddac10556a70823d8746fcb160bceb4dbabdee45cf46b02fc0127057656fb85c4'
30 '27f54747ad480d65b560c9dbc97e12c6353e4bceca0ffe3e358e31de56db0ad79928164c9f8790c73a9f791daa378253d2ee29b5a766661778553ec889b2cf97'
31 'a7f15970f613ae7b98ce1b84ca0a6034ce3cc7b2b9ce7160dad9731f740fb762f4a54f44acceb5f06f8744fa9e952b088086af8a69da388a600b742a3cda37f2'
32 'd08574a6acd595fc146513c92dc1bb341c3432d67de1e93ab73a7ce60e385dd34f3a55e3d3d7aec5f358ac4aae260f028599ac47650ebc663cea3043a760a7bc')
33 b2sums=('3f7aaba222b64274f756ea37b8ac06c29469d9183879deb4942a709d75783f4a8ca81204971b6658aba4b5bea46ed9c21b14e1f8fc6b613f257acd3aad16c170'
35 'b5f19e0619f1fb017cd889c14e341c21146b3afe7b9eefcdb7fb1eb83a357434b899d1e92f3ab0023c78ef8f2de6ae54c4599ee0f0bd04d257f4ca0a4dc9a16c'
36 '02dd441cf6e4a7c2bc0de876f020b0784d811f77a5c6102dd075d67b07158dbc53c8b4d62bc8035283d4f349008574b1c3fac03f4519d56ffd809cb5bcfb7bea'
37 'db58b7deb24cea16fb84f56680f0000683f72e11a95039969878e3819607aad5e65af9d9f50007e7710609065c0e3ebb9b30c1d929162b74eca5e74434d82cf1'
38 'de31693cea5f452a9c8c0d1cf5210a6e67c0176f8b1a4d74106f2e803911569e9fdbb2301b3b5dc7ad6a6da285026b1a3ed3de52117d216b030cf0d92348909d')
39 validpgpkeys=('622C7C012254C186677469C50C0B590E80CA15A7') # Wietse Venema <wietse@porcupine.org>
42 local p="$1" f d; shift
44 d="$srcdir/$p/${f#$pkgdir/}"
45 mkdir -p "$(dirname "$d")"
47 rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
52 # add distribution defaults to main.cf (alias_maps and alias_database)
53 patch -Np1 -d $pkgbase-$pkgver -i ../$pkgbase-3.5.8-main_defaults.patch
60 '-DUSE_CYRUS_SASL' '-I/usr/include/sasl'
65 '-DHAS_MYSQL' '-I/usr/include/mysql'
67 '-DHAS_PGSQL' '-I/usr/include/postgresql'
70 '-DDEF_COMMAND_DIR=\"/usr/bin\"'
71 '-DDEF_DAEMON_DIR=\"/usr/lib/postfix/bin\"'
72 '-DDEF_SENDMAIL_PATH=\"/usr/bin/sendmail\"'
73 '-DDEF_README_DIR=\"/usr/share/doc/postfix\"'
74 '-DDEF_MANPAGE_DIR=\"/usr/share/man\"'
77 # NOTE: descriptions of variables in makedefs
83 CCARGS="${_ccargs[*]}" \
84 AUXLIBS="$(pkgconf --libs openssl libsasl2) -lnsl" \
85 AUXLIBS_LDAP='-lldap -llber' \
86 AUXLIBS_LMDB="$(pkgconf --libs lmdb)" \
87 AUXLIBS_PCRE="$(pcre2-config --libs8)" \
88 AUXLIBS_MYSQL="$(pkgconf --libs mariadb)" \
89 AUXLIBS_PGSQL="$(pkgconf --libs libpq)" \
90 AUXLIBS_SQLITE="$(pkgconf --libs sqlite3)" \
92 SHLIB_RPATH="-Wl,-rpath,/usr/lib/postfix $LDFLAGS" \
93 OPT="$CFLAGS $CPPFLAGS $LDFLAGS" \
96 make -C $pkgbase-$pkgver
102 local _dynamicmaps_file="$pkgdir/etc/$pkgbase/dynamicmaps.cf"
103 local _dynamicmaps_dir="$pkgdir/etc/$pkgbase/dynamicmaps.cf.d"
104 local _files_file="$pkgdir/etc/$pkgbase/$pkgbase-files"
105 local _files_dir="$pkgdir/etc/$pkgbase/$pkgbase-files.d"
107 depends+=(db libsasl openssl zlib libicuuc.so libnsl.so)
109 'perl: for postfix-collate.pl, postfix-tlstype.pl and qshape'
110 'postfix-cdb: for CDB integration'
111 'postfix-ldap: for LDAP integration'
112 'postfix-lmdb: for LMDB integration'
113 'postfix-mysql: for MySQL integration'
114 'postfix-pcre: for PCRE integration'
115 'postfix-pgsql: for PostgreSQL integration'
116 'postfix-sqlite: for SQLite integration'
118 conflicts=(smtp-server smtp-forwarder)
119 provides=(smtp-server smtp-forwarder)
120 backup=(etc/postfix/{access,aliases,canonical,generic,header_checks,main.cf,master.cf,relocated,transport,virtual})
121 install=$pkgbase.install
124 LD_LIBRARY_PATH="lib:$LD_LIBRARY_PATH" \
125 sh postfix-install -non-interactive install_root="$pkgdir"
127 # additional man pages and scripts
128 for _name in posttls-finger {smtp,qmqp}-{sink,source}; do
129 install -vDm 644 man/man1/$_name.1 -t "$pkgdir/usr/share/man/man1/"
130 install -vDm 755 bin/$_name -t "$pkgdir/usr/bin/"
132 install -vDm 644 man/man1/qshape.1 -t "$pkgdir/usr/share/man/man1/"
133 install -vDm 755 auxiliary/qshape/qshape.pl "$pkgdir/usr/bin/qshape"
134 install -vDm 755 auxiliary/collate/collate.pl "$pkgdir/usr/bin/postfix-collate.pl"
135 install -vDm 755 auxiliary/collate/tlstype.pl "$pkgdir/usr/bin/postfix-tlstype.pl"
136 install -vDm 644 auxiliary/collate/README* -t "$pkgdir/usr/share/doc/$pkgname/collate/"
138 install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
140 install -vDm 644 ../$pkgname.service -t "$pkgdir/usr/lib/systemd/system/"
142 install -vDm 644 ../$pkgname.sysusers "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
144 # NOTE: follows setup in conf/postfix-files
145 install -vDm 644 ../$pkgname.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
147 # create dynamicmaps.cf.d and postfix-files.d entries for split packages
148 # remove targetted files from main configuration files
149 for _feature in {cdb,ldap,lmdb,mysql,pcre,pgsql,sqlite}; do
150 printf "Split out dynamicmaps file for %s\n" $pkgbase-$_feature
151 grep "$pkgbase-$_feature" "$_dynamicmaps_file" > "$_dynamicmaps_dir/$pkgbase-$_feature.cf"
152 sed -e "/$pkgbase-$_feature/d" -i "$_dynamicmaps_file"
155 _pick $pkgbase-$_feature etc/$pkgbase/dynamicmaps.cf.d/$pkgbase-$_feature.cf
158 printf "Split out %s from %s-files.d\n" $pkgbase-$_feature $pkgbase
159 grep "$pkgbase-$_feature" "$_files_file" > "$_files_dir/$pkgbase-$_feature.cf"
160 sed -e "/$pkgbase-$_feature/d" -i "$_files_file"
162 printf "Split %s from %s-files\n" ${_feature^^}_README $pkgbase
163 grep "${_feature^^}_README:" "$_files_file" >> "$_files_dir/$pkgbase-$_feature.cf"
164 sed -e "/${_feature^^}_README:/d" -i "$_files_file"
166 if [[ "$_feature" != cdb ]]; then
167 printf "Split %s from %s-files\n" ${_feature}_table.5 $pkgbase
168 grep "${_feature}_table.5:" "$_files_file" >> "$_files_dir/$pkgbase-$_feature.cf"
169 sed -e "/${_feature}_table.5:/d" -i "$_files_file"
172 _pick $pkgbase-$_feature usr/share/man/man5/${_feature}_table.5
177 _pick $pkgbase-$_feature etc/$pkgbase/$pkgbase-files.d/$pkgbase-$_feature.cf
178 _pick $pkgbase-$_feature usr/lib/$pkgbase/$pkgbase-$_feature.so
179 _pick $pkgbase-$_feature usr/share/doc/$pkgbase/${_feature^^}_README
181 # install directories that are otherwise cleared by calls to _pick()
182 install -vdm 755 "$_dynamicmaps_dir"
183 install -vdm 755 "$_files_dir"
186 # remove non-reproducible file, that only lists what the build circumstances were
187 rm -v "$pkgdir/etc/$pkgname/makedefs.out"
188 sed -e '/makedefs/d' -i "$pkgdir/etc/$pkgname/$pkgname-files"
191 package_postfix-cdb() {
192 depends+=(postfix libcdb.so)
193 pkgdesc+=' (CDB integration)'
195 mv -v $pkgname/* "$pkgdir"
198 package_postfix-ldap() {
199 depends+=(postfix libldap)
200 pkgdesc+=' (LDAP integration)'
202 mv -v $pkgname/* "$pkgdir"
205 package_postfix-lmdb() {
206 depends+=(lmdb postfix)
207 pkgdesc+=' (LMDB integration)'
209 mv -v $pkgname/* "$pkgdir"
212 package_postfix-mysql() {
213 depends+=(postfix libmariadb.so)
214 pkgdesc+=' (MySQL integration)'
216 mv -v $pkgname/* "$pkgdir"
219 package_postfix-pcre() {
220 depends+=(pcre2 postfix)
221 pkgdesc+=' (PCRE integration)'
223 mv -v $pkgname/* "$pkgdir"
226 package_postfix-pgsql() {
227 depends+=(postfix libpq.so)
228 pkgdesc+=' (PostgreSQL integration)'
230 mv -v $pkgname/* "$pkgdir"
233 package_postfix-sqlite() {
234 depends+=(postfix sqlite)
235 pkgdesc+=' (SQLite integration)'
237 mv -v $pkgname/* "$pkgdir"