Sun, 02 Sep 2012 18:18:43 +0200
Introduce new version of tcpdump, reorder taglib and cryptbreaker to
the end because they fail to build on Linux, and correct flawed URLs
probably copied from the doxygen build entry.
1 ##
2 ## postfix.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package versions
25 %define V_postfix 2.9.4
26 %define V_pflogsumm 1.1.5
27 %define V_whoson 2.4.0
29 # package information
30 Name: postfix
31 Summary: Mail Transfer Agent (MTA)
32 URL: http://www.postfix.org/
33 Vendor: Wietse Venema
34 Packager: OpenPKG Foundation e.V.
35 Distribution: OpenPKG Community
36 Class: BASE
37 Group: Mail
38 License: IPL
39 Version: %{V_postfix}
40 Release: 20120800
42 # package options
43 %option with_fsl yes
44 %option with_ssl no
45 %option with_sasl no
46 %option with_sqlite no
47 %option with_mysql no
48 %option with_pgsql no
49 %option with_ldap no
50 %option with_whoson no
51 %option with_fdsetsize no
53 # list of sources
54 Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_postfix}.tar.gz
55 Source1: http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.tar.gz
56 Source2: postfix.txt
57 Source3: fsl.postfix
58 Source4: rc.postfix
59 Patch0: postfix.patch
60 Patch1: postfix.patch.pfls
61 Patch2: http://download.openpkg.org/components/versioned/postfix/postfix-%{V_whoson}-whoson.patch
63 # build information
64 BuildPreReq: OpenPKG, openpkg >= 20120101, perl, gcc
65 PreReq: OpenPKG, openpkg >= 20120101, perl, procmail, perl-time
66 BuildPreReq: make, pcre, db
67 PreReq: make, pcre, db
68 %if "%{with_fsl}" == "yes"
69 BuildPreReq: fsl
70 PreReq: fsl
71 %endif
72 %if "%{with_ssl}" == "yes"
73 BuildPreReq: openssl
74 PreReq: openssl
75 %endif
76 %if "%{with_sasl}" == "yes"
77 BuildPreReq: sasl
78 PreReq: sasl
79 %endif
80 %if "%{with_sqlite}" == "yes"
81 BuildPreReq: sqlite
82 PreReq: sqlite
83 %endif
84 %if "%{with_mysql}" == "yes"
85 BuildPreReq: mysql
86 PreReq: mysql
87 %endif
88 %if "%{with_pgsql}" == "yes"
89 BuildPreReq: postgresql, openssl
90 PreReq: postgresql, openssl
91 %endif
92 %if "%{with_ldap}" == "yes"
93 BuildPreReq: openldap, openssl
94 PreReq: openldap, openssl
95 %endif
96 %if "%{with_whoson}" == "yes"
97 BuildPreReq: whoson
98 PreReq: whoson
99 %endif
100 Provides: MTA
101 Conflicts: exim, sendmail, ssmtp
103 %description
104 Postfix is a new-generation Mail Transfer Agent (MTA) able to fully
105 replace the Sendmail MTA. It is fully standards compliant and
106 supports SMTP, ESMTP, LMTP over IPv4/IPv6 with optional TLS/SASL.
108 Local specifics in this OpenPKG version:
109 o Postfix delivers locally via Procmail
110 o Postfix logs directly to the filesystem via OSSP fsl
111 o Berkeley-DB dictionary support
112 o PCRE matching support
113 o Optional STARTTLS encryption support (see package options)
114 o Optional SASL2 authentication support (see package options)
115 o Optional SQLite dictionary support (see package options)
116 o Optional MySQL dictionary support (see package options)
117 o Optional PostgreSQL dictionary support (see package options)
118 o Optional OpenLDAP dictionary support (see package options)
119 o Optional WHOSON dictionary support (see package options)
121 %track
122 prog postfix = {
123 version = %{V_postfix}
124 url = ftp://ftp.porcupine.org/mirrors/postfix-release/official/
125 regex = postfix-(\d+\.\d+\.\d+)\.tar\.gz
126 }
127 prog postfix:pflogsumm = {
128 version = %{V_pflogsumm}
129 url = http://jimsun.linxnet.com/postfix_contrib.html
130 regex = pflogsumm-(__VER__)\.tar\.gz
131 }
132 prog postfix:whoson = {
133 version = %{V_whoson}
134 url = http://download.openpkg.org/components/versioned/postfix/
135 regex = postfix-(__VER__)-whoson.patch
136 }
138 %prep
139 # unpack distribution files
140 %setup -q
141 %setup -q -T -D -a 1
143 # apply OpenPKG patches
144 %patch -p0
145 ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $?
147 # apply vendor WHOSON patch
148 %if "%{with_whoson}" == "yes"
149 %patch -p0 -P 2
150 %endif
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
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
166 %build
167 # configure Postfix (hard-core part I)
168 %{l_shtool} subst \
169 -e 's/var_config_dir, /var_command_dir, /' \
170 src/postfix/postfix.c
171 %{l_shtool} subst \
172 -e 's;config_directory/postfix-script;command_directory/postfix-script;' \
173 -e 's;config_directory/post-install;command_directory/postfix-install;' \
174 conf/postfix-script
175 %{l_shtool} subst \
176 -e 's;/usr/include;%{l_prefix}/include;g' \
177 makedefs
179 # configure Postfix (regular part)
180 unset LD_LIBRARY_PATH || true
181 CCARGS=""
182 CCARGS="$CCARGS %{l_cflags -O}"
183 CCARGS="$CCARGS %{l_cppflags}"
184 CCARGS="$CCARGS -DDEF_COMMAND_DIR=\\\"%{l_prefix}/sbin\\\""
185 CCARGS="$CCARGS -DDEF_SENDMAIL_PATH=\\\"%{l_prefix}/sbin/sendmail\\\""
186 CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\"%{l_prefix}/etc/postfix\\\""
187 CCARGS="$CCARGS -DDEF_DAEMON_DIR=\\\"%{l_prefix}/libexec/postfix\\\""
188 CCARGS="$CCARGS -DDEF_QUEUE_DIR=\\\"%{l_prefix}/var/postfix\\\""
189 CCARGS="$CCARGS -DDEF_DATA_DIR=\\\"%{l_prefix}/var/postfix/data\\\""
190 AUXLIBS=""
191 AUXLIBS="$AUXLIBS %{l_ldflags}"
192 CCARGS="$CCARGS -DHAS_DB"
193 AUXLIBS="$AUXLIBS -ldb"
194 CCARGS="$CCARGS -DHAS_PCRE"
195 AUXLIBS="$AUXLIBS -lpcre"
196 %if "%{with_sqlite}" == "yes"
197 CCARGS="$CCARGS -DHAS_SQLITE"
198 AUXLIBS="$AUXLIBS -lsqlite3"
199 %endif
200 %if "%{with_mysql}" == "yes"
201 CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}"
202 AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm"
203 %endif
204 %if "%{with_pgsql}" == "yes"
205 CCARGS="$CCARGS -DHAS_PGSQL %{l_cppflags postgresql .}"
206 AUXLIBS="$AUXLIBS -lpq -lssl -lcrypto -lcrypt"
207 %endif
208 %if "%{with_sasl}" == "yes"
209 CCARGS="$CCARGS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL %{l_cppflags sasl .}"
210 AUXLIBS="$AUXLIBS -lsasl2 -lcrypt"
211 if [ -f /usr/lib/libdl.so -o -f /usr/lib/libdl.a ]; then
212 AUXLIBS="$AUXLIBS -ldl"
213 fi
214 if [ -f /usr/lib64/libdl.so -o -f /usr/lib64/libdl.a ]; then
215 AUXLIBS="$AUXLIBS -ldl"
216 fi
217 %endif
218 %if "%{with_ssl}" == "yes"
219 CCARGS="$CCARGS -DUSE_TLS"
220 AUXLIBS="$AUXLIBS -lssl -lcrypto"
221 %endif
222 %if "%{with_ldap}" == "yes"
223 CCARGS="$CCARGS -DHAS_LDAP"
224 AUXLIBS="$AUXLIBS -lldap -llber -lssl -lcrypto"
225 %endif
226 %if "%{with_fsl}" == "yes"
227 AUXLIBS="$AUXLIBS %{l_fsl_ldflags} %{l_fsl_libs}"
228 CCARGS="$CCARGS -DUSE_SOFTLIMITONLY"
229 %endif
230 %if "%{with_fdsetsize}" != "no"
231 %if "%{with_fdsetsize}" == "yes"
232 CCARGS="$CCARGS -DFD_SETSIZE=1024"
233 %else
234 CCARGS="$CCARGS -DFD_SETSIZE=%{with_fdsetsize}"
235 %endif
236 %endif
237 case "%{l_platform -t}" in
238 *-sunos* ) AUXLIBS="$AUXLIBS -lrt" ;;
239 esac
240 %{l_make} %{l_mflags} -f Makefile.init makefiles \
241 CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS"
243 # configure Postfix (hard-core part II)
244 %{l_shtool} subst \
245 -e 's;#define HAS_DBM;#define HAS_DBM_DISABLED;' \
246 -e 's;#define HAS_DB;#define HAS_DB_DISABLED;' \
247 src/util/sys_defs.h
249 # build Postfix
250 %{l_make} %{l_mflags -O}
252 %install
254 # perform standard installation procedure
255 %{l_shtool} subst -e "s;chown;true;" postfix-install
256 sh postfix-install -non-interactive \
257 install_root=$RPM_BUILD_ROOT \
258 config_directory=%{l_prefix}/etc/postfix \
259 daemon_directory=%{l_prefix}/libexec/postfix \
260 command_directory=%{l_prefix}/sbin \
261 queue_directory=%{l_prefix}/var/postfix \
262 data_directory=%{l_prefix}/var/postfix/data \
263 sendmail_path=%{l_prefix}/sbin/sendmail \
264 newaliases_path=%{l_prefix}/sbin/newaliases \
265 mailq_path=%{l_prefix}/sbin/mailq \
266 manpage_directory=%{l_prefix}/man \
267 mail_user=%{l_musr} \
268 setgid_group=%{l_rgrp}
270 # post-adjust binaries
271 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
272 ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
273 $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
274 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
275 ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
276 $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
277 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
278 strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true
280 # post-adjust configuration
281 for cfg in \
282 *LICENSE makedefs.out bounce.cf.default access aliases \
283 canonical header_checks relocated transport virtual \
284 main.cf master.cf main.cf.default; do
285 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg
286 done
288 # install default configuration
289 for name in `grep "^<file" %{SOURCE postfix.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
290 (echo ""; cat %{SOURCE postfix.txt}; echo "") |\
291 sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
292 %{l_shtool} install -c -m 644 %{l_value -s -a} \
293 $name $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/
294 done
296 # pre-create variable stuff
297 ( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix
298 %{l_shtool} mkdir -f -p -m 700 data
299 %{l_shtool} mkdir -f -p -m 755 log
300 ) || exit $?
302 # install addons
303 %{l_shtool} install -c -m 755 \
304 -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \
305 auxiliary/rmail/rmail $RPM_BUILD_ROOT%{l_prefix}/sbin/rmail
306 %{l_shtool} install -c -m 755 \
307 -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
308 -e 's;postconf -h;%{l_prefix}/sbin/postconf -h;' \
309 auxiliary/qshape/qshape.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/qshape
310 %{l_shtool} install -c -m 644 \
311 man/man1/qshape.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/qshape.8
312 ( cd pflogsumm-%{V_pflogsumm}
313 %{l_shtool} install -c -m 755 \
314 -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
315 pflogsumm.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm
316 %{l_shtool} install -c -m 644 \
317 pflogsumm.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
318 ) || exit $?
320 # install run-command script
321 %{l_shtool} mkdir -f -p -m 755 \
322 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
323 %{l_shtool} install -c -m 755 %{l_value -s -a} \
324 %{SOURCE rc.postfix} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
326 # adjust installation to avoid file name conflicts
327 ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man8
328 mv master.8 postfix_master.8
329 ) || exit $?
331 # install OSSP fsl configuration
332 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
333 %{l_shtool} install -c -m 644 %{l_value -s -a} \
334 %{SOURCE fsl.postfix} \
335 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
337 # generate file list
338 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
339 %{l_files_std} \
340 '%config %{l_prefix}/etc/fsl/fsl.postfix' \
341 '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix' \
342 '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \
343 '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \
344 '%attr(2755,%{l_musr},%{l_rgrp}) %{l_prefix}/sbin/{postdrop,postqueue}' \
345 '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix' \
346 '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix' \
347 '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix/pid' \
348 '%dir %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/var/postfix/{maildrop,public}'
350 %files -f files
352 %clean
354 %pre
355 # before upgrade, save status and stop service
356 [ $1 -eq 2 ] || exit 0
357 eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}`
358 %{l_rc} postfix stop 2>/dev/null
359 exit 0
361 %post
362 if [ $1 -eq 1 ]; then
363 # after install, generate configuration
364 ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} all; true ) >/dev/null 2>&1
365 fi
366 if [ $1 -eq 2 ]; then
367 # after upgrade, regenerate configuration
368 ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean all; true ) >/dev/null 2>&1
369 # after upgrade, restore status
370 eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true
371 [ ".$postfix_active" = .yes ] && %{l_rc} postfix start
372 fi
373 exit 0
375 %preun
376 # before erase, stop service and remove log files
377 [ $1 -eq 0 ] || exit 0
378 %{l_rc} postfix stop 2>/dev/null
379 rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log* >/dev/null 2>&1 || true
380 rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.sum* >/dev/null 2>&1 || true
381 # remove generated configuration files
382 ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true
383 # remove generated runtime files and directories
384 rm -rf $RPM_INSTALL_PREFIX/var/postfix/data/*
385 rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/*
386 rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/*
387 rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/*
388 find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\
389 xargs rmdir >/dev/null 2>&1 || true
390 find $RPM_INSTALL_PREFIX/var/postfix/incoming/ -type d -print |\
391 xargs rmdir >/dev/null 2>&1 || true
392 exit 0