blob: c826dabc0555967673b22af4371a03d05ae922be (
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=postfix
pkgver=3.7.2
pkgrel=2
pkgdesc="Secure and fast drop-in replacement for Sendmail (MTA)"
url="https://www.postfix.org/"
arch="all"
license="IPL-1.0 EPL-2.0"
depends="musl>=1.1.24-r7"
makedepends="
coreutils
cyrus-sasl-dev
hiredis-dev
icu-dev
libpq-dev
linux-headers
lmdb-dev
m4
mariadb-connector-c-dev
openldap-dev
openssl1.1-compat-dev
pcre2-dev
perl
sqlite-dev
"
install="$pkgname.pre-install"
subpackages="
$pkgname-doc
$pkgname-openrc
$pkgname-ldap:_mv_dict
$pkgname-mysql:_mv_dict
$pkgname-pcre:_mv_dict
$pkgname-pgsql:_mv_dict
$pkgname-redis:_mv_dict
$pkgname-sqlite:_mv_dict
$pkgname-stone
"
options="!check suid" # No test suite.
pkgusers="postfix"
pkggroups="postfix postdrop"
source="https://de.postfix.org/ftpmirror/official/postfix-$pkgver.tar.gz
$pkgname.initd
postfix-install.patch
lmdb-default.patch
postfix-redis.patch
dict_redis.c
dict_redis.h
"
_shared_libs() {
file --mime-type "$@" | \
awk -F: '$2 ~ /sharedlib/ {print $1}'
}
prepare() {
default_prepare
sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
-e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/postfix/aliases|" \
src/util/sys_defs.h
sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf
cp "$srcdir"/dict_redis.* src/global/
}
build() {
# needed for dynamic maps.
local ccargs="-DHAS_SHL_LOAD"
local auxlibs="$LDFLAGS"
# berkeley-db
ccargs="$ccargs -DNO_DB"
# pcre2
ccargs="$ccargs -DHAS_PCRE=2 $(pcre2-config --cflags)"
# ssl
ccargs="$ccargs -DUSE_TLS"
auxlibs="$auxlibs -lssl -lcrypto"
# dovecot-sasl
ccargs="$ccargs -DUSE_SASL_AUTH -DDEF_SASL_SERVER=\\\"dovecot\\\""
# cyrus sasl
ccargs="$ccargs -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
auxlibs="$auxlibs -lsasl2"
# postgresql
ccargs="$ccargs -DHAS_PGSQL $(pkg-config --cflags libpq)"
# mysql
ccargs="$ccargs -DHAS_MYSQL $(mysql_config --include)"
# ldap
ccargs="$ccargs -DHAS_LDAP -DUSE_LDAP_SASL"
# sqlite
ccargs="$ccargs -DHAS_SQLITE $(pkg-config --cflags sqlite3)"
# lmdb (make it default)
ccargs="$ccargs -DHAS_LMDB $(pkg-config --cflags lmdb) -DDEF_DB_TYPE=\\\"lmdb\\\""
# redis
ccargs="$ccargs -DHAS_REDIS $(pkg-config --cflags hiredis)"
#
# AUXLIBS_CDB="$cdb_libs" \
# compile
make DEBUG="" \
OPT="$CFLAGS" \
CCARGS="$ccargs" \
AUXLIBS="$auxlibs" \
AUXLIBS_LDAP="-lldap -llber" \
AUXLIBS_MYSQL="$(mysql_config --libs)" \
AUXLIBS_PCRE="$(pkg-config --libs libpcre2-8)" \
AUXLIBS_PGSQL="$(pkg-config --libs libpq)" \
AUXLIBS_SQLITE="$(pkg-config --libs sqlite3)" \
AUXLIBS_LMDB="$(pkg-config --libs lmdb)" \
AUXLIBS_REDIS="$(pkg-config --libs hiredis)" \
config_directory=/etc/postfix \
meta_directory=/etc/postfix \
daemon_directory=/usr/libexec/postfix \
shlib_directory=/usr/lib/postfix \
dynamicmaps=yes \
shared=yes \
makefiles
make OPT="$CFLAGS"
}
_mvline() {
local regex="$1"
local outfile="$3.d/$2"
local infile="$3"
sed -i -E -e "\|$regex|{
w $outfile
d
}" $infile
}
package() {
make non-interactive-package \
install_root="$pkgdir" \
readme_directory=/usr/share/doc/$pkgname/readme \
manpage_directory=/usr/share/man
# Install qshape auxiliary script
install -Dm644 man/man1/qshape.1 -t "$pkgdir"/usr/share/man/man1
install -Dm755 auxiliary/qshape/qshape.pl -t "$pkgdir"/usr/bin
for i in postdrop postqueue; do
chgrp postdrop "$pkgdir"/usr/sbin/$i
chmod g+s "$pkgdir"/usr/sbin/$i
done
mkdir -p "$pkgdir"/usr/share/doc/postfix/defaults/ \
"$pkgdir"/usr/share/licenses/$pkgname/
mv "$pkgdir"/etc/postfix/*.default \
"$pkgdir"/usr/share/doc/postfix/defaults/
mv "$pkgdir"/etc/postfix/*LICENSE* \
"$pkgdir"/usr/share/licenses/$pkgname/
install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
chown postfix "$pkgdir"/var/spool/postfix/* "$pkgdir"/var/lib/postfix
chown root:postfix "$pkgdir"/var/spool/postfix/pid
chgrp postdrop "$pkgdir"/var/spool/postfix/maildrop \
"$pkgdir"/var/spool/postfix/public
cd "$pkgdir"/etc/postfix/
for map in ldap mysql pcre pgsql sqlite lmdb redis; do
msg "split $map"
_mvline "^\s*$map" "$map" dynamicmaps.cf
done
rm makedefs.out
# fix /etc/postfix/postfix-files so that "postfix set-permissions" can run
sed -i \
-e '/shlib_directory\/postfix-/d' \
-e '/meta_directory\/makedefs.out/d' \
-e '/manpage_directory/d' \
-e '/config_directory\/LICENSE/d' \
-e '/config_directory\/TLS_LICENSE/d' \
-e '/config_directory\/[^/]\+\.cf\.default/d' \
"$pkgdir"/etc/postfix/postfix-files
}
_mv_dict() {
local m=${subpkgname##*-}
pkgdesc="$m map support for postfix"
depends=
mkdir -p "$subpkgdir"/usr/lib/postfix \
"$subpkgdir"/etc/postfix/dynamicmaps.cf.d
mv "$pkgdir"/usr/lib/postfix/postfix-$m.so \
"$subpkgdir"/usr/lib/postfix/
mv "$pkgdir"/etc/postfix/dynamicmaps.cf.d/$m \
"$subpkgdir"/etc/postfix/dynamicmaps.cf.d/
}
stone() {
cd $builddir
pkgdesc="Postfix simulation and testing tools"
install -Dm755 src/fsstone/fsstone "$subpkgdir"/usr/bin/fsstone
find src/smtpstone -mindepth 1 -perm 0755 -exec cp {} "$subpkgdir"/usr/bin \;
}
sha512sums="
23bb1af6bf3743c741f108da136f64613f9062d121dc459944ac192275335952cd309ffec6c380f5d36430605eec538c2549c3fdee9d4597f739d9d1b0a033fc postfix-3.7.2.tar.gz
2752e69c4e1857bdcf29444ffb458bca818bc60b9c77c20823c5f5b87c36cb5e0f3217a625a7fe5788d5bfcef7570a1f2149e1233fcd23ccf7ee14190aff47a2 postfix.initd
25cd34f23ca909d4e33aaf3239d1e397260abc7796d9a4456dee4f005682fd3a58aab8106126e5218c95bdddae415a3ef7e2223cd3b0d7b1e2bd76158bb7eaf8 postfix-install.patch
0769e2e503486f8dd6fa21f2c534ad7df7a9f1bb57dde2f0ad61863a3e615d0a6dc18132b27796eb28cd81afb2b4e97c65c9d490a391f835aa3b7b18e74252c5 lmdb-default.patch
56119ecf73fc7b8f3b8e206f2eca05dab1fb0752d9c37e804faebe5fcfa7feca49b8da871ffc9c7f6a247107fef854e09eaf72fc55cea3ca02960db3f8b13c95 postfix-redis.patch
717d65aa7c3d12e0a269693ec460a3ed1dcac5709b64ba1a467d64f45c32e9b140d360673a1e38fe1d4182b8422c4a7a2c9df00f86bf6d9c12601b32db4ee6a1 dict_redis.c
bc8888f1741adaea0217a1debee990c28970a207f1790fa1921579d4c925cf56bf7efd438dee743e8c043e73d7c8f4928d5cd98bc3b273c55ba17ccceaf14987 dict_redis.h
"
|