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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
#!/bin/sh
# $FreeBSD: /tmp/pcvs/ports/mail/postfix27/scripts/Attic/configure.postfix,v 1.58 2005-02-08 13:51:16 leeym Exp $
if [ -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc ]; then
exit
fi
tempfile=`mktemp -t checklist`
if [ "${POSTFIX_OPTIONS}" ]; then
set ${POSTFIX_OPTIONS}
fi
for i; do
eval status_$i=ON
done
if [ -z "${BATCH}" ]; then
/usr/bin/dialog --title "Postfix configuration options" --clear \
--checklist "\n\
Please select desired options:" -1 -1 16 \
NOPCRE "DISABLE Perl Compatible Regular Expressions" "$status_NOPCRE" \
SASL "Cyrus SASLv1 (Simple Authentication and Security Layer)" "$status_SASL" \
SASL2 "Cyrus SASLv2 (Simple Authentication and Security Layer)" "$status_SASL2" \
SASLKRB "If your SASL requires Kerberos select this option" "$status_SASLKRB" \
SASLKRB5 "If your SASL requires Kerberos5 select this option" "$status_SASLKRB5" \
SPF "SPF support" "$status_SPF" \
TLS "SSL and TLS" "$status_TLS" \
IPv6 "IPv6 support" "$status_IPv6" \
IPv6TLS "IPv6 support with SSL and TLS" "$status_IPv6TLS" \
DB3 "Berkeley DB3 (required if SASL also built with DB3)" "$status_DB3" \
DB40 "Berkeley DB4.0 (required if SASL also built with DB4.0)" "$status_DB40" \
DB41 "Berkeley DB4.1 (required if SASL also built with DB4.1)" "$status_DB41" \
DB42 "Berkeley DB4.2 (required if SASL also built with DB4.2)" "$status_DB42" \
MySQL "MySQL map lookups (choose version with WITH_MYSQL_VER)" "$status_MySQL" \
PgSQL "PostgreSQL map lookups (choose with DEFAULT_PGSQL_VER)" "$status_PgSQL" \
OpenLDAP "OpenLDAP map lookups (choose ver. with WITH_OPENLDAP_VER)" "$status_OpenLDAP" \
VDA "VDA (Virtual Delivery Agent)" "$status_VDA" \
Test "SMTP/LMTP test server and generator" "$status_Test" \
2> $tempfile
retval=$?
if [ -s $tempfile ]; then
set `sed 's/"//g' $tempfile`
fi
rm -f $tempfile
case $retval in
0) if [ -z "$*" ]; then
echo "Nothing selected"
fi
;;
1) echo "Cancel pressed."
exit 1
;;
esac
fi
${MKDIR} ${WRKDIRPREFIX}${CURDIR}
exec > ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
echo "PREFIX= ${PREFIX}"
SUB_TLS="@comment "
SUB_TEST="@comment "
SUB_IPV6="@comment "
SUB_SPF="@comment "
while [ "$1" ]; do
case $1 in
NOPCRE)
echo "WITHOUT_PCRE= yes"
echo "NOPCRE_SUFFIX= +nopcre"
SUB_NOPCRE=""
;;
SASL)
echo "LIB_DEPENDS+= sasl.8:\${PORTSDIR}/security/cyrus-sasl"
echo "POSTFIX_CCARGS+= -DUSE_SASL_AUTH -I\${LOCALBASE}/include -I\${LOCALBASE}/include/sasl1"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib -lsasl -lpam -lcrypt"
echo "SASL_SUFFIX= +sasl"
if [ -f ${PREFIX}/lib/libsasl.a ]; then
if nm ${PREFIX}/lib/libsasl.a | grep -wq "mysql_verify_password"; then
echo "USE_MYSQL=YES"
echo "POSTFIX_CCARGS+= -DHAS_MYSQL -I\${LOCALBASE}/include/mysql"
echo "POSTFIX_AUXLIBS+= \${LOCALBASE}/lib/mysql/libmysqlclient.a -lm -lz"
fi
fi
SUB_SASL=""
;;
SASL2)
echo "LIB_DEPENDS+= sasl2.2:\${PORTSDIR}/security/cyrus-sasl2"
echo "POSTFIX_CCARGS+= -DUSE_SASL_AUTH -I\${LOCALBASE}/include -I\${LOCALBASE}/include/sasl"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib -lsasl2 -lpam -lcrypt"
echo "SASL_SUFFIX= +sasl2"
if [ -f ${PREFIX}/lib/libsasl2.a ]; then
if nm ${PREFIX}/lib/libsasl2.a | grep -wq "mysql_verify_password"; then
echo "USE_MYSQL=YES"
echo "POSTFIX_CCARGS+= -DHAS_MYSQL -I\${LOCALBASE}/include/mysql"
echo "POSTFIX_AUXLIBS+= \${LOCALBASE}/lib/mysql/libmysqlclient.a -lm -lz"
fi
fi
SUB_SASL=""
;;
SASLKRB)
echo "POSTFIX_AUXLIBS+= -lkrb -lcrypto -lcom_err"
;;
SASLKRB5)
echo "POSTFIX_AUXLIBS+= -lkrb5 -lcrypto -lcom_err -lasn1 -lroken"
;;
TLS)
echo "MAN8+= tlsmgr.8"
echo "USE_OPENSSL= yes"
echo "POSTFIX_CCARGS+= -DHAS_SSL -I\${OPENSSLINC}"
echo "POSTFIX_AUXLIBS+= -L\${OPENSSLLIB} -lssl -lcrypto"
echo "DISTFILES+= \${DISTNAME}.tar.gz pfixtls-0.8.18-2.1.3-0.9.7d.tar.gz"
echo "EXTRA_PATCHES+= \${WRKDIR}/pfixtls-0.8.18-2.1.3-0.9.7d/pfixtls.diff"
echo "PATCH_STRIP= -p1"
echo "TLS_SUFFIX= +tls"
SUB_TLS=""
;;
DB3)
if [ "X$BDB_SELECTED" != "X" ]; then
/usr/bin/dialog --msgbox "Select exactly one of the DB3, DB40, DB41 and DB42 options." 5 60 > /dev/stderr
rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
exit 1
fi
echo "LIB_DEPENDS+= db3.3:\${PORTSDIR}/databases/db3"
echo "POSTFIX_CCARGS+= -I\${LOCALBASE}/include/db3"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib -ldb3"
echo "DB_SUFFIX= +db3"
BDB_SELECTED="3"
;;
DB40)
if [ "X$BDB_SELECTED" != "X" ]; then
/usr/bin/dialog --msgbox "Select exactly one of the DB3, DB40, DB41 and DB42 options." 5 60 > /dev/stderr
rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
exit 1
fi
echo "LIB_DEPENDS+= db4.0:\${PORTSDIR}/databases/db4"
echo "POSTFIX_CCARGS+= -I\${LOCALBASE}/include/db4"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib -ldb4"
echo "DB_SUFFIX= +db40"
BDB_SELECTED="40"
;;
DB41)
if [ "X$BDB_SELECTED" != "X" ]; then
/usr/bin/dialog --msgbox "Select exactly one of the DB3, DB40, DB41 and DB42 options." 5 60 > /dev/stderr
rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
exit 1
fi
echo "LIB_DEPENDS+= db41.1:\${PORTSDIR}/databases/db41"
echo "POSTFIX_CCARGS+= -I\${LOCALBASE}/include/db41"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib -ldb41"
echo "DB_SUFFIX= +db41"
BDB_SELECTED="41"
;;
DB42)
if [ "X$BDB_SELECTED" != "X" ]; then
/usr/bin/dialog --msgbox "Select exactly one of the DB3, DB40, DB41 and DB42 options." 5 60 > /dev/stderr
rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
exit 1
fi
echo "LIB_DEPENDS+= db-4.2.2:\${PORTSDIR}/databases/db42"
echo "POSTFIX_CCARGS+= -I\${LOCALBASE}/include/db42"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib/db42/ -ldb"
echo "DB_SUFFIX= +db42"
BDB_SELECTED="42"
;;
MySQL)
echo "USE_MYSQL=YES"
echo "POSTFIX_CCARGS+= -DHAS_MYSQL -I\${LOCALBASE}/include/mysql"
echo "POSTFIX_AUXLIBS+= \${LOCALBASE}/lib/mysql/libmysqlclient.a -lm -lz"
echo "MYSQL_SUFFIX= +mysql"
;;
PgSQL)
echo "USE_PGSQL=YES"
echo "POSTFIX_CCARGS+= -DHAS_PGSQL -I\${LOCALBASE}/include -I\${LOCALBASE}/pgsql/include"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib -L\${LOCALBASE}/pgsql/lib -lpq -lcrypt"
echo "PGSQL_SUFFIX= +pgsql"
;;
OpenLDAP)
echo "USE_OPENLDAP=YES"
echo "POSTFIX_CCARGS+= -DHAS_LDAP -I\${LOCALBASE}/include"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib -lldap -llber"
echo "OPENLDAP_SUFFIX= +openldap"
;;
Test)
echo "BIN1= smtp-sink smtp-source qmqp-source"
# echo "MAN1+= smtp-sink.1 smtp-source.1 qmqp-sink.1 qmqp-source.1"
SUB_TEST=""
;;
SPF)
# see http://www.ipnet6.org/postfix/spf/
echo "LIB_DEPENDS+= spf2.1:\${PORTSDIR}/mail/libspf2"
echo "PATCH_SITES+= http://www.ipnet6.org/postfix/download/"
echo "PATCHFILES+= postfix-libspf2-2.1.5-5.patch"
echo "PATCH_DIST_STRIP= -p1"
echo "POSTFIX_CCARGS+= -I\${LOCALBASE}/include"
echo "POSTFIX_AUXLIBS+= -L\${LOCALBASE}/lib -lspf2"
echo "SPF_SUFFIX= +spf"
## echo "README+= SPF_README"
echo ""
SUB_SPF=""
;;
IPv6)
if [ X$SUB_TLS = "X" ]; then
/usr/bin/dialog --msgbox "Select exactly one of the IPv6 and TLS patches" 5 60 > /dev/stderr
rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
exit 1
fi
echo "PATCH_SITES+= ftp://ftp.stack.nl/pub/postfix/tls+ipv6/1.25/"
echo "PATCHFILES+= ipv6-1.25-pf-2.1.5.patch.gz"
echo "PATCH_DIST_STRIP= -p1"
echo "IPv6_SUFFIX= +ipv6"
echo ""
IPv6SELECTED=YES
SUB_IPV6=""
;;
IPv6TLS)
if [ X$SUB_TLS = "X" -o X$IPv6SELECTED != X ]; then
/usr/bin/dialog --msgbox "Select exactly one of the IPv6 and TLS patches" 5 60 > /dev/stderr
rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
exit 1
fi
echo "MAN8+= tlsmgr.8"
echo "USE_OPENSSL= yes"
echo "POSTFIX_CCARGS+= -DHAS_SSL -I\${OPENSSLINC}"
echo "POSTFIX_AUXLIBS+= -L\${OPENSSLLIB} -lssl -lcrypto"
echo "PATCH_SITES+= ftp://ftp.stack.nl/pub/postfix/tls+ipv6/1.25/"
echo "PATCHFILES+= tls+ipv6-1.25-pf-2.1.5.patch.gz"
echo "PATCH_DIST_STRIP= -p1"
echo "TLS_SUFFIX= +tls+ipv6"
SUB_TLS=""
SUB_IPV6=""
;;
VDA)
echo "PATCH_SITES+= http://web.onda.com.br/nadal/postfix/VDA/"
echo "PATCHFILES+= postfix-2.1.4-trash.patch.gz"
echo "PATCH_DIST_STRIP= -p1"
;;
*)
echo "Unknown option(s): $*" > /dev/stderr
rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
exit 1
;;
esac
shift
done
echo "PLIST_SUB+= SUB_TLS=\"${SUB_TLS}\""
echo "PLIST_SUB+= SUB_TEST=\"${SUB_TEST}\""
echo "PLIST_SUB+= SUB_IPV6=\"${SUB_IPV6}\""
echo "PLIST_SUB+= SUB_SPF=\"${SUB_SPF}\""
# for some reason, if we alter the pkg name this way, the first build (where
# we ask the configure questions) doesn't pick up the extensions, but
# any subsequent build will. so "make; make install" will build twice.
# don't do this for now.
#echo "PKGNAMESUFFIX= \${NOPCRE_SUFFIX}\${SASL_SUFFIX}\${DB_SUFFIX}\${MYSQL_SUFFIX}\${PGSQL_SUFFIX}\${OPENLDAP_SUFFIX}\${TLS_SUFFIX}\${IPv6_SUFFIX}\${SPF_SUFFIX}"
|