postfix/postfix.spec

changeset 652
f6c0237e8f1c
parent 178
0ba300bdf30a
child 671
f82939c12e5f
equal deleted inserted replaced
2:aaa29b7e514e 3:b1ce51b1cad4
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE. 21 ## SUCH DAMAGE.
22 ## 22 ##
23 23
24 # package versions 24 # package versions
25 %define V_postfix 2.5.6 25 %define V_postfix 2.9.4
26 %define V_pflogsumm 1.1.2 26 %define V_pflogsumm 1.1.5
27 %define V_whoson 2.4.0 27 %define V_whoson 2.4.0
28 28
29 # package information 29 # package information
30 Name: postfix 30 Name: postfix
31 Summary: Mail Transfer Agent (MTA) 31 Summary: Mail Transfer Agent (MTA)
35 Distribution: OpenPKG Community 35 Distribution: OpenPKG Community
36 Class: BASE 36 Class: BASE
37 Group: Mail 37 Group: Mail
38 License: IPL 38 License: IPL
39 Version: %{V_postfix} 39 Version: %{V_postfix}
40 Release: 20090418 40 Release: 20120800
41 41
42 # package options 42 # package options
43 %option with_fsl yes 43 %option with_fsl yes
44 %option with_ssl no 44 %option with_ssl no
45 %option with_sasl no 45 %option with_sasl no
46 %option with_sqlite no
46 %option with_mysql no 47 %option with_mysql no
47 %option with_pgsql no 48 %option with_pgsql no
48 %option with_ldap no 49 %option with_ldap no
49 %option with_whoson no 50 %option with_whoson no
50 %option with_fdsetsize no 51 %option with_fdsetsize no
55 Source2: postfix.txt 56 Source2: postfix.txt
56 Source3: fsl.postfix 57 Source3: fsl.postfix
57 Source4: rc.postfix 58 Source4: rc.postfix
58 Patch0: postfix.patch 59 Patch0: postfix.patch
59 Patch1: postfix.patch.pfls 60 Patch1: postfix.patch.pfls
60 Patch2: ftp://ftp.openpkg.org/sources/CPY/postfix/postfix-%{V_whoson}-whoson.patch 61 Patch2: http://download.openpkg.org/components/versioned/postfix/postfix-%{V_whoson}-whoson.patch
61 62
62 # build information 63 # build information
63 Prefix: %{l_prefix} 64 BuildPreReq: OpenPKG, openpkg >= 20120101, perl, gcc
64 BuildRoot: %{l_buildroot} 65 PreReq: OpenPKG, openpkg >= 20120101, perl, procmail, perl-time
65 BuildPreReq: OpenPKG, openpkg >= 20060823, perl, gcc
66 PreReq: OpenPKG, openpkg >= 20060823, perl, procmail, perl-time
67 BuildPreReq: make, pcre, db 66 BuildPreReq: make, pcre, db
68 PreReq: make, pcre, db 67 PreReq: make, pcre, db
69 %if "%{with_fsl}" == "yes" 68 %if "%{with_fsl}" == "yes"
70 BuildPreReq: fsl 69 BuildPreReq: fsl
71 PreReq: fsl 70 PreReq: fsl
76 %endif 75 %endif
77 %if "%{with_sasl}" == "yes" 76 %if "%{with_sasl}" == "yes"
78 BuildPreReq: sasl 77 BuildPreReq: sasl
79 PreReq: sasl 78 PreReq: sasl
80 %endif 79 %endif
80 %if "%{with_sqlite}" == "yes"
81 BuildPreReq: sqlite
82 PreReq: sqlite
83 %endif
81 %if "%{with_mysql}" == "yes" 84 %if "%{with_mysql}" == "yes"
82 BuildPreReq: mysql 85 BuildPreReq: mysql
83 PreReq: mysql 86 PreReq: mysql
84 %endif 87 %endif
85 %if "%{with_pgsql}" == "yes" 88 %if "%{with_pgsql}" == "yes"
92 %endif 95 %endif
93 %if "%{with_whoson}" == "yes" 96 %if "%{with_whoson}" == "yes"
94 BuildPreReq: whoson 97 BuildPreReq: whoson
95 PreReq: whoson 98 PreReq: whoson
96 %endif 99 %endif
97 AutoReq: no
98 AutoReqProv: no
99 Provides: MTA 100 Provides: MTA
100 Conflicts: exim, sendmail, ssmtp 101 Conflicts: exim, sendmail, ssmtp
101 102
102 %description 103 %description
103 Postfix is a new-generation Mail Transfer Agent (MTA) able to fully 104 Postfix is a new-generation Mail Transfer Agent (MTA) able to fully
109 o Postfix logs directly to the filesystem via OSSP fsl 110 o Postfix logs directly to the filesystem via OSSP fsl
110 o Berkeley-DB dictionary support 111 o Berkeley-DB dictionary support
111 o PCRE matching support 112 o PCRE matching support
112 o Optional STARTTLS encryption support (see package options) 113 o Optional STARTTLS encryption support (see package options)
113 o Optional SASL2 authentication support (see package options) 114 o Optional SASL2 authentication support (see package options)
115 o Optional SQLite dictionary support (see package options)
114 o Optional MySQL dictionary support (see package options) 116 o Optional MySQL dictionary support (see package options)
115 o Optional PostgreSQL dictionary support (see package options) 117 o Optional PostgreSQL dictionary support (see package options)
116 o Optional OpenLDAP dictionary support (see package options) 118 o Optional OpenLDAP dictionary support (see package options)
117 o Optional WHOSON dictionary support (see package options) 119 o Optional WHOSON dictionary support (see package options)
118 120
127 url = http://jimsun.linxnet.com/postfix_contrib.html 129 url = http://jimsun.linxnet.com/postfix_contrib.html
128 regex = pflogsumm-(__VER__)\.tar\.gz 130 regex = pflogsumm-(__VER__)\.tar\.gz
129 } 131 }
130 prog postfix:whoson = { 132 prog postfix:whoson = {
131 version = %{V_whoson} 133 version = %{V_whoson}
132 url = ftp://ftp.openpkg.org/sources/CPY/postfix/ 134 url = http://download.openpkg.org/components/versioned/postfix/
133 regex = postfix-(__VER__)-whoson.patch 135 regex = postfix-(__VER__)-whoson.patch
134 } 136 }
135 137
136 %prep 138 %prep
137 # unpack distribution files 139 # unpack distribution files
140 142
141 # apply OpenPKG patches 143 # apply OpenPKG patches
142 %patch -p0 144 %patch -p0
143 ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $? 145 ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $?
144 146
145 # remove OpenPKG privelege model incompatible exit conditions
146 %{l_shtool} subst \
147 -e 's;msg_fatal\(.*attribute specifies mail system\);msg_info\1;g' \
148 src/pipe/pipe.c
149
150 # apply vendor WHOSON patch 147 # apply vendor WHOSON patch
151 %if "%{with_whoson}" == "yes" 148 %if "%{with_whoson}" == "yes"
152 %patch -p0 -P 2 149 %patch -p0 -P 2
153 %endif 150 %endif
151
152 # remove OpenPKG privelege model incompatible exit conditions
153 %{l_shtool} subst \
154 -e 's;msg_fatal\(.*attribute specifies mail system\);msg_info\1;g' \
155 src/pipe/pipe.c
156
157 # platform specific corrections
158 case "%{l_platform -t}" in
159 *-sunos5.11 )
160 %{l_shtool} subst \
161 -e 's;#define HAS_NISPLUS;#undef HAS_NISPLUS;' \
162 src/util/sys_defs.h
163 ;;
164 esac
154 165
155 %build 166 %build
156 # configure Postfix (hard-core part I) 167 # configure Postfix (hard-core part I)
157 %{l_shtool} subst \ 168 %{l_shtool} subst \
158 -e 's/var_config_dir, /var_command_dir, /' \ 169 -e 's/var_config_dir, /var_command_dir, /' \
180 AUXLIBS="$AUXLIBS %{l_ldflags}" 191 AUXLIBS="$AUXLIBS %{l_ldflags}"
181 CCARGS="$CCARGS -DHAS_DB" 192 CCARGS="$CCARGS -DHAS_DB"
182 AUXLIBS="$AUXLIBS -ldb" 193 AUXLIBS="$AUXLIBS -ldb"
183 CCARGS="$CCARGS -DHAS_PCRE" 194 CCARGS="$CCARGS -DHAS_PCRE"
184 AUXLIBS="$AUXLIBS -lpcre" 195 AUXLIBS="$AUXLIBS -lpcre"
196 %if "%{with_sqlite}" == "yes"
197 CCARGS="$CCARGS -DHAS_SQLITE"
198 AUXLIBS="$AUXLIBS -lsqlite3"
199 %endif
185 %if "%{with_mysql}" == "yes" 200 %if "%{with_mysql}" == "yes"
186 CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}" 201 CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}"
187 AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm" 202 AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm"
188 %endif 203 %endif
189 %if "%{with_pgsql}" == "yes" 204 %if "%{with_pgsql}" == "yes"
230 -e 's;#define HAS_DBM;#define HAS_DBM_DISABLED;' \ 245 -e 's;#define HAS_DBM;#define HAS_DBM_DISABLED;' \
231 -e 's;#define HAS_DB;#define HAS_DB_DISABLED;' \ 246 -e 's;#define HAS_DB;#define HAS_DB_DISABLED;' \
232 src/util/sys_defs.h 247 src/util/sys_defs.h
233 248
234 # build Postfix 249 # build Postfix
235 %{l_make} %{l_mflags} 250 %{l_make} %{l_mflags -O}
236 251
237 %install 252 %install
238 rm -rf $RPM_BUILD_ROOT
239 253
240 # perform standard installation procedure 254 # perform standard installation procedure
241 %{l_shtool} subst -e "s;chown;true;" postfix-install 255 %{l_shtool} subst -e "s;chown;true;" postfix-install
242 sh postfix-install -non-interactive \ 256 sh postfix-install -non-interactive \
243 install_root=$RPM_BUILD_ROOT \ 257 install_root=$RPM_BUILD_ROOT \
268 *LICENSE makedefs.out bounce.cf.default access aliases \ 282 *LICENSE makedefs.out bounce.cf.default access aliases \
269 canonical header_checks relocated transport virtual \ 283 canonical header_checks relocated transport virtual \
270 main.cf master.cf main.cf.default; do 284 main.cf master.cf main.cf.default; do
271 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg 285 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg
272 done 286 done
273 mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script \
274 $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-script
275 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script*
276 mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/post-install \
277 $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-install
278 287
279 # install default configuration 288 # install default configuration
280 for name in `grep "^<file" %{SOURCE postfix.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do 289 for name in `grep "^<file" %{SOURCE postfix.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
281 (echo ""; cat %{SOURCE postfix.txt}; echo "") |\ 290 (echo ""; cat %{SOURCE postfix.txt}; echo "") |\
282 sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name 291 sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
333 '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \ 342 '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \
334 '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \ 343 '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \
335 '%attr(2755,%{l_musr},%{l_rgrp}) %{l_prefix}/sbin/{postdrop,postqueue}' \ 344 '%attr(2755,%{l_musr},%{l_rgrp}) %{l_prefix}/sbin/{postdrop,postqueue}' \
336 '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix' \ 345 '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix' \
337 '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix' \ 346 '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix' \
347 '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix/pid' \
338 '%dir %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/var/postfix/{maildrop,public}' 348 '%dir %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/var/postfix/{maildrop,public}'
339 349
340 %files -f files 350 %files -f files
341 351
342 %clean 352 %clean
343 rm -rf $RPM_BUILD_ROOT
344 353
345 %pre 354 %pre
346 # before upgrade, save status and stop service 355 # before upgrade, save status and stop service
347 [ $1 -eq 2 ] || exit 0 356 [ $1 -eq 2 ] || exit 0
348 eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}` 357 eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}`
369 %{l_rc} postfix stop 2>/dev/null 378 %{l_rc} postfix stop 2>/dev/null
370 rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log* >/dev/null 2>&1 || true 379 rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log* >/dev/null 2>&1 || true
371 rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.sum* >/dev/null 2>&1 || true 380 rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.sum* >/dev/null 2>&1 || true
372 # remove generated configuration files 381 # remove generated configuration files
373 ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true 382 ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true
374 # remove generated run-time files and directories 383 # remove generated runtime files and directories
375 rm -rf $RPM_INSTALL_PREFIX/etc/postfix/data/* 384 rm -rf $RPM_INSTALL_PREFIX/var/postfix/data/*
376 rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/* 385 rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/*
377 rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/* 386 rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/*
378 rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/* 387 rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/*
379 find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\ 388 find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\
380 xargs rmdir >/dev/null 2>&1 || true 389 xargs rmdir >/dev/null 2>&1 || true

mercurial