Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37552496
en ru br
Репозитории ALT
S:3.6.10-alt1
D:2.4.5-alt1
5.1: 2.5.13-alt0.M50P.1
4.1: 2.4.9-alt0.M41.1
4.0: 2.4.9-alt0.M41.1
+updates:2.4.9-alt0.M41.1
3.0: 2.2.4-alt3
www.altlinux.org/Changes

Группа :: Система/Серверы
Пакет: postfix

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Name: postfix
%define base_ver 2.2.4
%define snap_ver %nil
Version: %base_ver%snap_ver
%define srcname %name-%version
Release: alt3
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.bz2
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.4-alt-check.patch
Patch22: %name-2.2.4-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.4-alt-mailbox_unpriv_delivery.patch
Patch30: %name-2.2.4-alt-postconf-virtual_maps.patch

# Deb

Patch41: %name-2.2.4-deb-man.patch
Patch42: %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

# 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}

# 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 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

%patch41 -p1
%patch42 -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

# 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="$RPM_OPT_FLAGS -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"
TLS_DIRS="src/global src/tls src/tlsmgr src/smtp-tls src/smtpd-tls src/lmtp-tls"
%endif #with tls

## 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 \
$SYSLIBS \
`cat postfix_common_obj.list`
%__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` \
$DICT_LIBS ../lib/libpostfix.so
%__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.so ../../lib/libpostfix_dict.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.so ../../lib/libpostfix_dict.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="$TLS_LIBS ../../lib/libpostfix.so ../../lib/libpostfix_dict.so"
%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_s -nf "$target" "%buildroot$source"
}

%__mkdir_p %buildroot{%ROOT,%_bindir,%_sbindir,%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 -p -m755 -D %SOURCE3 %buildroot%_initdir/%name
%__install -p -m755 -D %SOURCE4 %buildroot%_sysconfdir/cron.daily/%name
%__install -p -m750 -D %SOURCE5 %buildroot%_sysconfdir/chroot.d/%name.lib
%__install -p -m750 -D %SOURCE6 %buildroot%_sysconfdir/chroot.d/%name.conf
%__install -p -m750 -D %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_p -m700 %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 tls
%files tls
%_mandir/man?/*tls*
%dir %daemon_directory
%daemon_directory/*-tls
%daemon_directory/tlsmgr
%dir %docdir
%docdir/TLS_*
%endif #with tls

%changelog

Полный changelog можно просмотреть здесь

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin