db-move: moved webkit2gtk from [testing] to [extra] (x86_64)
[arch-packages.git] / postfix / repos / extra-x86_64 / PKGBUILD
blob06b4c048124be51a42cda40cc0b18296bdc94204
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>
6 pkgbase=postfix
7 pkgname=(
8   postfix
9   postfix-{cdb,ldap,lmdb,mysql,pcre,pgsql,sqlite}
11 pkgver=3.8.0
12 pkgrel=1
13 pkgdesc="Fast, easy to administer, secure mail server"
14 arch=(x86_64)
15 url="http://www.postfix.org/"
16 license=(EPL)
17 depends=(glibc)
18 makedepends=(
19   db
20   icu
21   libldap
22   libnsl
23   libsasl
24   lmdb
25   mariadb-libs
26   openssl
27   pcre2
28   postgresql-libs
29   sqlite
30   tinycdb
31   zlib
33 source=(
34   https://de.postfix.org/ftpmirror/official/$pkgbase-$pkgver.tar.gz
35   $pkgbase-$pkgver.tar.gz.sig::https://de.postfix.org/ftpmirror/official/$pkgbase-$pkgver.tar.gz.gpg2
36   $pkgbase-3.5.8-main_defaults.patch
37   $pkgbase.service
38   $pkgbase.sysusers
39   $pkgbase.tmpfiles
41 sha512sums=('a66956b0cc5eb6ad5ee926348b584ba5640586784aec794a84c40472faecb6313d46537c9f5696edfd8fda070591925a0cfaedc014e15bb3496195e5fb9ee4bd'
42             'SKIP'
43             '7b2785aa8120ca3ff91b405baf675e9e11f8d58b18a9b842672e7ae30932febddac10556a70823d8746fcb160bceb4dbabdee45cf46b02fc0127057656fb85c4'
44             '27f54747ad480d65b560c9dbc97e12c6353e4bceca0ffe3e358e31de56db0ad79928164c9f8790c73a9f791daa378253d2ee29b5a766661778553ec889b2cf97'
45             'a7f15970f613ae7b98ce1b84ca0a6034ce3cc7b2b9ce7160dad9731f740fb762f4a54f44acceb5f06f8744fa9e952b088086af8a69da388a600b742a3cda37f2'
46             'd08574a6acd595fc146513c92dc1bb341c3432d67de1e93ab73a7ce60e385dd34f3a55e3d3d7aec5f358ac4aae260f028599ac47650ebc663cea3043a760a7bc')
47 b2sums=('3ef0c0c83eed3263c890143ae962674dfbfa01f589f1b503a01d57497e4732171aa58468357276f29a9454c577573e8442095c2db25005324754dbd305875297'
48         'SKIP'
49         'b5f19e0619f1fb017cd889c14e341c21146b3afe7b9eefcdb7fb1eb83a357434b899d1e92f3ab0023c78ef8f2de6ae54c4599ee0f0bd04d257f4ca0a4dc9a16c'
50         '02dd441cf6e4a7c2bc0de876f020b0784d811f77a5c6102dd075d67b07158dbc53c8b4d62bc8035283d4f349008574b1c3fac03f4519d56ffd809cb5bcfb7bea'
51         'db58b7deb24cea16fb84f56680f0000683f72e11a95039969878e3819607aad5e65af9d9f50007e7710609065c0e3ebb9b30c1d929162b74eca5e74434d82cf1'
52         'de31693cea5f452a9c8c0d1cf5210a6e67c0176f8b1a4d74106f2e803911569e9fdbb2301b3b5dc7ad6a6da285026b1a3ed3de52117d216b030cf0d92348909d')
53 validpgpkeys=('622C7C012254C186677469C50C0B590E80CA15A7') # Wietse Venema <wietse@porcupine.org>
55 _pick() {
56   local p="$1" f d; shift
57   for f; do
58     d="$srcdir/$p/${f#$pkgdir/}"
59     mkdir -p "$(dirname "$d")"
60     mv "$f" "$d"
61     rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
62   done
65 prepare() {
66   # add distribution defaults to main.cf (alias_maps and alias_database)
67   patch -Np1 -d $pkgbase-$pkgver -i ../$pkgbase-3.5.8-main_defaults.patch
70 build() {
71   local ccargs=(
72     '-fPIC' '-fcommon'
73     '-DUSE_SASL_AUTH'
74     '-DUSE_CYRUS_SASL' '-I/usr/include/sasl'
75     '-DHAS_LDAP'
76     '-DUSE_LDAP_SASL'
77     '-DHAS_LMDB'
78     '-DUSE_TLS'
79     '-DHAS_MYSQL' '-I/usr/include/mysql'
80     '-DHAS_PCRE=2'
81     '-DHAS_PGSQL' '-I/usr/include/postgresql'
82     '-DHAS_SQLITE'
83     '-DHAS_CDB'
84     '-DDEF_COMMAND_DIR=\"/usr/bin\"'
85     '-DDEF_DAEMON_DIR=\"/usr/lib/postfix/bin\"'
86     '-DDEF_SENDMAIL_PATH=\"/usr/bin/sendmail\"'
87     '-DDEF_README_DIR=\"/usr/share/doc/postfix\"'
88     '-DDEF_MANPAGE_DIR=\"/usr/share/man\"'
89   )
90   # NOTE: descriptions of options in makedefs
91   local make_options=(
92     DEBUG=''
93     pie=yes
94     shared=yes
95     dynamicmaps=yes
96     CCARGS="${ccargs[*]}"
97     AUXLIBS="$(pkgconf --libs openssl libsasl2) -lnsl"
98     AUXLIBS_LDAP='-lldap -llber'
99     AUXLIBS_LMDB="$(pkgconf --libs lmdb)"
100     AUXLIBS_PCRE="$(pcre2-config --libs8)"
101     AUXLIBS_MYSQL="$(pkgconf --libs mariadb)"
102     AUXLIBS_PGSQL="$(pkgconf --libs libpq)"
103     AUXLIBS_SQLITE="$(pkgconf --libs sqlite3)"
104     AUXLIBS_CDB='-lcdb'
105     SHLIB_RPATH="-Wl,-rpath,/usr/lib/postfix $LDFLAGS"
106     OPT="$CFLAGS $CPPFLAGS $LDFLAGS"
107   )
109   make makefiles "${make_options[@]}" -C $pkgbase-$pkgver
110   make -C $pkgbase-$pkgver
113 package_postfix() {
114   local _name _feature
116   local _dynamicmaps_file="$pkgdir/etc/$pkgbase/dynamicmaps.cf"
117   local _dynamicmaps_dir="$pkgdir/etc/$pkgbase/dynamicmaps.cf.d"
118   local _files_file="$pkgdir/etc/$pkgbase/$pkgbase-files"
119   local _files_dir="$pkgdir/etc/$pkgbase/$pkgbase-files.d"
121   depends+=(
122     db
123     icu libicuuc.so
124     libnsl libnsl.so
125     libsasl libsasl2.so
126     openssl libcrypto.so libssl.so
127     zlib
128   )
129   optdepends=(
130     'perl: for postfix-collate.pl, postfix-tlstype.pl and qshape'
131     'postfix-cdb: for CDB integration'
132     'postfix-ldap: for LDAP integration'
133     'postfix-lmdb: for LMDB integration'
134     'postfix-mysql: for MySQL integration'
135     'postfix-pcre: for PCRE integration'
136     'postfix-pgsql: for PostgreSQL integration'
137     'postfix-sqlite: for SQLite integration'
138   )
139   conflicts=(smtp-server smtp-forwarder)
140   provides=(smtp-server smtp-forwarder)
141   backup=(etc/postfix/{access,aliases,canonical,generic,header_checks,main.cf,master.cf,relocated,transport,virtual})
142   install=$pkgbase.install
144   cd $pkgname-$pkgver
145   LD_LIBRARY_PATH="lib:$LD_LIBRARY_PATH" \
146   sh postfix-install -non-interactive install_root="$pkgdir"
148   # additional man pages and scripts
149   for _name in posttls-finger {smtp,qmqp}-{sink,source}; do
150     install -vDm 644 man/man1/$_name.1 -t "$pkgdir/usr/share/man/man1/"
151     install -vDm 755 bin/$_name -t "$pkgdir/usr/bin/"
152   done
153   install -vDm 644 man/man1/qshape.1 -t "$pkgdir/usr/share/man/man1/"
154   install -vDm 755 auxiliary/qshape/qshape.pl "$pkgdir/usr/bin/qshape"
155   install -vDm 755 auxiliary/collate/collate.pl "$pkgdir/usr/bin/postfix-collate.pl"
156   install -vDm 755 auxiliary/collate/tlstype.pl "$pkgdir/usr/bin/postfix-tlstype.pl"
157   install -vDm 644 auxiliary/collate/README* -t "$pkgdir/usr/share/doc/$pkgname/collate/"
158   # license
159   install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
160   # systemd service
161   install -vDm 644 ../$pkgname.service -t "$pkgdir/usr/lib/systemd/system/"
162   # sysusers.d
163   install -vDm 644 ../$pkgname.sysusers "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
164   # tmpfiles.d
165   # NOTE: follows setup in conf/postfix-files
166   install -vDm 644 ../$pkgname.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
168   # create dynamicmaps.cf.d and postfix-files.d entries for split packages
169   # remove targetted files from main configuration files
170   for _feature in {cdb,ldap,lmdb,mysql,pcre,pgsql,sqlite}; do
171     printf "Split out dynamicmaps file for %s\n" $pkgbase-$_feature
172     grep "$pkgbase-$_feature" "$_dynamicmaps_file" > "$_dynamicmaps_dir/$pkgbase-$_feature.cf"
173     sed -e "/$pkgbase-$_feature/d" -i "$_dynamicmaps_file"
174     (
175       cd "$pkgdir"
176       _pick $pkgbase-$_feature etc/$pkgbase/dynamicmaps.cf.d/$pkgbase-$_feature.cf
177     )
179     printf "Split out %s from %s-files.d\n" $pkgbase-$_feature $pkgbase
180     grep "$pkgbase-$_feature" "$_files_file" > "$_files_dir/$pkgbase-$_feature.cf"
181     sed -e "/$pkgbase-$_feature/d" -i "$_files_file"
183     printf "Split %s from %s-files\n" ${_feature^^}_README $pkgbase
184     grep "${_feature^^}_README:" "$_files_file" >> "$_files_dir/$pkgbase-$_feature.cf"
185     sed -e "/${_feature^^}_README:/d" -i "$_files_file"
187     if [[ "$_feature" != cdb ]]; then
188       printf "Split %s from %s-files\n" ${_feature}_table.5 $pkgbase
189       grep "${_feature}_table.5:" "$_files_file" >> "$_files_dir/$pkgbase-$_feature.cf"
190       sed -e "/${_feature}_table.5:/d" -i "$_files_file"
191       (
192         cd "$pkgdir"
193         _pick $pkgbase-$_feature usr/share/man/man5/${_feature}_table.5
194       )
195     fi
196     (
197       cd "$pkgdir"
198       _pick $pkgbase-$_feature etc/$pkgbase/$pkgbase-files.d/$pkgbase-$_feature.cf
199       _pick $pkgbase-$_feature usr/lib/$pkgbase/$pkgbase-$_feature.so
200       _pick $pkgbase-$_feature usr/share/doc/$pkgbase/${_feature^^}_README
201     )
202     # install directories that are otherwise cleared by calls to _pick()
203     install -vdm 755 "$_dynamicmaps_dir"
204     install -vdm 755 "$_files_dir"
205   done
207   # remove non-reproducible file, that only lists what the build circumstances were
208   rm -v "$pkgdir/etc/$pkgname/makedefs.out"
209   sed -e '/makedefs/d' -i "$pkgdir/etc/$pkgname/$pkgname-files"
212 package_postfix-cdb() {
213   depends+=(
214     postfix
215     tinycdb libcdb.so
216   )
217   pkgdesc+=' (CDB integration)'
219   mv -v $pkgname/* "$pkgdir"
222 package_postfix-ldap() {
223   depends+=(
224     libldap
225     postfix
226   )
227   pkgdesc+=' (LDAP integration)'
229   mv -v $pkgname/* "$pkgdir"
232 package_postfix-lmdb() {
233   depends+=(
234     lmdb
235     postfix
236   )
237   pkgdesc+=' (LMDB integration)'
239   mv -v $pkgname/* "$pkgdir"
242 package_postfix-mysql() {
243   depends+=(
244     mariadb-libs libmariadb.so
245     postfix
246   )
247   pkgdesc+=' (MySQL integration)'
249   mv -v $pkgname/* "$pkgdir"
252 package_postfix-pcre() {
253   depends+=(
254     pcre2 libpcre2-8.so
255     postfix
256   )
257   pkgdesc+=' (PCRE integration)'
259   mv -v $pkgname/* "$pkgdir"
262 package_postfix-pgsql() {
263   depends+=(
264     postfix
265     postgresql-libs libpq.so
266   )
267   pkgdesc+=' (PostgreSQL integration)'
269   mv -v $pkgname/* "$pkgdir"
272 package_postfix-sqlite() {
273   depends+=(
274     postfix
275     sqlite libsqlite3.so
276   )
277   pkgdesc+=' (SQLite integration)'
279   mv -v $pkgname/* "$pkgdir"