1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/postfix/postfix.spec Mon Apr 06 23:53:05 2009 +0200 1.3 @@ -0,0 +1,379 @@ 1.4 +## 1.5 +## postfix.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package versions 1.28 +%define V_postfix 2.5.6 1.29 +%define V_pflogsumm 1.1.2 1.30 +%define V_whoson 2.4.0 1.31 + 1.32 +# package information 1.33 +Name: postfix 1.34 +Summary: Mail Transfer Agent (MTA) 1.35 +URL: http://www.postfix.org/ 1.36 +Vendor: Wietse Venema 1.37 +Packager: OpenPKG Foundation e.V. 1.38 +Distribution: OpenPKG Community 1.39 +Class: BASE 1.40 +Group: Mail 1.41 +License: IPL 1.42 +Version: %{V_postfix} 1.43 +Release: 20090104 1.44 + 1.45 +# package options 1.46 +%option with_fsl yes 1.47 +%option with_ssl no 1.48 +%option with_sasl no 1.49 +%option with_mysql no 1.50 +%option with_pgsql no 1.51 +%option with_ldap no 1.52 +%option with_whoson no 1.53 +%option with_fdsetsize no 1.54 + 1.55 +# list of sources 1.56 +Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_postfix}.tar.gz 1.57 +Source1: http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.tar.gz 1.58 +Source2: postfix.txt 1.59 +Source3: fsl.postfix 1.60 +Source4: rc.postfix 1.61 +Patch0: postfix.patch 1.62 +Patch1: postfix.patch.pfls 1.63 +Patch2: ftp://ftp.openpkg.org/sources/CPY/postfix/postfix-%{V_whoson}-whoson.patch 1.64 + 1.65 +# build information 1.66 +Prefix: %{l_prefix} 1.67 +BuildRoot: %{l_buildroot} 1.68 +BuildPreReq: OpenPKG, openpkg >= 20060823, perl, gcc 1.69 +PreReq: OpenPKG, openpkg >= 20060823, perl, procmail, perl-time 1.70 +BuildPreReq: make, pcre, db 1.71 +PreReq: make, pcre, db 1.72 +%if "%{with_fsl}" == "yes" 1.73 +BuildPreReq: fsl 1.74 +PreReq: fsl 1.75 +%endif 1.76 +%if "%{with_ssl}" == "yes" 1.77 +BuildPreReq: openssl 1.78 +PreReq: openssl 1.79 +%endif 1.80 +%if "%{with_sasl}" == "yes" 1.81 +BuildPreReq: sasl 1.82 +PreReq: sasl 1.83 +%endif 1.84 +%if "%{with_mysql}" == "yes" 1.85 +BuildPreReq: mysql 1.86 +PreReq: mysql 1.87 +%endif 1.88 +%if "%{with_pgsql}" == "yes" 1.89 +BuildPreReq: postgresql, openssl 1.90 +PreReq: postgresql, openssl 1.91 +%endif 1.92 +%if "%{with_ldap}" == "yes" 1.93 +BuildPreReq: openldap, openssl 1.94 +PreReq: openldap, openssl 1.95 +%endif 1.96 +%if "%{with_whoson}" == "yes" 1.97 +BuildPreReq: whoson 1.98 +PreReq: whoson 1.99 +%endif 1.100 +AutoReq: no 1.101 +AutoReqProv: no 1.102 +Provides: MTA 1.103 +Conflicts: exim, sendmail, ssmtp 1.104 + 1.105 +%description 1.106 + Postfix is a new-generation Mail Transfer Agent (MTA) able to fully 1.107 + replace the Sendmail MTA. It is fully standards compliant and 1.108 + supports SMTP, ESMTP, LMTP over IPv4/IPv6 with optional TLS/SASL. 1.109 + 1.110 + Local specifics in this OpenPKG version: 1.111 + o Postfix delivers locally via Procmail 1.112 + o Postfix logs directly to the filesystem via OSSP fsl 1.113 + o Berkeley-DB dictionary support 1.114 + o PCRE matching support 1.115 + o Optional STARTTLS encryption support (see package options) 1.116 + o Optional SASL2 authentication support (see package options) 1.117 + o Optional MySQL dictionary support (see package options) 1.118 + o Optional PostgreSQL dictionary support (see package options) 1.119 + o Optional OpenLDAP dictionary support (see package options) 1.120 + o Optional WHOSON dictionary support (see package options) 1.121 + 1.122 +%track 1.123 + prog postfix = { 1.124 + version = %{V_postfix} 1.125 + url = ftp://ftp.porcupine.org/mirrors/postfix-release/official/ 1.126 + regex = postfix-(\d+\.\d+\.\d+)\.tar\.gz 1.127 + } 1.128 + prog postfix:pflogsumm = { 1.129 + version = %{V_pflogsumm} 1.130 + url = http://jimsun.linxnet.com/postfix_contrib.html 1.131 + regex = pflogsumm-(__VER__)\.tar\.gz 1.132 + } 1.133 + prog postfix:whoson = { 1.134 + version = %{V_whoson} 1.135 + url = ftp://ftp.openpkg.org/sources/CPY/postfix/ 1.136 + regex = postfix-(__VER__)-whoson.patch 1.137 + } 1.138 + 1.139 +%prep 1.140 + # unpack distribution files 1.141 + %setup -q 1.142 + %setup -q -T -D -a 1 1.143 + 1.144 + # apply OpenPKG patches 1.145 + %patch -p0 1.146 + ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $? 1.147 + 1.148 + # apply vendor WHOSON patch 1.149 +%if "%{with_whoson}" == "yes" 1.150 + %patch -p0 -P 2 1.151 +%endif 1.152 + 1.153 +%build 1.154 + # configure Postfix (hard-core part I) 1.155 + %{l_shtool} subst \ 1.156 + -e 's/var_config_dir, /var_command_dir, /' \ 1.157 + src/postfix/postfix.c 1.158 + %{l_shtool} subst \ 1.159 + -e 's;config_directory/postfix-script;command_directory/postfix-script;' \ 1.160 + -e 's;config_directory/post-install;command_directory/postfix-install;' \ 1.161 + conf/postfix-script 1.162 + %{l_shtool} subst \ 1.163 + -e 's;/usr/include;%{l_prefix}/include;g' \ 1.164 + makedefs 1.165 + 1.166 + # configure Postfix (regular part) 1.167 + unset LD_LIBRARY_PATH || true 1.168 + CCARGS="" 1.169 + CCARGS="$CCARGS %{l_cflags -O}" 1.170 + CCARGS="$CCARGS %{l_cppflags}" 1.171 + CCARGS="$CCARGS -DDEF_COMMAND_DIR=\\\"%{l_prefix}/sbin\\\"" 1.172 + CCARGS="$CCARGS -DDEF_SENDMAIL_PATH=\\\"%{l_prefix}/sbin/sendmail\\\"" 1.173 + CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\"%{l_prefix}/etc/postfix\\\"" 1.174 + CCARGS="$CCARGS -DDEF_DAEMON_DIR=\\\"%{l_prefix}/libexec/postfix\\\"" 1.175 + CCARGS="$CCARGS -DDEF_QUEUE_DIR=\\\"%{l_prefix}/var/postfix\\\"" 1.176 + CCARGS="$CCARGS -DDEF_DATA_DIR=\\\"%{l_prefix}/var/postfix/data\\\"" 1.177 + AUXLIBS="" 1.178 + AUXLIBS="$AUXLIBS %{l_ldflags}" 1.179 + CCARGS="$CCARGS -DHAS_DB" 1.180 + AUXLIBS="$AUXLIBS -ldb" 1.181 + CCARGS="$CCARGS -DHAS_PCRE" 1.182 + AUXLIBS="$AUXLIBS -lpcre" 1.183 +%if "%{with_mysql}" == "yes" 1.184 + CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}" 1.185 + AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm" 1.186 +%endif 1.187 +%if "%{with_pgsql}" == "yes" 1.188 + CCARGS="$CCARGS -DHAS_PGSQL %{l_cppflags postgresql .}" 1.189 + AUXLIBS="$AUXLIBS -lpq -lssl -lcrypto -lcrypt" 1.190 +%endif 1.191 +%if "%{with_sasl}" == "yes" 1.192 + CCARGS="$CCARGS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL %{l_cppflags sasl .}" 1.193 + AUXLIBS="$AUXLIBS -lsasl2 -lcrypt" 1.194 + if [ -f /usr/lib/libdl.so -o -f /usr/lib/libdl.a ]; then 1.195 + AUXLIBS="$AUXLIBS -ldl" 1.196 + fi 1.197 + if [ -f /usr/lib64/libdl.so -o -f /usr/lib64/libdl.a ]; then 1.198 + AUXLIBS="$AUXLIBS -ldl" 1.199 + fi 1.200 +%endif 1.201 +%if "%{with_ssl}" == "yes" 1.202 + CCARGS="$CCARGS -DUSE_TLS" 1.203 + AUXLIBS="$AUXLIBS -lssl -lcrypto" 1.204 +%endif 1.205 +%if "%{with_ldap}" == "yes" 1.206 + CCARGS="$CCARGS -DHAS_LDAP" 1.207 + AUXLIBS="$AUXLIBS -lldap -llber -lssl -lcrypto" 1.208 +%endif 1.209 +%if "%{with_fsl}" == "yes" 1.210 + AUXLIBS="$AUXLIBS %{l_fsl_ldflags} %{l_fsl_libs}" 1.211 + CCARGS="$CCARGS -DUSE_SOFTLIMITONLY" 1.212 +%endif 1.213 +%if "%{with_fdsetsize}" != "no" 1.214 +%if "%{with_fdsetsize}" == "yes" 1.215 + CCARGS="$CCARGS -DFD_SETSIZE=1024" 1.216 +%else 1.217 + CCARGS="$CCARGS -DFD_SETSIZE=%{with_fdsetsize}" 1.218 +%endif 1.219 +%endif 1.220 + case "%{l_platform -t}" in 1.221 + *-sunos* ) AUXLIBS="$AUXLIBS -lrt" ;; 1.222 + esac 1.223 + %{l_make} %{l_mflags} -f Makefile.init makefiles \ 1.224 + CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS" 1.225 + 1.226 + # configure Postfix (hard-core part II) 1.227 + %{l_shtool} subst \ 1.228 + -e 's;#define HAS_DBM;#define HAS_DBM_DISABLED;' \ 1.229 + -e 's;#define HAS_DB;#define HAS_DB_DISABLED;' \ 1.230 + src/util/sys_defs.h 1.231 + 1.232 + # build Postfix 1.233 + %{l_make} %{l_mflags} 1.234 + 1.235 +%install 1.236 + rm -rf $RPM_BUILD_ROOT 1.237 + 1.238 + # perform standard installation procedure 1.239 + %{l_shtool} subst -e "s;chown;true;" postfix-install 1.240 + sh postfix-install -non-interactive \ 1.241 + install_root=$RPM_BUILD_ROOT \ 1.242 + config_directory=%{l_prefix}/etc/postfix \ 1.243 + daemon_directory=%{l_prefix}/libexec/postfix \ 1.244 + command_directory=%{l_prefix}/sbin \ 1.245 + queue_directory=%{l_prefix}/var/postfix \ 1.246 + data_directory=%{l_prefix}/var/postfix/data \ 1.247 + sendmail_path=%{l_prefix}/sbin/sendmail \ 1.248 + newaliases_path=%{l_prefix}/sbin/newaliases \ 1.249 + mailq_path=%{l_prefix}/sbin/mailq \ 1.250 + manpage_directory=%{l_prefix}/man \ 1.251 + mail_user=%{l_musr} \ 1.252 + setgid_group=%{l_rgrp} 1.253 + 1.254 + # post-adjust binaries 1.255 + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq 1.256 + ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \ 1.257 + $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq 1.258 + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases 1.259 + ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \ 1.260 + $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases 1.261 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 1.262 + strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true 1.263 + 1.264 + # post-adjust configuration 1.265 + for cfg in \ 1.266 + *LICENSE makedefs.out bounce.cf.default access aliases \ 1.267 + canonical header_checks relocated transport virtual \ 1.268 + main.cf master.cf main.cf.default; do 1.269 + rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg 1.270 + done 1.271 + mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script \ 1.272 + $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-script 1.273 + rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script* 1.274 + mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/post-install \ 1.275 + $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-install 1.276 + 1.277 + # install default configuration 1.278 + for name in `grep "^<file" %{SOURCE postfix.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do 1.279 + (echo ""; cat %{SOURCE postfix.txt}; echo "") |\ 1.280 + sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name 1.281 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.282 + $name $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/ 1.283 + done 1.284 + 1.285 + # pre-create variable stuff 1.286 + ( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix 1.287 + %{l_shtool} mkdir -f -p -m 700 data 1.288 + %{l_shtool} mkdir -f -p -m 755 log 1.289 + ) || exit $? 1.290 + 1.291 + # install addons 1.292 + %{l_shtool} install -c -m 755 \ 1.293 + -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \ 1.294 + auxiliary/rmail/rmail $RPM_BUILD_ROOT%{l_prefix}/sbin/rmail 1.295 + %{l_shtool} install -c -m 755 \ 1.296 + -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \ 1.297 + -e 's;postconf -h;%{l_prefix}/sbin/postconf -h;' \ 1.298 + auxiliary/qshape/qshape.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/qshape 1.299 + %{l_shtool} install -c -m 644 \ 1.300 + man/man1/qshape.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/qshape.8 1.301 + ( cd pflogsumm-%{V_pflogsumm} 1.302 + %{l_shtool} install -c -m 755 \ 1.303 + -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \ 1.304 + pflogsumm.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm 1.305 + %{l_shtool} install -c -m 644 \ 1.306 + pflogsumm.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ 1.307 + ) || exit $? 1.308 + 1.309 + # install run-command script 1.310 + %{l_shtool} mkdir -f -p -m 755 \ 1.311 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.312 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.313 + %{SOURCE rc.postfix} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.314 + 1.315 + # adjust installation to avoid file name conflicts 1.316 + ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man8 1.317 + mv master.8 postfix_master.8 1.318 + ) || exit $? 1.319 + 1.320 + # install OSSP fsl configuration 1.321 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.322 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.323 + %{SOURCE fsl.postfix} \ 1.324 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.325 + 1.326 + # generate file list 1.327 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.328 + %{l_files_std} \ 1.329 + '%config %{l_prefix}/etc/fsl/fsl.postfix' \ 1.330 + '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix' \ 1.331 + '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \ 1.332 + '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \ 1.333 + '%attr(2755,%{l_musr},%{l_rgrp}) %{l_prefix}/sbin/{postdrop,postqueue}' \ 1.334 + '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix' \ 1.335 + '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix' \ 1.336 + '%dir %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/var/postfix/{maildrop,public}' 1.337 + 1.338 +%files -f files 1.339 + 1.340 +%clean 1.341 + rm -rf $RPM_BUILD_ROOT 1.342 + 1.343 +%pre 1.344 + # before upgrade, save status and stop service 1.345 + [ $1 -eq 2 ] || exit 0 1.346 + eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}` 1.347 + %{l_rc} postfix stop 2>/dev/null 1.348 + exit 0 1.349 + 1.350 +%post 1.351 + if [ $1 -eq 1 ]; then 1.352 + # after install, generate configuration 1.353 + ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} all; true ) >/dev/null 2>&1 1.354 + fi 1.355 + if [ $1 -eq 2 ]; then 1.356 + # after upgrade, regenerate configuration 1.357 + ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean all; true ) >/dev/null 2>&1 1.358 + # after upgrade, restore status 1.359 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true 1.360 + [ ".$postfix_active" = .yes ] && %{l_rc} postfix start 1.361 + fi 1.362 + exit 0 1.363 + 1.364 +%preun 1.365 + # before erase, stop service and remove log files 1.366 + [ $1 -eq 0 ] || exit 0 1.367 + %{l_rc} postfix stop 2>/dev/null 1.368 + rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log* >/dev/null 2>&1 || true 1.369 + rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.sum* >/dev/null 2>&1 || true 1.370 + # remove generated configuration files 1.371 + ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true 1.372 + # remove generated run-time files and directories 1.373 + rm -rf $RPM_INSTALL_PREFIX/etc/postfix/data/* 1.374 + rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/* 1.375 + rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/* 1.376 + rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/* 1.377 + find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\ 1.378 + xargs rmdir >/dev/null 2>&1 || true 1.379 + find $RPM_INSTALL_PREFIX/var/postfix/incoming/ -type d -print |\ 1.380 + xargs rmdir >/dev/null 2>&1 || true 1.381 + exit 0 1.382 +