|
|
|
##
|
|
|
|
## postfix.spec -- OpenPKG RPM Specification
|
|
|
|
## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
|
|
|
|
## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
|
|
|
|
## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
|
|
|
|
##
|
|
|
|
## Permission to use, copy, modify, and distribute this software for
|
|
|
|
## any purpose with or without fee is hereby granted, provided that
|
|
|
|
## the above copyright notice and this permission notice appear in all
|
|
|
|
## copies.
|
|
|
|
##
|
|
|
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
|
|
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
|
|
|
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
## SUCH DAMAGE.
|
|
|
|
##
|
|
|
|
|
|
|
|
# select branch ("stable" or "unstable")
|
|
|
|
%define branch stable
|
|
|
|
|
|
|
|
# the currently used versions
|
|
|
|
%define V_here 20010228.8
|
|
|
|
%define V_real 20010228-pl08
|
|
|
|
%define V_ipv6 20010228pl04-v6-20010913a
|
|
|
|
%define V_tls 0.7.13-20010228-pl08-0.9.6b
|
|
|
|
%define V_pflogsumm 1.0.3
|
|
|
|
%define V_unstable 20011127
|
|
|
|
|
|
|
|
# build options
|
|
|
|
# (attention: ipv6 and tls at the same time conflicts!)
|
|
|
|
%define with_db yes
|
|
|
|
%define with_pcre yes
|
|
|
|
%if "%{branch}" == "stable"
|
|
|
|
%define with_ipv6 no
|
|
|
|
%define with_tls no
|
|
|
|
%endif
|
|
|
|
|
|
|
|
# package information
|
|
|
|
Name: postfix
|
|
|
|
Summary: Mail Transfer Agent (MTA)
|
|
|
|
URL: http://www.postfix.org/
|
|
|
|
Vendor: Wietse Venema
|
|
|
|
Packager: The OpenPKG Project
|
|
|
|
Distribution: OpenPKG [REL]
|
|
|
|
Group: Mail
|
|
|
|
License: IPL
|
|
|
|
%if "%{branch}" == "stable"
|
|
|
|
Version: %{V_here}
|
|
|
|
%else
|
|
|
|
Version: %{V_unstable}
|
|
|
|
%endif
|
|
|
|
Release: 20011201
|
|
|
|
|
|
|
|
# list of sources
|
|
|
|
Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_real}.tar.gz
|
|
|
|
Source1: ftp://ftp.aet.tu-cottbus.de/pub/postfix_tls/pfixtls-%{V_tls}.tar.gz
|
|
|
|
Source2: fakesyslog.tar.gz
|
|
|
|
Source3: ftp://ftp.kame.net/pub/kame/misc/postfix-%{V_ipv6}.diff.gz
|
|
|
|
Source4: http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.pl
|
|
|
|
Source5: rc.postfix
|
|
|
|
Source6: ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/snapshot-%{V_unstable}.tar.gz
|
|
|
|
Source7: etc.tar
|
|
|
|
|
|
|
|
# build information
|
|
|
|
Prefix: %{l_prefix}
|
|
|
|
BuildRoot: %{l_buildroot}
|
|
|
|
BuildPreReq: OpenPKG, openpkg >= 20011227, perl
|
|
|
|
PreReq: OpenPKG, openpkg >= 20011227, perl
|
|
|
|
%if "%{with_db}" == "yes"
|
|
|
|
BuildPreReq: db
|
|
|
|
%endif
|
|
|
|
%if "%{with_pcre}" == "yes"
|
|
|
|
BuildPreReq: pcre
|
|
|
|
%endif
|
|
|
|
%if "%{with_tls}" == "yes"
|
|
|
|
BuildPreReq: openssl
|
|
|
|
%endif
|
|
|
|
%if "%{with_ipv6}" == "yes" || "%{with_tls}" == "yes"
|
|
|
|
BuildPreReq: patch
|
|
|
|
%endif
|
|
|
|
AutoReq: no
|
|
|
|
AutoReqProv: no
|
|
|
|
Provides: MTA
|
|
|
|
|
|
|
|
%description
|
|
|
|
Postfix is a new-generation Mail Transfer Agent (MTA) able to
|
|
|
|
fully replace the Sendmail MTA.
|
|
|
|
|
|
|
|
Local specifics in this OpenPKG version:
|
|
|
|
o Postfix logs directly to the filesystem and not via syslog(3)
|
|
|
|
o Optional IPv6 support
|
|
|
|
o Optional STARTTLS support
|
|
|
|
o Optional Berkely-DB lookup table support
|
|
|
|
o Optional PCRE matching support
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%if "%{branch}" == "stable"
|
|
|
|
%setup0 -q -c -a 0
|
|
|
|
%else
|
|
|
|
%setup6 -q -c -a 6
|
|
|
|
%endif
|
|
|
|
%if "%{with_tls}" == "yes"
|
|
|
|
%setup1 -q -T -D -a 1
|
|
|
|
%endif
|
|
|
|
%setup2 -q -T -D -a 2
|
|
|
|
%setup7 -q -T -D -a 7
|
|
|
|
%if "%{branch}" == "stable"
|
|
|
|
cd postfix-%{V_real}
|
|
|
|
%else
|
|
|
|
cd snapshot-%{V_unstable}
|
|
|
|
%endif
|
|
|
|
%if "%{with_ipv6}" == "yes"
|
|
|
|
%{l_gzip} -d -c %{SOURCE postfix-%{V_ipv6}.diff.gz} |\
|
|
|
|
%{l_perl} -e 'my $c = ""; $c .= $_ while (<STDIN>);
|
|
|
|
$c =~ s/(^|\n)diff[^\n]+(\.indent\.pro|\.cvsignore).+?(?=\ndiff)//sg;
|
|
|
|
print $c;' |\
|
|
|
|
%{l_patch} -p1
|
|
|
|
%endif
|
|
|
|
%if "%{with_tls}" == "yes"
|
|
|
|
%{l_patch} -p1 < ../pfixtls-%{V_tls}/pfixtls.diff
|
|
|
|
%endif
|
|
|
|
%{l_rpmtool} subst \
|
|
|
|
's/var_config_dir, /var_command_dir, /' \
|
|
|
|
-- src/postfix/postfix.c
|
|
|
|
%{l_rpmtool} subst \
|
|
|
|
's;config_directory/postfix-script;command_directory/postfix-script;' \
|
|
|
|
-- conf/postfix-script*
|
|
|
|
%{l_rpmtool} subst \
|
|
|
|
's;/usr/include;%{l_prefix}/include;g' \
|
|
|
|
-- makedefs
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
|
|
|
# build faked syslog(3) library
|
|
|
|
fakesyslogdir="`pwd`/fakesyslog"
|
|
|
|
( cd fakesyslog
|
|
|
|
CC="%{l_cc}" \
|
|
|
|
CFLAGS="%{l_cflags -O}" \
|
|
|
|
./configure \
|
|
|
|
--with-logfile=%{l_prefix}/var/postfix/log/postfix.log
|
|
|
|
%{l_make} %{l_mflags}
|
|
|
|
)
|
|
|
|
|
|
|
|
# configure Postfix
|
|
|
|
%if "%{branch}" == "stable"
|
|
|
|
cd postfix-%{V_real}
|
|
|
|
%else
|
|
|
|
cd snapshot-%{V_unstable}
|
|
|
|
%endif
|
|
|
|
unset LD_LIBRARY_PATH || true
|
|
|
|
CCARGS=""
|
|
|
|
CCARGS="$CCARGS %{l_cflags -O}"
|
|
|
|
CCARGS="$CCARGS -I%{l_prefix}/include"
|
|
|
|
CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\\\\\"%{l_prefix}/etc/postfix\\\\\\\""
|
|
|
|
AUXLIBS=""
|
|
|
|
AUXLIBS="$AUXLIBS -L%{l_prefix}/lib"
|
|
|
|
%if "%{with_db}" == "yes"
|
|
|
|
CCARGS="$CCARGS -DHAS_DB"
|
|
|
|
AUXLIBS="$AUXLIBS -ldb"
|
|
|
|
%endif
|
|
|
|
%if "%{with_pcre}" == "yes"
|
|
|
|
CCARGS="$CCARGS -DHAS_PCRE"
|
|
|
|
AUXLIBS="$AUXLIBS -lpcre"
|
|
|
|
%endif
|
|
|
|
%if "%{with_tls}" == "yes"
|
|
|
|
CCARGS="$CCARGS -DHAS_SSL"
|
|
|
|
AUXLIBS="$AUXLIBS -lssl -lcrypto"
|
|
|
|
%endif
|
|
|
|
AUXLIBS="$AUXLIBS -L$fakesyslogdir -lfakesyslog"
|
|
|
|
%{l_make} %{l_mflags} makefiles \
|
|
|
|
CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS"
|
|
|
|
|
|
|
|
# build Postfix
|
|
|
|
%{l_make} %{l_mflags -O}
|
|
|
|
|
|
|
|
%install
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
# perform standard installation procedure
|
|
|
|
(
|
|
|
|
%if "%{branch}" == "stable"
|
|
|
|
cd postfix-%{V_real}
|
|
|
|
%else
|
|
|
|
cd snapshot-%{V_unstable}
|
|
|
|
%endif
|
|
|
|
%{l_rpmtool} subst "s;chown;true;" -- INSTALL.sh
|
|
|
|
install_root=$RPM_BUILD_ROOT \
|
|
|
|
config_directory=%{l_prefix}/etc/postfix \
|
|
|
|
daemon_directory=%{l_prefix}/libexec/postfix \
|
|
|
|
command_directory=%{l_prefix}/sbin \
|
|
|
|
queue_directory=%{l_prefix}/var/postfix \
|
|
|
|
sendmail_path=%{l_prefix}/sbin/sendmail \
|
|
|
|
newaliases_path=%{l_prefix}/sbin/newaliases \
|
|
|
|
mailq_path=%{l_prefix}/sbin/mailq \
|
|
|
|
mail_user=%{l_fsusr} \
|
|
|
|
manpages=%{l_prefix}/man \
|
|
|
|
setgid=no \
|
|
|
|
sh INSTALL.sh </dev/null
|
|
|
|
%{l_shtool} install -c -m 755 \
|
|
|
|
-e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \
|
|
|
|
auxiliary/rmail/rmail $RPM_BUILD_ROOT%{l_prefix}/sbin/rmail
|
|
|
|
)
|
|
|
|
|
|
|
|
# post-adjust binaries
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
|
|
|
|
ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
|
|
|
|
ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
|
|
|
|
strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
|
|
|
|
strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true
|
|
|
|
|
|
|
|
# post-adjust configuration
|
|
|
|
%{l_rpmtool} subst \
|
|
|
|
"s;^\\(mail_owner[^=]*=\\).*;\\1 %{l_fsusr};" \
|
|
|
|
-- $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/main.cf
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/*.orig
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/LICENSE
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/install.cf
|
|
|
|
mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-script
|
|
|
|
rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script*
|
|
|
|
( cd $RPM_BUILD_ROOT%{l_prefix}/etc/postfix
|
|
|
|
%{l_shtool} mkdir -f -p -m 755 sample
|
|
|
|
for cfg in access aliases canonical pcre_table regexp_table \
|
|
|
|
relocated sample-* transport virtual \
|
|
|
|
main.cf master.cf main.cf.default; do
|
|
|
|
mv $cfg sample/
|
|
|
|
done
|
|
|
|
)
|
|
|
|
|
|
|
|
# install default configuration
|
|
|
|
%{l_shtool} install -c -m 644 \
|
|
|
|
-e 's;@l_prefix@;%{l_prefix};g' \
|
|
|
|
-e 's;@l_fsusr@;%{l_fsusr};g' \
|
|
|
|
-e 's;@l_npusr@;%{l_npusr};g' \
|
|
|
|
etc/* $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/
|
|
|
|
|
|
|
|
# pre-create variable stuff
|
|
|
|
( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix
|
|
|
|
%{l_shtool} mkdir -f -p -m 700 \
|
|
|
|
incoming active bounce defer deferred flush saved corrupt private
|
|
|
|
%{l_shtool} mkdir -f -p -m 755 \
|
|
|
|
log pid public
|
|
|
|
%{l_shtool} install -c -m 755 \
|
|
|
|
/dev/null log/postfix.log
|
|
|
|
%{l_shtool} install -c -m 755 \
|
|
|
|
/dev/null log/postfix.sum
|
|
|
|
)
|
|
|
|
|
|
|
|
# install addons
|
|
|
|
%{l_shtool} install -c -m 755 \
|
|
|
|
-e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
|
|
|
|
%{SOURCE4} $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm
|
|
|
|
|
|
|
|
# install run-command script
|
|
|
|
%{l_shtool} mkdir -f -p -m 755 \
|
|
|
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
|
|
|
|
%{l_shtool} install -c -m 755 \
|
|
|
|
-e 's;@l_prefix@;%{l_prefix};g' \
|
|
|
|
-e 's;@l_fsusr@;%{l_fsusr};g' \
|
|
|
|
-e 's;@l_fsgrp@;%{l_fsgrp};g' \
|
|
|
|
%{SOURCE5} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
|
|
|
|
|
|
|
|
# generate file list
|
|
|
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
|
|
|
|
%{l_files_std} \
|
|
|
|
'%attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix' \
|
|
|
|
'%config %attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix/*' \
|
|
|
|
'%attr(-,root,%{l_fsgrp}) %{l_prefix}/libexec/postfix/*' \
|
|
|
|
'%dir %attr(-,root,%{l_fsgrp}) %{l_prefix}/libexec/postfix' \
|
|
|
|
'%dir %attr(-,root,%{l_fsgrp}) %{l_prefix}/var/postfix'
|
|
|
|
|
|
|
|
%files -f files
|
|
|
|
|
|
|
|
%clean
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
%post
|
|
|
|
if [ $1 -eq 1 ]; then
|
|
|
|
(cd $RPM_INSTALL_PREFIX/etc/postfix; %{l_make} all >/dev/null 2>&1 || true)
|
|
|
|
elif [ $1 -gt 1 ]; then
|
|
|
|
(cd $RPM_INSTALL_PREFIX/etc/postfix; %{l_make} clean all >/dev/null 2>&1 || true)
|
|
|
|
$RPM_INSTALL_PREFIX/etc/rc postfix reload >/dev/null 2>&1 || true
|
|
|
|
fi
|
|
|
|
|
|
|
|
%preun
|
|
|
|
if [ $1 -eq 0 ]; then
|
|
|
|
$RPM_INSTALL_PREFIX/etc/rc postfix stop >/dev/null 2>&1 || true
|
|
|
|
(cd $RPM_INSTALL_PREFIX/etc/postfix/; %{l_make} clean >/dev/null 2>&1 || true)
|
|
|
|
rm -rf $RPM_INSTALL_PREFIX/etc/postfix/prng_exch
|
|
|
|
rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/*
|
|
|
|
rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/*
|
|
|
|
rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/*
|
|
|
|
fi
|
|
|
|
|