Группа :: Система/Серверы
Пакет: postfix
Главная Изменения Спек Патчи Загрузить Bugs and FR
Name: postfix
Version: 2.2.11
%define srcname %name-%version
Release: alt0.M24.1
Serial: 1
Summary: Postfix Mail Transport Agent
License: IBM Public License
Group: System/Servers
Url: http://www.postfix.org/
Packager: Postfix Development Team <postfix at packages.altlinux.org>
# ftp://ftp.porcupine.org/mirrors/postfix-release/official/
# ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/
Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/%srcname.tar
Source2: %name-mynetworks
Source3: %name.init
Source4: %name.cron.daily
Source5: %name.chroot.lib
Source6: %name.chroot.conf
Source7: %name.chroot.all
Source8: %name-master-chrootify.awk
Source9: %name-master-comment.awk
Source11: %name-lorder.sh
Source12: %name-oclosure.sh
Source13: README.ALT-ru_RU.KOI8-R
# TLS/SASL
Patch1: %name-2.2.4-deb-alt-sasl-config.patch
# Owl/mjt
Patch11: %name-2.2.4-owl-sparse-hack.patch
Patch12: %name-2.2.4-mjt-var_command_maxtime.patch
# ALT
Patch21: %name-2.2.9-alt-check.patch
Patch22: %name-2.2.11-alt-install.patch
Patch23: %name-2.2.4-alt-defaults.patch
Patch24: %name-2.2.4-alt-filelist.patch
Patch25: %name-2.2.4-alt-post-install.patch
Patch26: %name-2.2.4-alt-main.cf.patch
Patch27: %name-2.2.4-alt-dynamicmaps.patch
Patch28: %name-2.2.4-alt-local_minimum_uid.patch
Patch29: %name-2.2.5-alt-mailbox_unpriv_delivery.patch
Patch30: %name-2.2.4-alt-postconf-virtual_maps.patch
Patch31: %name-2.2.9-alt-main.cf.params.patch
Patch32: %name-2.2.9-alt-doc-postconf.patch
Patch41: %name-2.2.9-alt-memcached.patch
# Deb
Patch51: %name-2.2.5-deb-man.patch
Patch52: %name-2.2.4-deb-greylist.patch
%def_with cdb
%def_with ldap
%def_with mysql
%def_with pcre
%def_with pgsql
%def_without ipv6
%def_with tls
%def_with memcache
# Chrooted environment
%define ROOT /var/spool/%name
# Configuration definitions below are here for both customization
# and to simplify building list of files for a package (converting
# %name-files list to rpm's filelist).
%define queue_directory %_var/spool/%name
%define config_directory %_sysconfdir/%name
%define daemon_directory %_libexecdir/%name
%define program_directory %daemon_directory
%define command_directory %_sbindir
%define newaliases_path %_bindir/newaliases
%define mailq_path %_bindir/mailq
%define sendmail_path %_sbindir/sendmail
%define docdir %_docdir/%name-%version
%define manpage_directory %_mandir
%define html_directory %docdir/html
%define readme_directory %config_directory/README_FILES
%define mail_admin mailadm
%define mail_owner postfix
%define setgid_group postdrop
%define default_privs postman
%define restart_flag /var/run/%name.restart
%define libpostfix lib%name-%version.so
%define libpostfix_dict lib%{name}_dict-%version.so
Provides: MTA, MailTransportAgent
Provides: smtpd, smtpdaemon, %name-smtpd
Conflicts: sendmail, masqmail, exim
Obsoletes: %name-beta, %name-smtpd
PreReq: shadow-utils, chkconfig, sendmail-common >= 1.3, chrooted >= 0.3, %name-control >= 1.1
# This is used to be MDA, but default postfix main.cf uses procmail.
Requires: procmail
BuildPreReq: rpm-build >= 4.0.4-alt0.3, sendmail-common >= 1.3, coreutils, chrooted >= 0.3
%{?_with_cdb:BuildPreReq: libcdb-devel}
%{?_with_pcre:BuildPreReq: libpcre-devel}
%{?_with_ldap:BuildPreReq: libldap-devel}
%{?_with_mysql:BuildPreReq: libMySQL-devel}
%{?_with_pgsql:BuildPreReq: postgresql-devel}
%{?_with_tls:BuildPreReq: libssl-devel libsasl2-devel}
%{?_with_memcache:BuildPreReq: libmemcache-devel}
# Automatically added by buildreq on Fri Oct 31 2003
BuildRequires: groff-base html2text libdb4-devel
%description
Postfix is Wietse Venema's attempt to provide an alternative to the
widely-used Sendmail program. Postfix attempts to be fast, easy to
administer, and hopefully secure, while at the same time being sendmail
compatible enough to not upset your users.
%package ldap
Summary: LDAP map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description ldap
This package provides support for LDAP maps in Postfix.
%package mysql
Summary: MySQL map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description mysql
This package provides support for MySQL maps in Postfix.
%package pcre
Summary: PCRE map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description pcre
This package provides support for PCRE maps in Postfix.
%package pgsql
Summary: PostgreSQL map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description pgsql
This package provides support for PostgreSQL maps in Postfix.
%package memcache
Summary: Memcache map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description memcache
The Postfix memcache map type allows you to hook up Postfix to
memcached server.
%package tls
Summary: TLS and SASL support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description tls
This package provides support for TLS and SASL in Postfix.
%package html
Summary: html documentation for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description html
This package provides documentation for Postfix in html format.
%prep
%setup -q -n %srcname
%if_with tls
%patch1 -p1
%endif #with tls
%patch11 -p1
%patch12 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%if_with memcache
%patch41 -p1
%endif #with memcache
%patch51 -p1
%patch52 -p1
%if_with tls
rm -rf src/*-tls
for i in lmtp smtp smtpd; do
cp -a src/$i src/$i-tls
done
%endif #with tls
find -type f -name \*.orig -delete -print
# Add some makefile targets where appropriate.
%__subst 's/^update /&objs dicts /' Makefile.in
%__subst 's/^# do not edit below this line/objs: $(OBJS)\n\nobjs-print: objs\n\tls -1 $(OBJS)\n\n&/' \
src/*/Makefile.in
# Change program names for smtp, smtpd and lmtp.
%__subst 's/^PROG[[:space:]]*=.*/&-std/' src/{smtp,smtpd,lmtp}/Makefile.in
%if_with tls
%__subst 's/^PROG[[:space:]]*=.*/&-tls/' src/{smtp,smtpd,lmtp}-tls/Makefile.in
%endif #with tls
# Fix master.cf
awk -f %_sourcedir/%name-master-chrootify.awk <conf/master.cf >conf/master.cf.new
mv conf/master.cf.new conf/master.cf
awk -f %_sourcedir/%name-master-comment.awk <conf/master.cf >conf/master.cf.new
mv conf/master.cf.new conf/master.cf
%__subst 's,^\(smtp[[:space:]]\+inet[[:space:]]\+.*[[:space:]]\+smtpd[[:space:]]*\)$,#\1,' conf/master.cf
# Remove license, makedefs.out, html documentation, man pages, readme files and sample files from master list.
%__subst '/\(LICENSE\|makedefs\.out\|\(html\|manpage\|readme\|sample\)_directory\)/ d' conf/%name-files
rm -f conf/LICENSE
%__subst -p s, at LIB at ,%_lib, conf/%name-files
# More std/tls tweaks for filelist.
%__subst 's,^.*/\(lmtp\|smtp\|smtpd\),&-std,' conf/%name-files
%if_with tls
# comment out tlsmgr
%__subst -p 's/[^#]*tlsmgr/#&/' conf/%name-files
%endif #with tls
if [ "%_libexecdir" != "/usr/libexec" ]; then
find -type f -print0 |
xargs -r0 grep -FZl /usr/libexec -- |
xargs -r0 %__subst -p 's,/usr/libexec,%_libexecdir,g' --
fi
# Create mynetworks and mydestination.
install -p -m644 %_sourcedir/%name-mynetworks conf/mynetworks
touch conf/mydestination
### BUILD ###
%build
MAKEFLAGS="$MAKEFLAGS DEF_MAIL_VERSION=%version"
%{?_without_ipv6:MAKEFLAGS="$MAKEFLAGS NO_IPV6=1"}
export MAKEFLAGS
OPT="%optflags -Wno-comment"
CCARGS="\
-DDEF_COMMAND_DIR=\\\"%command_directory\\\" \
-DDEF_CONFIG_DIR=\\\"%config_directory\\\" \
-DDEF_DAEMON_DIR=\\\"%daemon_directory\\\" \
-DDEF_HTML_DIR=\\\"%html_directory\\\" \
-DDEF_MAILQ_PATH=\\\"%mailq_path\\\" \
-DDEF_MANPAGE_DIR=\\\"%manpage_directory\\\" \
-DDEF_NEWALIAS_PATH=\\\"%newaliases_path\\\" \
-DDEF_PROGRAM_DIR=\\\"%program_directory\\\" \
-DDEF_QUEUE_DIR=\\\"%queue_directory\\\" \
-DDEF_README_DIR=\\\"%readme_directory\\\" \
-DDEF_SAMPLE_DIR=\\\"%readme_directory\\\" \
-DDEF_SENDMAIL_PATH=\\\"%sendmail_path\\\" \
"
DICTS=
DICT_LIBS="-ldl -ldb"
DICT_ARGS="$CCARGS"
SYSLIBS="-lnsl -lresolv"
AUXLIBS=
%if_with cdb
DICT_ARGS="$DICT_ARGS -DHAS_CDB"
DICT_LIBS="$DICT_LIBS -lcdb"
%endif #with cdb
%if_with ldap
DICT_ARGS="$DICT_ARGS -DHAS_LDAP"
DICTS="$DICTS \$(DICT_LDAP)"
%endif #with ldap
%if_with mysql
DICT_ARGS="$DICT_ARGS -DHAS_MYSQL -I%_includedir/mysql"
DICTS="$DICTS \$(DICT_MYSQL)"
%endif #with mysql
%if_with pcre
DICT_ARGS="$DICT_ARGS -DHAS_PCRE `pcre-config --cflags`"
DICTS="$DICTS \$(DICT_PCRE)"
%endif #with pcre
%if_with pgsql
DICT_ARGS="$DICT_ARGS -DHAS_PGSQL -I%_includedir/pgsql"
DICTS="$DICTS \$(DICT_PGSQL)"
%endif #with pgsql
%if_with tls
TLS_ARGS="$CCARGS -DUSE_SASL_AUTH -DUSE_TLS -DHAS_SSL -I%_includedir/sasl -I%_includedir/openssl"
TLS_LIBS="-lsasl2 -lssl -lcrypto"
TLS_DIRS="src/global src/tls src/tlsmgr src/smtp-tls src/smtpd-tls src/lmtp-tls"
%endif #with tls
%if_with memcache
DICT_ARGS="$DICT_ARGS -DHAS_MEMCACHE"
DICTS="$DICTS \$(DICT_MEMCACHE)"
%endif #with memcache
## Shared build model; suggested by mjt.
pushd src
# 0. Prepare.
make -C .. \
tidy makefiles \
SYSLIBS="$SYSLIBS" \
AUXLIBS="$AUXLIBS" \
CCARGS="$DICT_ARGS -UUSE_TLS" \
OPT="$OPT" \
DEBUG=
# 1. build all static libs objects with %optflags_shared.
%make_build -C .. \
update DEBUG='%optflags_shared' PROG= \
DIRS="src/util src/global src/dns src/master src/tls"
# 2. separate libs objects into dict-dependent and others.
for a in */*.a; do
ar t "$a" |
sed -ne "s,.*,${a%%/*}/&,p"
done | sort -u >postfix_all_obj.list
sh %_sourcedir/%name-lorder.sh `cat postfix_all_obj.list` |
sort -u |
sort -k2,2 >postfix_lorder.list
printf '%%s\n%%s\n' util/dict_{c,}db.o |
sh %_sourcedir/%name-oclosure.sh postfix_lorder.list >postfix_dict_obj.list
join -v1 postfix_all_obj.list postfix_dict_obj.list >postfix_common_obj.list
# 3. build %libpostfix shared library.
gcc -shared -o ../lib/%libpostfix \
-Wl,-O1 -Wl,-soname,%libpostfix \
`cat postfix_common_obj.list` \
$SYSLIBS
ln -s %libpostfix ../lib/libpostfix.so
# 4. build %libpostfix_dict shared library.
gcc -shared -o ../lib/%libpostfix_dict \
-Wl,-O1 -Wl,-soname,%libpostfix_dict \
`cat postfix_dict_obj.list` \
../lib/libpostfix.so $DICT_LIBS
ln -s %libpostfix_dict ../lib/libpostfix_dict.so
# 5. build applications objects.
%make_build -C .. objs
# 6. build dict-dependent applications with %libpostfix and %libpostfix_dict.
dict_build_dirs=
for d in *; do
[ -f "$d/Makefile" ] || continue
sh %_sourcedir/%name-lorder.sh `cat postfix_dict_obj.list` \
`MAKEFLAGS= make -C "$d" -s objs-print |sed -e "s,^,$d/,"` |
sort -u |
sort -k2,2 |
join -1 1 -2 2 -o 2.1 postfix_dict_obj.list - |
sort -u |join -v1 - postfix_dict_obj.list |
fgrep -qs "$d"/ || continue
dict_build_dirs="$dict_build_dirs src/$d"
done
%make_build -C .. \
LIBS='../../lib/libpostfix_dict.so ../../lib/libpostfix.so' \
DIRS="$dict_build_dirs" \
SYSLIBS= \
AUXLIBS= \
#
# 7. build other applications with %libpostfix only.
%make_build -C .. \
LIBS=../../lib/libpostfix.so \
SYSLIBS= \
AUXLIBS= \
#
# 8. build dicts.
%make_build -C .. dicts \
DIRS="src/global src/util" \
DEBUG='%optflags_shared' \
LIBS='../../lib/libpostfix_dict.so ../../lib/libpostfix.so' \
SYSLIBS= \
AUXLIBS= \
DICTS="$DICTS" \
#
popd # src
# SMP build seems to be broken here.
%__make manpages
%if_with tls
make makefiles \
DIRS="$TLS_DIRS" \
SYSLIBS= \
AUXLIBS= \
CCARGS="$TLS_ARGS" \
OPT="$OPT" \
DEBUG=
%make_build \
DIRS="$TLS_DIRS" \
SYSLIBS="../../lib/libpostfix_dict.so ../../lib/libpostfix.so $TLS_LIBS $DICT_LIBS $SYSLIBS"
%endif #with tls
install -pm644 /usr/share/sendmail-common/aliases conf/
mkdir -p libexec/postqueue
mv bin/postqueue libexec/postqueue/
### INSTALL ###
%install
rln()
{
local target=$1 && shift
local source=$1 && shift
target=`relative "$target" "$source"`
ln -snf "$target" "%buildroot$source"
}
mkdir -p %buildroot{%ROOT,%_bindir,%_sbindir,%_libdir,%daemon_directory/postqueue,%_mandir}
# Install shared libraries and dictionaries.
install -p -m644 lib/%libpostfix lib/%libpostfix_dict %buildroot%_libdir/
install -p -m644 src/*/dict_*.so %buildroot%daemon_directory/ ||:
:>%name.files
# Postfix's postfix-install script accept various parameters both in
# command line and as environment variables. Better to reset environment
# here, so no locally-set variable will give any surprise.
env -i "LD_LIBRARY_PATH=%buildroot%_libdir" \
sh postfix-install -non-interactive \
install_root=%buildroot \
tempdir=%_tmppath
# prepare for std
for i in lmtp smtp smtpd; do
rln $i-std %daemon_directory/$i
done
%if_with tls
install -pm755 libexec/{*-tls,tlsmgr} %buildroot%daemon_directory/
%endif #with tls
# Finish postqueue install.
chmod 700 %buildroot%daemon_directory/postqueue
rln %daemon_directory/postqueue/postqueue %command_directory/
install -pD -m755 %SOURCE3 %buildroot%_initdir/%name
install -pD -m755 %SOURCE4 %buildroot%_sysconfdir/cron.daily/%name
install -pD -m750 %SOURCE5 %buildroot%_sysconfdir/chroot.d/%name.lib
install -pD -m750 %SOURCE6 %buildroot%_sysconfdir/chroot.d/%name.conf
install -pD -m750 %SOURCE7 %buildroot%_sysconfdir/chroot.d/%name.all
# Install /etc/aliases.
rln %config_directory/aliases %_sysconfdir/
# Install manpages
cp -a man/man{1,5,8} %buildroot%manpage_directory/
# Install qshape and rmail.
install -p -m755 auxiliary/qshape/qshape.pl %buildroot%_bindir/qshape
install -p -m755 auxiliary/rmail/rmail %buildroot%_bindir/
rm -rf %buildroot%docdir
mkdir -p %buildroot%docdir
cp -a html examples *README* COMPATIBILITY HISTORY LICENSE PORTING RELEASE_NOTES \
%buildroot%docdir/
bzip2 -9 %buildroot%docdir/HISTORY
%if_with tls
mkdir -p %buildroot%docdir/tls
cp -a TLS_* %buildroot%docdir/
bzip2 -9 %buildroot%docdir/TLS_CHANGES
%endif #with tls
%if_with ipv6
install -pm644 IPv6-ChangeLog %buildroot%docdir/
bzip2 -9 %buildroot%docdir/IPv6-ChangeLog
%endif #with ipv6
# Install README_FILES.
rm -rf %buildroot%config_directory/README_FILES
mkdir -p %buildroot%docdir/README_FILES
rln %docdir/README_FILES %config_directory/
# Install README.ALT
install -pm644 %SOURCE13 %buildroot%docdir/
touch %buildroot%config_directory/{access,aliases,canonical,relocated,transport,virtual}.{cdb,db}
# syslog.d
mkdir -pm700 %buildroot%_sysconfdir/syslog.d
ln -s %ROOT/dev/log %buildroot%_sysconfdir/syslog.d/%name
# Chrooted environment
touch %buildroot%ROOT{%_sysconfdir/{localtime,hosts,services,{host,nsswitch,resolv}.conf},/var/nis/NIS_COLD_START}
mksock %buildroot%ROOT/dev/log
### RUNTIME SCRIPTS ###
%pre
/usr/sbin/groupadd -r -f %setgid_group
/usr/sbin/groupadd -r -f %mail_owner
/usr/sbin/groupadd -r -f %default_privs
/usr/sbin/groupadd -r -f %mail_admin
/usr/sbin/useradd -r -n -g %name -d %ROOT -s /dev/null -c %name %name >/dev/null 2>&1 ||:
/usr/sbin/useradd -r -n -g %default_privs -d /dev/null -s /dev/null -c %default_privs %default_privs >/dev/null 2>&1 ||:
%__rm -f %restart_flag
if [ $1 -ge 2 ]; then
%_initdir/%name status >/dev/null 2>&1 && %_initdir/%name stop && touch %restart_flag ||:
if [ ! -f %daemon_directory/postqueue/postqueue -a \
-f %command_directory/postqueue -a \
! -L %command_directory/postqueue ]; then
%__mkdir_p -m755 %daemon_directory/postqueue &&
%__cp -pf %command_directory/postqueue %daemon_directory/postqueue/
fi
/usr/sbin/control-dump %name postqueue
fi
oua=/usr/sbin/update-alternatives
if [ -x "$oua" ]; then
"$oua" --remove aliases %config_directory/aliases >/dev/null 2>&1 ||:
fi
%post
%post_ldconfig
if [ $1 = 1 ]; then
/sbin/chkconfig --add %name
fi
%__rm -f %config_directory/{access,aliases,canonical,relocated,transport,virtual}.{,c}db
%config_directory/post-install upgrade-package
if [ $1 -ge 2 ]; then
ALIASES=%config_directory/aliases /usr/share/sendmail-common/rebuild_aliases
%_sysconfdir/chroot.d/%name.all --force
/usr/sbin/control-restore %name postqueue
else
/usr/sbin/control %name local
/usr/sbin/control postqueue public
fi
if [ -f %restart_flag ]; then
%__rm -f %restart_flag
%_initdir/%name start ||:
fi
%preun
if [ $1 = 0 ]; then
%_initdir/%name condstop
/sbin/chkconfig --del %name
%__rm -f %ROOT/lib/* %ROOT%_sysconfdir/* %ROOT/var/yp/binding/*
fi
%postun -p %postun_ldconfig
%if_with tls
%post tls
for n in lmtp smtp smtpd; do
%__ln_s -nf "$n"-tls %daemon_directory/"$n"
done
%__subst -p 's/^#\(.*tlsmgr\)/\1/' %config_directory/%name-files
%config_directory/post-install upgrade-package
%preun tls
if [ $1 = 0 ]; then
for n in lmtp smtp smtpd; do
%__ln_s -nf "$n"-std %daemon_directory/"$n"
done
%__subst -p 's/[^#]*tlsmgr/#&/' %config_directory/%name-files
fi
%endif #with tls
%triggerpostun -- sendmail, exim, %name <= 0:20010228
[ $1 = 0 ] || exit 0
%__ln_s -nf %name/aliases %_sysconfdir/aliases
%_sysconfdir/chroot.d/%name.all
%files -f %name.files
%config %_initdir/%name
%config(noreplace) %_sysconfdir/cron.daily/%name
%config %_sysconfdir/chroot.d/*
%_sysconfdir/aliases
%ghost %attr(644,root,root) %config(missingok) %verify(not md5 mtime size) %config_directory/*.db
%ghost %attr(644,root,root) %config(missingok) %verify(not md5 mtime size) %config_directory/*.cdb
%attr(-,root,root) %daemon_directory/lmtp
%attr(-,root,root) %daemon_directory/smtp
%attr(-,root,root) %daemon_directory/smtpd
%_sysconfdir/syslog.d/%name
%_libdir/%libpostfix
%_libdir/%libpostfix_dict
%attr(700,root,root) %verify(not mode,group) %dir %daemon_directory/postqueue
%command_directory/postqueue
%_bindir/qshape
%_bindir/rmail
%_mandir/man?/*
%if_with tls
%exclude %_mandir/man?/*tls*
%endif #with tls
%doc %config_directory/README_FILES
%dir %docdir
%docdir/examples
%docdir/[A-Z]*
%if_with tls
%exclude %docdir/TLS_*
%endif # with tls
# Chrooted environment
%attr(644,root,root) %verify(not md5 mtime size) %ghost %ROOT%_sysconfdir/*
%attr(666,root,root) %ghost %ROOT/dev/log
%ghost %config(missingok) %verify(not md5 mtime size) %ROOT/var/nis/NIS_COLD_START
%files html
%dir %docdir
%docdir/html
%if_with ldap
%files ldap
%daemon_directory/dict_ldap-%version.so
%endif #with ldap
%if_with mysql
%files mysql
%daemon_directory/dict_mysql-%version.so
%endif #with mysql
%if_with pcre
%files pcre
%daemon_directory/dict_pcre-%version.so
%endif #with pcre
%if_with pgsql
%files pgsql
%daemon_directory/dict_pgsql-%version.so
%endif #with pgsql
%if_with memcache
%files memcache
%daemon_directory/dict_memcache-%version.so
%endif #with memcache
%if_with tls
%files tls
%_mandir/man?/*tls*
%dir %daemon_directory
%daemon_directory/*-tls
%daemon_directory/tlsmgr
%dir %docdir
%docdir/TLS_*
%endif #with tls
%changelog
…
Полный changelog можно просмотреть здесь
Version: 2.2.11
%define srcname %name-%version
Release: alt0.M24.1
Serial: 1
Summary: Postfix Mail Transport Agent
License: IBM Public License
Group: System/Servers
Url: http://www.postfix.org/
Packager: Postfix Development Team <postfix at packages.altlinux.org>
# ftp://ftp.porcupine.org/mirrors/postfix-release/official/
# ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/
Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/%srcname.tar
Source2: %name-mynetworks
Source3: %name.init
Source4: %name.cron.daily
Source5: %name.chroot.lib
Source6: %name.chroot.conf
Source7: %name.chroot.all
Source8: %name-master-chrootify.awk
Source9: %name-master-comment.awk
Source11: %name-lorder.sh
Source12: %name-oclosure.sh
Source13: README.ALT-ru_RU.KOI8-R
# TLS/SASL
Patch1: %name-2.2.4-deb-alt-sasl-config.patch
# Owl/mjt
Patch11: %name-2.2.4-owl-sparse-hack.patch
Patch12: %name-2.2.4-mjt-var_command_maxtime.patch
# ALT
Patch21: %name-2.2.9-alt-check.patch
Patch22: %name-2.2.11-alt-install.patch
Patch23: %name-2.2.4-alt-defaults.patch
Patch24: %name-2.2.4-alt-filelist.patch
Patch25: %name-2.2.4-alt-post-install.patch
Patch26: %name-2.2.4-alt-main.cf.patch
Patch27: %name-2.2.4-alt-dynamicmaps.patch
Patch28: %name-2.2.4-alt-local_minimum_uid.patch
Patch29: %name-2.2.5-alt-mailbox_unpriv_delivery.patch
Patch30: %name-2.2.4-alt-postconf-virtual_maps.patch
Patch31: %name-2.2.9-alt-main.cf.params.patch
Patch32: %name-2.2.9-alt-doc-postconf.patch
Patch41: %name-2.2.9-alt-memcached.patch
# Deb
Patch51: %name-2.2.5-deb-man.patch
Patch52: %name-2.2.4-deb-greylist.patch
%def_with cdb
%def_with ldap
%def_with mysql
%def_with pcre
%def_with pgsql
%def_without ipv6
%def_with tls
%def_with memcache
# Chrooted environment
%define ROOT /var/spool/%name
# Configuration definitions below are here for both customization
# and to simplify building list of files for a package (converting
# %name-files list to rpm's filelist).
%define queue_directory %_var/spool/%name
%define config_directory %_sysconfdir/%name
%define daemon_directory %_libexecdir/%name
%define program_directory %daemon_directory
%define command_directory %_sbindir
%define newaliases_path %_bindir/newaliases
%define mailq_path %_bindir/mailq
%define sendmail_path %_sbindir/sendmail
%define docdir %_docdir/%name-%version
%define manpage_directory %_mandir
%define html_directory %docdir/html
%define readme_directory %config_directory/README_FILES
%define mail_admin mailadm
%define mail_owner postfix
%define setgid_group postdrop
%define default_privs postman
%define restart_flag /var/run/%name.restart
%define libpostfix lib%name-%version.so
%define libpostfix_dict lib%{name}_dict-%version.so
Provides: MTA, MailTransportAgent
Provides: smtpd, smtpdaemon, %name-smtpd
Conflicts: sendmail, masqmail, exim
Obsoletes: %name-beta, %name-smtpd
PreReq: shadow-utils, chkconfig, sendmail-common >= 1.3, chrooted >= 0.3, %name-control >= 1.1
# This is used to be MDA, but default postfix main.cf uses procmail.
Requires: procmail
BuildPreReq: rpm-build >= 4.0.4-alt0.3, sendmail-common >= 1.3, coreutils, chrooted >= 0.3
%{?_with_cdb:BuildPreReq: libcdb-devel}
%{?_with_pcre:BuildPreReq: libpcre-devel}
%{?_with_ldap:BuildPreReq: libldap-devel}
%{?_with_mysql:BuildPreReq: libMySQL-devel}
%{?_with_pgsql:BuildPreReq: postgresql-devel}
%{?_with_tls:BuildPreReq: libssl-devel libsasl2-devel}
%{?_with_memcache:BuildPreReq: libmemcache-devel}
# Automatically added by buildreq on Fri Oct 31 2003
BuildRequires: groff-base html2text libdb4-devel
%description
Postfix is Wietse Venema's attempt to provide an alternative to the
widely-used Sendmail program. Postfix attempts to be fast, easy to
administer, and hopefully secure, while at the same time being sendmail
compatible enough to not upset your users.
%package ldap
Summary: LDAP map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description ldap
This package provides support for LDAP maps in Postfix.
%package mysql
Summary: MySQL map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description mysql
This package provides support for MySQL maps in Postfix.
%package pcre
Summary: PCRE map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description pcre
This package provides support for PCRE maps in Postfix.
%package pgsql
Summary: PostgreSQL map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description pgsql
This package provides support for PostgreSQL maps in Postfix.
%package memcache
Summary: Memcache map support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description memcache
The Postfix memcache map type allows you to hook up Postfix to
memcached server.
%package tls
Summary: TLS and SASL support for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description tls
This package provides support for TLS and SASL in Postfix.
%package html
Summary: html documentation for Postfix
Group: System/Servers
Requires: %name = %serial:%version-%release
%description html
This package provides documentation for Postfix in html format.
%prep
%setup -q -n %srcname
%if_with tls
%patch1 -p1
%endif #with tls
%patch11 -p1
%patch12 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%if_with memcache
%patch41 -p1
%endif #with memcache
%patch51 -p1
%patch52 -p1
%if_with tls
rm -rf src/*-tls
for i in lmtp smtp smtpd; do
cp -a src/$i src/$i-tls
done
%endif #with tls
find -type f -name \*.orig -delete -print
# Add some makefile targets where appropriate.
%__subst 's/^update /&objs dicts /' Makefile.in
%__subst 's/^# do not edit below this line/objs: $(OBJS)\n\nobjs-print: objs\n\tls -1 $(OBJS)\n\n&/' \
src/*/Makefile.in
# Change program names for smtp, smtpd and lmtp.
%__subst 's/^PROG[[:space:]]*=.*/&-std/' src/{smtp,smtpd,lmtp}/Makefile.in
%if_with tls
%__subst 's/^PROG[[:space:]]*=.*/&-tls/' src/{smtp,smtpd,lmtp}-tls/Makefile.in
%endif #with tls
# Fix master.cf
awk -f %_sourcedir/%name-master-chrootify.awk <conf/master.cf >conf/master.cf.new
mv conf/master.cf.new conf/master.cf
awk -f %_sourcedir/%name-master-comment.awk <conf/master.cf >conf/master.cf.new
mv conf/master.cf.new conf/master.cf
%__subst 's,^\(smtp[[:space:]]\+inet[[:space:]]\+.*[[:space:]]\+smtpd[[:space:]]*\)$,#\1,' conf/master.cf
# Remove license, makedefs.out, html documentation, man pages, readme files and sample files from master list.
%__subst '/\(LICENSE\|makedefs\.out\|\(html\|manpage\|readme\|sample\)_directory\)/ d' conf/%name-files
rm -f conf/LICENSE
%__subst -p s, at LIB at ,%_lib, conf/%name-files
# More std/tls tweaks for filelist.
%__subst 's,^.*/\(lmtp\|smtp\|smtpd\),&-std,' conf/%name-files
%if_with tls
# comment out tlsmgr
%__subst -p 's/[^#]*tlsmgr/#&/' conf/%name-files
%endif #with tls
if [ "%_libexecdir" != "/usr/libexec" ]; then
find -type f -print0 |
xargs -r0 grep -FZl /usr/libexec -- |
xargs -r0 %__subst -p 's,/usr/libexec,%_libexecdir,g' --
fi
# Create mynetworks and mydestination.
install -p -m644 %_sourcedir/%name-mynetworks conf/mynetworks
touch conf/mydestination
### BUILD ###
%build
MAKEFLAGS="$MAKEFLAGS DEF_MAIL_VERSION=%version"
%{?_without_ipv6:MAKEFLAGS="$MAKEFLAGS NO_IPV6=1"}
export MAKEFLAGS
OPT="%optflags -Wno-comment"
CCARGS="\
-DDEF_COMMAND_DIR=\\\"%command_directory\\\" \
-DDEF_CONFIG_DIR=\\\"%config_directory\\\" \
-DDEF_DAEMON_DIR=\\\"%daemon_directory\\\" \
-DDEF_HTML_DIR=\\\"%html_directory\\\" \
-DDEF_MAILQ_PATH=\\\"%mailq_path\\\" \
-DDEF_MANPAGE_DIR=\\\"%manpage_directory\\\" \
-DDEF_NEWALIAS_PATH=\\\"%newaliases_path\\\" \
-DDEF_PROGRAM_DIR=\\\"%program_directory\\\" \
-DDEF_QUEUE_DIR=\\\"%queue_directory\\\" \
-DDEF_README_DIR=\\\"%readme_directory\\\" \
-DDEF_SAMPLE_DIR=\\\"%readme_directory\\\" \
-DDEF_SENDMAIL_PATH=\\\"%sendmail_path\\\" \
"
DICTS=
DICT_LIBS="-ldl -ldb"
DICT_ARGS="$CCARGS"
SYSLIBS="-lnsl -lresolv"
AUXLIBS=
%if_with cdb
DICT_ARGS="$DICT_ARGS -DHAS_CDB"
DICT_LIBS="$DICT_LIBS -lcdb"
%endif #with cdb
%if_with ldap
DICT_ARGS="$DICT_ARGS -DHAS_LDAP"
DICTS="$DICTS \$(DICT_LDAP)"
%endif #with ldap
%if_with mysql
DICT_ARGS="$DICT_ARGS -DHAS_MYSQL -I%_includedir/mysql"
DICTS="$DICTS \$(DICT_MYSQL)"
%endif #with mysql
%if_with pcre
DICT_ARGS="$DICT_ARGS -DHAS_PCRE `pcre-config --cflags`"
DICTS="$DICTS \$(DICT_PCRE)"
%endif #with pcre
%if_with pgsql
DICT_ARGS="$DICT_ARGS -DHAS_PGSQL -I%_includedir/pgsql"
DICTS="$DICTS \$(DICT_PGSQL)"
%endif #with pgsql
%if_with tls
TLS_ARGS="$CCARGS -DUSE_SASL_AUTH -DUSE_TLS -DHAS_SSL -I%_includedir/sasl -I%_includedir/openssl"
TLS_LIBS="-lsasl2 -lssl -lcrypto"
TLS_DIRS="src/global src/tls src/tlsmgr src/smtp-tls src/smtpd-tls src/lmtp-tls"
%endif #with tls
%if_with memcache
DICT_ARGS="$DICT_ARGS -DHAS_MEMCACHE"
DICTS="$DICTS \$(DICT_MEMCACHE)"
%endif #with memcache
## Shared build model; suggested by mjt.
pushd src
# 0. Prepare.
make -C .. \
tidy makefiles \
SYSLIBS="$SYSLIBS" \
AUXLIBS="$AUXLIBS" \
CCARGS="$DICT_ARGS -UUSE_TLS" \
OPT="$OPT" \
DEBUG=
# 1. build all static libs objects with %optflags_shared.
%make_build -C .. \
update DEBUG='%optflags_shared' PROG= \
DIRS="src/util src/global src/dns src/master src/tls"
# 2. separate libs objects into dict-dependent and others.
for a in */*.a; do
ar t "$a" |
sed -ne "s,.*,${a%%/*}/&,p"
done | sort -u >postfix_all_obj.list
sh %_sourcedir/%name-lorder.sh `cat postfix_all_obj.list` |
sort -u |
sort -k2,2 >postfix_lorder.list
printf '%%s\n%%s\n' util/dict_{c,}db.o |
sh %_sourcedir/%name-oclosure.sh postfix_lorder.list >postfix_dict_obj.list
join -v1 postfix_all_obj.list postfix_dict_obj.list >postfix_common_obj.list
# 3. build %libpostfix shared library.
gcc -shared -o ../lib/%libpostfix \
-Wl,-O1 -Wl,-soname,%libpostfix \
`cat postfix_common_obj.list` \
$SYSLIBS
ln -s %libpostfix ../lib/libpostfix.so
# 4. build %libpostfix_dict shared library.
gcc -shared -o ../lib/%libpostfix_dict \
-Wl,-O1 -Wl,-soname,%libpostfix_dict \
`cat postfix_dict_obj.list` \
../lib/libpostfix.so $DICT_LIBS
ln -s %libpostfix_dict ../lib/libpostfix_dict.so
# 5. build applications objects.
%make_build -C .. objs
# 6. build dict-dependent applications with %libpostfix and %libpostfix_dict.
dict_build_dirs=
for d in *; do
[ -f "$d/Makefile" ] || continue
sh %_sourcedir/%name-lorder.sh `cat postfix_dict_obj.list` \
`MAKEFLAGS= make -C "$d" -s objs-print |sed -e "s,^,$d/,"` |
sort -u |
sort -k2,2 |
join -1 1 -2 2 -o 2.1 postfix_dict_obj.list - |
sort -u |join -v1 - postfix_dict_obj.list |
fgrep -qs "$d"/ || continue
dict_build_dirs="$dict_build_dirs src/$d"
done
%make_build -C .. \
LIBS='../../lib/libpostfix_dict.so ../../lib/libpostfix.so' \
DIRS="$dict_build_dirs" \
SYSLIBS= \
AUXLIBS= \
#
# 7. build other applications with %libpostfix only.
%make_build -C .. \
LIBS=../../lib/libpostfix.so \
SYSLIBS= \
AUXLIBS= \
#
# 8. build dicts.
%make_build -C .. dicts \
DIRS="src/global src/util" \
DEBUG='%optflags_shared' \
LIBS='../../lib/libpostfix_dict.so ../../lib/libpostfix.so' \
SYSLIBS= \
AUXLIBS= \
DICTS="$DICTS" \
#
popd # src
# SMP build seems to be broken here.
%__make manpages
%if_with tls
make makefiles \
DIRS="$TLS_DIRS" \
SYSLIBS= \
AUXLIBS= \
CCARGS="$TLS_ARGS" \
OPT="$OPT" \
DEBUG=
%make_build \
DIRS="$TLS_DIRS" \
SYSLIBS="../../lib/libpostfix_dict.so ../../lib/libpostfix.so $TLS_LIBS $DICT_LIBS $SYSLIBS"
%endif #with tls
install -pm644 /usr/share/sendmail-common/aliases conf/
mkdir -p libexec/postqueue
mv bin/postqueue libexec/postqueue/
### INSTALL ###
%install
rln()
{
local target=$1 && shift
local source=$1 && shift
target=`relative "$target" "$source"`
ln -snf "$target" "%buildroot$source"
}
mkdir -p %buildroot{%ROOT,%_bindir,%_sbindir,%_libdir,%daemon_directory/postqueue,%_mandir}
# Install shared libraries and dictionaries.
install -p -m644 lib/%libpostfix lib/%libpostfix_dict %buildroot%_libdir/
install -p -m644 src/*/dict_*.so %buildroot%daemon_directory/ ||:
:>%name.files
# Postfix's postfix-install script accept various parameters both in
# command line and as environment variables. Better to reset environment
# here, so no locally-set variable will give any surprise.
env -i "LD_LIBRARY_PATH=%buildroot%_libdir" \
sh postfix-install -non-interactive \
install_root=%buildroot \
tempdir=%_tmppath
# prepare for std
for i in lmtp smtp smtpd; do
rln $i-std %daemon_directory/$i
done
%if_with tls
install -pm755 libexec/{*-tls,tlsmgr} %buildroot%daemon_directory/
%endif #with tls
# Finish postqueue install.
chmod 700 %buildroot%daemon_directory/postqueue
rln %daemon_directory/postqueue/postqueue %command_directory/
install -pD -m755 %SOURCE3 %buildroot%_initdir/%name
install -pD -m755 %SOURCE4 %buildroot%_sysconfdir/cron.daily/%name
install -pD -m750 %SOURCE5 %buildroot%_sysconfdir/chroot.d/%name.lib
install -pD -m750 %SOURCE6 %buildroot%_sysconfdir/chroot.d/%name.conf
install -pD -m750 %SOURCE7 %buildroot%_sysconfdir/chroot.d/%name.all
# Install /etc/aliases.
rln %config_directory/aliases %_sysconfdir/
# Install manpages
cp -a man/man{1,5,8} %buildroot%manpage_directory/
# Install qshape and rmail.
install -p -m755 auxiliary/qshape/qshape.pl %buildroot%_bindir/qshape
install -p -m755 auxiliary/rmail/rmail %buildroot%_bindir/
rm -rf %buildroot%docdir
mkdir -p %buildroot%docdir
cp -a html examples *README* COMPATIBILITY HISTORY LICENSE PORTING RELEASE_NOTES \
%buildroot%docdir/
bzip2 -9 %buildroot%docdir/HISTORY
%if_with tls
mkdir -p %buildroot%docdir/tls
cp -a TLS_* %buildroot%docdir/
bzip2 -9 %buildroot%docdir/TLS_CHANGES
%endif #with tls
%if_with ipv6
install -pm644 IPv6-ChangeLog %buildroot%docdir/
bzip2 -9 %buildroot%docdir/IPv6-ChangeLog
%endif #with ipv6
# Install README_FILES.
rm -rf %buildroot%config_directory/README_FILES
mkdir -p %buildroot%docdir/README_FILES
rln %docdir/README_FILES %config_directory/
# Install README.ALT
install -pm644 %SOURCE13 %buildroot%docdir/
touch %buildroot%config_directory/{access,aliases,canonical,relocated,transport,virtual}.{cdb,db}
# syslog.d
mkdir -pm700 %buildroot%_sysconfdir/syslog.d
ln -s %ROOT/dev/log %buildroot%_sysconfdir/syslog.d/%name
# Chrooted environment
touch %buildroot%ROOT{%_sysconfdir/{localtime,hosts,services,{host,nsswitch,resolv}.conf},/var/nis/NIS_COLD_START}
mksock %buildroot%ROOT/dev/log
### RUNTIME SCRIPTS ###
%pre
/usr/sbin/groupadd -r -f %setgid_group
/usr/sbin/groupadd -r -f %mail_owner
/usr/sbin/groupadd -r -f %default_privs
/usr/sbin/groupadd -r -f %mail_admin
/usr/sbin/useradd -r -n -g %name -d %ROOT -s /dev/null -c %name %name >/dev/null 2>&1 ||:
/usr/sbin/useradd -r -n -g %default_privs -d /dev/null -s /dev/null -c %default_privs %default_privs >/dev/null 2>&1 ||:
%__rm -f %restart_flag
if [ $1 -ge 2 ]; then
%_initdir/%name status >/dev/null 2>&1 && %_initdir/%name stop && touch %restart_flag ||:
if [ ! -f %daemon_directory/postqueue/postqueue -a \
-f %command_directory/postqueue -a \
! -L %command_directory/postqueue ]; then
%__mkdir_p -m755 %daemon_directory/postqueue &&
%__cp -pf %command_directory/postqueue %daemon_directory/postqueue/
fi
/usr/sbin/control-dump %name postqueue
fi
oua=/usr/sbin/update-alternatives
if [ -x "$oua" ]; then
"$oua" --remove aliases %config_directory/aliases >/dev/null 2>&1 ||:
fi
%post
%post_ldconfig
if [ $1 = 1 ]; then
/sbin/chkconfig --add %name
fi
%__rm -f %config_directory/{access,aliases,canonical,relocated,transport,virtual}.{,c}db
%config_directory/post-install upgrade-package
if [ $1 -ge 2 ]; then
ALIASES=%config_directory/aliases /usr/share/sendmail-common/rebuild_aliases
%_sysconfdir/chroot.d/%name.all --force
/usr/sbin/control-restore %name postqueue
else
/usr/sbin/control %name local
/usr/sbin/control postqueue public
fi
if [ -f %restart_flag ]; then
%__rm -f %restart_flag
%_initdir/%name start ||:
fi
%preun
if [ $1 = 0 ]; then
%_initdir/%name condstop
/sbin/chkconfig --del %name
%__rm -f %ROOT/lib/* %ROOT%_sysconfdir/* %ROOT/var/yp/binding/*
fi
%postun -p %postun_ldconfig
%if_with tls
%post tls
for n in lmtp smtp smtpd; do
%__ln_s -nf "$n"-tls %daemon_directory/"$n"
done
%__subst -p 's/^#\(.*tlsmgr\)/\1/' %config_directory/%name-files
%config_directory/post-install upgrade-package
%preun tls
if [ $1 = 0 ]; then
for n in lmtp smtp smtpd; do
%__ln_s -nf "$n"-std %daemon_directory/"$n"
done
%__subst -p 's/[^#]*tlsmgr/#&/' %config_directory/%name-files
fi
%endif #with tls
%triggerpostun -- sendmail, exim, %name <= 0:20010228
[ $1 = 0 ] || exit 0
%__ln_s -nf %name/aliases %_sysconfdir/aliases
%_sysconfdir/chroot.d/%name.all
%files -f %name.files
%config %_initdir/%name
%config(noreplace) %_sysconfdir/cron.daily/%name
%config %_sysconfdir/chroot.d/*
%_sysconfdir/aliases
%ghost %attr(644,root,root) %config(missingok) %verify(not md5 mtime size) %config_directory/*.db
%ghost %attr(644,root,root) %config(missingok) %verify(not md5 mtime size) %config_directory/*.cdb
%attr(-,root,root) %daemon_directory/lmtp
%attr(-,root,root) %daemon_directory/smtp
%attr(-,root,root) %daemon_directory/smtpd
%_sysconfdir/syslog.d/%name
%_libdir/%libpostfix
%_libdir/%libpostfix_dict
%attr(700,root,root) %verify(not mode,group) %dir %daemon_directory/postqueue
%command_directory/postqueue
%_bindir/qshape
%_bindir/rmail
%_mandir/man?/*
%if_with tls
%exclude %_mandir/man?/*tls*
%endif #with tls
%doc %config_directory/README_FILES
%dir %docdir
%docdir/examples
%docdir/[A-Z]*
%if_with tls
%exclude %docdir/TLS_*
%endif # with tls
# Chrooted environment
%attr(644,root,root) %verify(not md5 mtime size) %ghost %ROOT%_sysconfdir/*
%attr(666,root,root) %ghost %ROOT/dev/log
%ghost %config(missingok) %verify(not md5 mtime size) %ROOT/var/nis/NIS_COLD_START
%files html
%dir %docdir
%docdir/html
%if_with ldap
%files ldap
%daemon_directory/dict_ldap-%version.so
%endif #with ldap
%if_with mysql
%files mysql
%daemon_directory/dict_mysql-%version.so
%endif #with mysql
%if_with pcre
%files pcre
%daemon_directory/dict_pcre-%version.so
%endif #with pcre
%if_with pgsql
%files pgsql
%daemon_directory/dict_pgsql-%version.so
%endif #with pgsql
%if_with memcache
%files memcache
%daemon_directory/dict_memcache-%version.so
%endif #with memcache
%if_with tls
%files tls
%_mandir/man?/*tls*
%dir %daemon_directory
%daemon_directory/*-tls
%daemon_directory/tlsmgr
%dir %docdir
%docdir/TLS_*
%endif #with tls
%changelog
…
Полный changelog можно просмотреть здесь