%define _disable_ld_no_undefined 1 %define major %{nil} %define libdns %mklibname %{name}-dns %{major} %define libglobal %mklibname %{name}-global %{major} %define libmaster %mklibname %{name}-master %{major} %define libutil %mklibname %{name}-util %{major} %define libtls %mklibname %{name}-tls %{major} ### REMOVED in 3.0.0 %define libmilter %mklibname %{name}-milter 1 ### REMOVED in 3.0.0 %define libxsasl %mklibname %{name}-xsasl 1 %define sendmail_command %{_sbindir}/sendmail.postfix %define post_install_parameters daemon_directory=%{_libexecdir}/postfix command_directory=%{_sbindir} queue_directory=%{queue_directory} sendmail_path=%{sendmail_command} newaliases_path=%{_bindir}/newaliases mailq_path=%{_bindir}/mailq mail_owner=postfix setgid_group=%{maildrop_group} manpage_directory=%{_mandir} readme_directory=%{_docdir}/%{name}/README_FILES html_directory=%{_docdir}/%{name}/html data_directory=/var/lib/postfix # use bcond_with if default is disabled # use bcond_without if default is enabled # built %bcond_without ldap %bcond_without mysql %bcond_without pgsql %bcond_without sdbm %bcond_without sqlite %bcond_without pcre %bcond_without sasl %bcond_without tls %bcond_without ipv6 %bcond_without cdb %bcond_without chroot # Postfix requires one exlusive uid/gid and a 2nd exclusive gid for its own use. %define maildrop_group postdrop %define queue_directory %{_var}/spool/postfix %define postfix_shlib_dir %{_libdir}/postfix # Macro: %{dynmap_add_cmd [] [-m]} %define dynmap_add_cmd(m) FILE=%{_sysconfdir}/postfix/dynamicmaps.cf; if ! grep -q "^%{1}[[:space:]]" ${FILE}; then echo "%{1} %{_libdir}/postfix/postfix-%{?2:%{2}}%{?!2:%{1}}.so dict_%{1}_open%{-m: mkmap_%{1}_open}" >> ${FILE}; fi; %define dynmap_rm_cmd() FILE=%{_sysconfdir}/postfix/dynamicmaps.cf; if [ $1 = 0 -a -s $FILE ]; then cp -p ${FILE} ${FILE}.$$; grep -v "^%{1}[[:space:]]" ${FILE}.$$ > ${FILE}; rm -f ${FILE}.$$; fi; Summary: Postfix Mail Transport Agent Name: postfix Version: 3.8.1 Release: 1 License: IBM Public License Group: System/Servers Url: http://www.postfix.org/ Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/%{name}-%{version}.tar.gz Source1: ftp://ftp.porcupine.org/mirrors/postfix-release/official/%{name}-%{version}.tar.gz.sig Source2: postfix-main.cf Source4: postfix-etc-pam.d-smtp Source5: postfix-aliases Source6: postfix-ip-up Source7: postfix-ip-down Source8: postfix-ifup-d Source10: postfix-README.MDK Source11: postfix-README.MDK.update Source12: postfix-bash-completion Source13: http://www.seaglass.com/postfix/faq.html Source14: postfix-chroot.sh Source15: postfix-smtpd.conf # Simon J. Mudd stuff Source21: https://ftp.wl0.org/SOURCES/postfinger # Jim Seymour stuff Source25: http://jimsun.LinxNet.com/misc/postfix-anti-UCE.txt Source26: http://jimsun.LinxNet.com/misc/header_checks.txt Source27: http://jimsun.LinxNet.com/misc/body_checks.txt Patch1: postfix-2.9.1-mdkconfig.diff Patch2: postfix-alternatives-mdk.patch Patch3: postfix-3.6.3-glibc-2.34.patch # sdbm patch patch split from dynamicmaps one Patch4: postfix-2.7.0-sdbm.patch # Don't warn about symlinks being group- or other-writable # (they always are) Patch5: postfix-3.1.2-dont-warn-about-symlinks.patch # Shamelessy stolen from debian Patch6: postfix-2.2.4-smtpstone.patch # Teach postfix about dovecot delivery # (in most cases, using lmtp is preferable though...) Patch7: postfix-3.1.2-dovecot-delivery.patch Patch8: postfix-3.2.4-lib-interdependencies.patch # systemd integration Source100: postfix.service Source101: postfix.aliasesdb Source102: postfix-chroot-update BuildRequires: db-devel >= 18 BuildRequires: gawk BuildRequires: html2text BuildRequires: perl-base BuildRequires: sed BuildRequires: pkgconfig(libtirpc) BuildRequires: pkgconfig(icu-uc) # For _create_ssl_certificate macro BuildRequires: rpm-helper %if %{with sasl} BuildRequires: sasl-devel >= 2.0 %endif %if %{with tls} BuildRequires: pkgconfig(openssl) %endif Provides: mail-server Provides: sendmail-command # syslog-ng before this version needed a different chroot script, # which was bug-prone Conflicts: syslog-ng < 3.1-0.beta2.2 # http://archives.mandrivalinux.com/cooker/2005-06/msg01987.php Requires(post): chkconfig Requires: coreutils Requires: diffutils Requires: gawk Requires(pre,post,postun,preun): rpm-helper >= 0.3 Requires(pre,post): sed %if %{with tls} Requires(post): openssl %endif Requires(post,preun): update-alternatives Requires(pre): %{name}-config Requires: %{name}-config >= 2.9.0-1 Obsoletes: %{libmilter} < %{EVRD} Obsoletes: %{libxsasl} < %{EVRD} %description Postfix is a Mail Transport Agent (MTA), supporting LDAP, SMTP AUTH (SASL), TLS and running in a chroot environment. Postfix is Wietse Venema's mailer that started life as an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users. Thus, the outside has a sendmail-ish flavor, but the inside is completely different. This software was formerly known as VMailer. It was released by the end of 1998 as the IBM Secure Mailer. From then on it has lived on as Postfix. PLEASE READ THE %{_defaultdocdir}/%{name}/README.MDK FILE. %package -n %{libdns} Summary: Shared library required to run Postfix Group: System/Servers %description -n %{libdns} This package contains a shared library used by Postfix. %package -n %{libglobal} Summary: Shared library required to run Postfix Group: System/Servers %description -n %{libglobal} This package contains a shared library used by Postfix. %package -n %{libmaster} Summary: Shared library required to run Postfix Group: System/Servers %description -n %{libmaster} This package contains a shared library used by Postfix. %package -n %{libutil} Summary: Shared library required to run Postfix Group: System/Servers %description -n %{libutil} This package contains a shared library used by Postfix. %package -n %{libtls} Summary: Shared library required to run Postfix Group: System/Servers %description -n %{libtls} This package contains a shared library used by Postfix. %package -n %{libmilter} Summary: Shared library required to run Postfix Group: System/Servers %description -n %{libmilter} This package contains a shared library used by Postfix. %package -n %{libxsasl} Summary: Shared library required to run Postfix Group: System/Servers %description -n %{libxsasl} This package contains a shared library used by Postfix. %if %{with ldap} %package ldap Summary: LDAP map support for Postfix Group: System/Servers BuildRequires: openldap-devel >= 2.1 Requires: %{name} = %{EVRD} %description ldap This package provides support for LDAP maps in Postfix. %endif %if %{with pcre} %package pcre Summary: PCRE map support for Postfix Group: System/Servers BuildRequires: pkgconfig(libpcre) Requires: %{name} = %{EVRD} %description pcre This package provides support for PCRE (perl compatible regular expression) maps in Postfix. %endif %if %{with mysql} %package mysql Summary: MYSQL map support for Postfix Group: System/Servers BuildRequires: mysql-devel Requires: %{name} = %{EVRD} %description mysql This package provides support for MYSQL maps in Postfix. %endif %if %{with pgsql} %package pgsql Summary: Postgres SQL map support for Postfix Group: System/Servers BuildRequires: postgresql-devel Requires: %{name} = %{EVRD} %description pgsql This package provides support for Postgres SQL maps in Postfix. %endif %if %{with sdbm} %package sdbm Summary: SDBM map support for Postfix Group: System/Servers Requires: %{name} = %{EVRD} %description sdbm This package provides support for SDBM maps in Postfix. %endif %if %{with sqlite} %package sqlite Summary: SQLite map support for Postfix Group: System/Servers BuildRequires: pkgconfig(sqlite3) Requires: %{name} = %{EVRD} %description sqlite This package provides support for SQLite maps in Postfix. %endif %if %{with cdb} %package cdb Summary: CDB map support for Postfix Group: System/Servers BuildRequires: pkgconfig(libcdb) Requires: %{name} = %{EVRD} %description cdb This package provides support for CDB maps in Postfix. %endif %package config-standalone Summary: Default configuration files for running Postfix standalone Provides: %{name}-config = %{version}-%{release} Conflicts: %{name}-config-dovecot %description config-standalone Default configuration files for running Postfix standalone. Use this config if you intend to run Postfix without dovecot. Alternatively, install %{name}-config-dovecot for the postfix/dovecot combo. %prep %setup -q %autopatch -p1 # no backup files here, otherwise they get included in %%doc find . -name \*.orig -exec rm {} \; mkdir -p conf/dist mv conf/main.cf conf/dist cp %{SOURCE2} conf/main.cf # Change DEF_SHLIB_DIR according to build host sed -i \ 's|^\(\s*#define\s\+DEF_SHLIB_DIR\s\+\)"/usr/lib/postfix"|\1"%{_libdir}/postfix"|' \ src/global/mail_params.h # ugly hack for 32/64 arches if [ %{_lib} != lib ]; then sed -i -e 's@^/usr/lib/@%{_libdir}/@' conf/postfix-files sed -i -e "s@/lib/@/%{_lib}/@g" conf/main.cf fi install -m644 %{SOURCE10} README.MDK install -m644 %{SOURCE11} README.MDK.update install -m644 %{SOURCE13} postfix-users-faq.html mkdir UCE install -m644 %{SOURCE25} UCE install -m644 %{SOURCE26} UCE install -m644 %{SOURCE27} UCE %if %{with chroot} cp -p conf/master.cf conf/master.cf.chroot awk -v NEVER_CHROOT_PROGRAM='^(proxymap|local|pipe|virtual|spawn)$' \ -v NEVER_CHROOT_SERVICE='^cyrus$' ' BEGIN { IFS="[ \t]+"; OFS="\t"; } /^#/ { print; next; } /^ / { print; next; } $1 ~ NEVER_CHROOT_SERVICE { print; next; } $8 ~ NEVER_CHROOT_PROGRAM { print; next; } $5 == "n" { $5="y"; print $0; next; } { print; } ' conf/master.cf.chroot > conf/master.cf %endif # use sed to fix mantools/postlink for our non posix sed #cp -p mantools/postlink mantools/postlink.posix #sed -e 's/\[\[:<:\]\]/\\:\]\]/\\>/g' mantools/postlink.posix > mantools/postlink # XXX - andreas - original postlink with perl is segfaulting cp -p mantools/postlink.sed mantools/postlink.posix sed -e 's/\[\[:<:\]\]/\\:\]\]/\\>/g' mantools/postlink.posix > mantools/postlink %build %serverbuild_hardened # it does not work with -fPIE and someone added that to the serverbuild macro... CFLAGS=`echo $CFLAGS|sed -e 's|-fPIE||g'` CXXFLAGS=`echo $CXXFLAGS|sed -e 's|-fPIE||g'` RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's|-fPIE||g'` OPT="$RPM_OPT_FLAGS" DEBUG= CCARGS="-DNO_NIS" AUXLIBS="%{?ldflags:%ldflags}" AUXLIBS=`echo $AUXLIBS|sed -e 's|-fPIE||g'` # the patch is mixed with SDBM support :( CCARGS="${CCARGS} -DHAS_SDBM -DHAS_DLOPEN" %if %{with ldap} CCARGS="${CCARGS} -DHAS_LDAP" AUXLIBS_LDAP="-lldap -llber" %endif %if %{with pcre} CCARGS="${CCARGS} -DHAS_PCRE" AUXLIBS_PCRE="$(pcre-config --libs)" %endif %if %{with sqlite} CCARGS="${CCARGS} -DHAS_SQLITE `pkg-config --cflags sqlite3`" AUXLIBS_SQLITE="`pkg-config --libs sqlite3`" %endif %if %{with mysql} CCARGS="${CCARGS} -DHAS_MYSQL -I/usr/include/mysql" AUXLIBS_MYSQL="$(pkg-config --libs mariadb)" %endif %if %{with pgsql} CCARGS="${CCARGS} -DHAS_PGSQL -I/usr/include/pgsql" AUXLIBS_PGSQL="$(pkg-config --libs libpq)" %endif %if %{with sasl} CCARGS="${CCARGS} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl" AUXLIBS="${AUXLIBS} -lsasl2" %endif %if ! %{with ipv6} CCARGS="${CCARGS} -DNO_IPV6" %endif %if %{with tls} CCARGS="${CCARGS} -DUSE_TLS -I/usr/include/openssl" AUXLIBS="${AUXLIBS} -lssl -lcrypto" %endif %if %{with cdb} CCARGS="${CCARGS} -DHAS_CDB" AUXLIBS="${AUXLIBS} -lcdb" %endif export CCARGS AUXLIBS AUXLIBS_PCRE AUXLIBS_LDAP AUXLIBS_MYSQL AUXLIBS_PGSQL AUXLIBS_SQLITE OPT DEBUG export CC=%{__cc} export CXX=%{__cxx} make -f Makefile.init makefiles dynamicmaps=yes pie=yes \ shlib_directory="%{_libdir}" \ SHLIB_RPATH="-Wl,-rpath,%{postfix_shlib_dir} %{ldflags}" \ OPT="$RPM_OPT_FLAGS -fno-strict-aliasing -Wno-comment" \ POSTFIX_INSTALL_OPTS=-keep-build-mtime unset CCARGS AUXLIBS DEBUG OPT make make manpages # generate main.cf.default here, since in make it will fail cat > conf/main.cf.default << EOF # DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE # TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX. # EOF LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH} \ ./src/postconf/postconf -d | \ egrep -v '^(myhostname|mydomain|mynetworks) ' >> conf/main.cf.default # add correct parameters to main.cf.dist LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH} \ ./src/postconf/postconf -c ./conf/dist -e \ %post_install_parameters mv conf/dist/main.cf conf/main.cf.dist %install # install postfix into the build root LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} \ make non-interactive-package \ install_root=%{buildroot} \ shlib_directory=%{postfix_shlib_dir} \ config_directory=%{_sysconfdir}/postfix \ %post_install_parameters \ || exit 1 mkdir -p %{buildroot}/var/lib/postfix # rpm %%doc macro wants to take his files in buildroot rm -fr DOC mkdir DOC mv %{buildroot}%{_docdir}/%{name}/html DOC/html mv %{buildroot}%{_docdir}/%{name}/README_FILES DOC/README_FILES # for sasl configuration mkdir -p %{buildroot}%{_sysconfdir}/sasl2 cp %{SOURCE15} %{buildroot}%{_sysconfdir}/sasl2/smtpd.conf mkdir -p %{buildroot}%{_sysconfdir}/pam.d install -c %{SOURCE4} %{buildroot}%{_sysconfdir}/pam.d/smtp mkdir -p %{buildroot}%{_sysconfdir}/ppp/ip-{up,down}.d install -c %{SOURCE6} %{buildroot}%{_sysconfdir}/ppp/ip-up.d/postfix install -c %{SOURCE7} %{buildroot}%{_sysconfdir}/ppp/ip-down.d/postfix mkdir -p %{buildroot}%{_sysconfdir}/resolvconf/update-libc.d/ install -c %{SOURCE8} %{buildroot}%{_sysconfdir}/resolvconf/update-libc.d/postfix mkdir -p %{buildroot}%{_sysconfdir}/sysconfig touch %{buildroot}%{_sysconfdir}/sysconfig/postfix # this is used by some examples (cyrus) mkdir -p %{buildroot}%{queue_directory}/extern install -c auxiliary/rmail/rmail %{buildroot}%{_bindir}/rmail # copy new aliases files and generate a ghost aliases.db file cp -f %{SOURCE5} %{buildroot}%{_sysconfdir}/postfix/aliases chmod 644 %{buildroot}%{_sysconfdir}/postfix/aliases touch %{buildroot}%{_sysconfdir}/postfix/aliases.db touch %{buildroot}%{_sysconfdir}/postfix/domains # install chroot script and postfinger install -m 0755 %{SOURCE14} %{buildroot}%{_sbindir}/postfix-chroot.sh install -m 0755 %{SOURCE21} %{buildroot}%{_sbindir}/postfinger # install qshape install -m755 auxiliary/qshape/qshape.pl %{buildroot}%{_sbindir}/qshape cp man/man1/qshape.1 %{buildroot}%{_mandir}/man1/qshape.1 # systemd mkdir -p %buildroot%{_unitdir} install -c -m 644 %SOURCE100 %buildroot%{_unitdir}/ install -m 755 %{SOURCE101} %{buildroot}%{_sysconfdir}/postfix/aliasesdb install -m 755 %{SOURCE102} %{buildroot}%{_sysconfdir}/postfix/chroot-update install -d %{buildroot}%{_presetdir} cat > %{buildroot}%{_presetdir}/86-postfix.preset << EOF enable postfix.service EOF # RPM compresses man pages automatically. # - Edit postfix-files to reflect this, so post-install won't get confused # when called during package installation. sed -i -e "s@\(/man[158]/.*\.[158]\):@\1%{_extension}:@" %{buildroot}%{_sysconfdir}/postfix/postfix-files # remove files that are not in the main package sed -i -e "/dict_.*\.so/d" %{buildroot}%{_sysconfdir}/postfix/postfix-files # remove sample_directory from main.cf (#15297) # the default is /etc/postfix sed -i -e "/^sample_directory/d" %{buildroot}%{_sysconfdir}/postfix/main.cf # users/groups # WARNING: If you change this here, you also need to change # it in the %%pre script. We can't use the usual sysusers_create_package # macro because of the dynamic insertions (maildrop_group/queue_directory) # at build time. mkdir -p %{buildroot}%{_sysusersdir} cat >%{buildroot}%{_sysusersdir}/postfix.conf <