%global __provides_exclude_from %{_docdir} %global __requires_exclude_from %{_docdir} %global debug_package %{nil} %define _build_id_links none Summary: Secure imap and pop3 server Name: dovecot Version: 2.3.21.1 %global prever %{nil} Release: 2%{?dist} #dovecot itself is MIT, a few sources are PD, pigeonhole is LGPLv2 License: MIT and LGPLv2 URL: http://www.dovecot.org/ Source: https://www.dovecot.org/releases/2.3/%{name}-%{version}%{?prever}.tar.gz %global pigeonholever 0.5.21.1 Source8: https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-%{pigeonholever}.tar.gz #Source9: dovecot.sysconfig #Source10: dovecot.tmpfilesd Source16: dovecot.sysusers # Official patches Patch21: dovecot-2.3.19.1-7bad6a24.patch Patch22: dovecot-configure-c99.patch Patch24: dovecot-2.3-ph_optglob.patch Patch25: dovecot-2.3-ph_scriptcmp.patch Patch26: dovecot-2.3.21-test-socket-path.patch Patch27: dovecot-2.3.21-noengine.patch Patch90: dovecot-2.3.21-drop-legacy.patch Patch91: dovecot-2.3.20-sieve-hardening.patch Patch92: dovecot-2.3.21-sieve-connect-timeout.patch Patch94: dovecot-2.3.21-folder-quota.patch %if 0%{?rhel} >= 9 BuildRequires: gcc-toolset-13-gcc BuildRequires: gcc-toolset-13-gcc-c++ BuildRequires: openssl-devel BuildRequires: mariadb-connector-c-devel %else BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: openssl-devel BuildRequires: mariadb-devel %endif BuildRequires: libtool BuildRequires: autoconf BuildRequires: automake BuildRequires: pkgconfig BuildRequires: gettext-devel BuildRequires: libpcap-devel BuildRequires: lua-devel BuildRequires: systemd-devel # Explicit Runtime Requirements for executalbe %if 0%{?rhel} >= 9 Requires: openssl %else Requires: openssl %endif # Package includes an initscript service file, needs to require initscripts package Requires(pre): shadow-utils Requires: systemd %global restart_flag /run/%{name}/%{name}-restart-after-rpm-install %description Dovecot is an IMAP server for Linux/UNIX-like systems, written with security primarily in mind. It also contains a small POP3 server. It supports mail in either of maildir or mbox formats. The SQL drivers and authentication plug-ins are in their subpackages. %package pigeonhole Requires: %{name} = %{version}-%{release} Summary: Sieve and managesieve plug-in for dovecot License: MIT and LGPLv2 %description pigeonhole This package provides sieve and managesieve plug-in for dovecot LDA. %package mysql Requires: %{name} = %{version}-%{release} Summary: MySQL back end for dovecot %description mysql This package provides the MySQL back end for dovecot-auth etc. %package lua Requires: %{name} = %{version}-%{release} Summary: Lua back end for dovecot %description lua This package provides the Lua back end for dovecot-auth %package devel Requires: %{name} = %{version}-%{release} Summary: Development files for dovecot %description devel This package provides the development files for dovecot. %prep %setup -q -n %{name}-%{version}%{?prever} -a 8 #%patch -P 16 -p1 -b .opensslhmac #%patch -P 20 -p1 -b .opensslv3 %patch -P 21 -p1 -b .7bad6a24 %patch -P 22 -p1 -b .c99 %patch -P 26 -p1 -b .test-socket-path %patch -P 27 -p1 -b .noengine %patch -P 90 -p1 -b .drop-legacy %patch -P 94 -p1 -b .folder-quota pushd dovecot-2*3-pigeonhole-%{pigeonholever} %patch -P 24 -p2 -b .ph_optglob %patch -P 25 -p2 -b .ph_scriptcmp %patch -P 91 -p1 -b .sieve-hardening %patch -P 92 -p1 -b .sieve-connect-timeout popd sed -i '/DEFAULT_INCLUDES *=/s|$| '"$(pkg-config --cflags libclucene-core)|" src/plugins/fts-lucene/Makefile.in %build #required for fdpass.c line 125,190: dereferencing type-punned pointer will break strict-aliasing rules %global _hardened_build 1 export CFLAGS="%{__global_cflags} -fno-strict-aliasing -fstack-reuse=none" export LDFLAGS="-Wl,-z,now -Wl,-z,relro %{?__global_ldflags}" mkdir -p m4 autoreconf -I . -fiv #required for aarch64 support %configure \ INSTALL_DATA="install -c -p -m644" \ --with-rundir=%{_rundir}/%{name} \ --disable-static \ --disable-rpath \ --without-nss \ --without-pam \ --without-gssapi \ --with-lua \ --with-sql=plugin \ --with-mysql \ --without-pgsql \ --without-sqlite \ --without-ldap \ --without-cassandra \ --without-zlib \ --without-bzlib \ --without-lzma \ --without-lz4 \ --without-zstd \ --without-libcap \ --with-ssl=openssl \ --without-solr \ --without-stemmer \ --without-textcat \ --without-docs \ --with-systemd make %{?_smp_mflags} #pigeonhole pushd dovecot-2*3-pigeonhole-%{pigeonholever} # required for snapshot [ -f configure ] || autoreconf -fiv [ -f ChangeLog ] || echo "Pigeonhole ChangeLog is not available, yet" >ChangeLog %configure \ INSTALL_DATA="install -c -p -m644" \ --disable-static \ --with-dovecot=../ \ --without-unfinished-features make %{?_smp_mflags} popd %install rm -rf $RPM_BUILD_ROOT %make_install pushd dovecot-2*3-pigeonhole-%{pigeonholever} %make_install #mv $RPM_BUILD_ROOT/%{_docdir}/%{name} $RPM_BUILD_ROOT/%{_docdir}/%{name}-pigeonhole popd #remove the libtool archives find $RPM_BUILD_ROOT%{_libdir}/%{name}/ -name '*.la' | xargs rm -f #remove what we don't want rm -f $RPM_BUILD_ROOT%{_sysconfdir}/dovecot/README %if 0%{?rhel} >= 9 install -p -D -m 0644 %{SOURCE16} $RPM_BUILD_ROOT%{_sysusersdir}/dovecot.sysusers %endif %pre %if 0%{?rhel} >= 9 %sysusers_create_compat %{SOURCE16} %endif %files %{_sbindir}/dovecot %{_bindir}/doveadm %{_bindir}/doveconf %{_bindir}/dsync %exclude %{_bindir}/dovecot-sysreport %if 0%{?rhel} >= 9 %{_sysusersdir}/dovecot.sysusers %endif %exclude %{_mandir} %exclude %{_unitdir} %exclude %{_datarootdir}/%{name}/stopwords %exclude %{_rundir}/%{name} %exclude %{_sharedstatedir}/%{name} %dir %{_libdir}/dovecot %dir %{_libdir}/dovecot/auth %{_libdir}/dovecot/doveadm %exclude %{_libdir}/dovecot/doveadm/*sieve* %{_libdir}/dovecot/*.so.* #these (*.so files) are plugins, not devel files %{_libdir}/dovecot/*_plugin.so %exclude %{_libdir}/dovecot/*_sieve_plugin.so %{_libdir}/dovecot/auth/lib20_auth_var_expand_crypt.so %{_libdir}/dovecot/auth/libauthdb_imap.so %{_libdir}/dovecot/libssl_iostream_openssl.so %{_libdir}/dovecot/libfs_compress.so %{_libdir}/dovecot/libfs_crypt.so %{_libdir}/dovecot/libfs_mail_crypt.so %{_libdir}/dovecot/libdcrypt_openssl.so %{_libdir}/dovecot/lib20_var_expand_crypt.so %dir %{_libdir}/dovecot/settings %{_libexecdir}/%{name} %exclude %{_libexecdir}/%{name}/managesieve* %exclude %{_libexecdir}/%{name}/decode2text.sh %exclude %{_libexecdir}/%{name}/xml2text %files devel %{_includedir}/dovecot %{_datadir}/aclocal/dovecot*.m4 %{_libdir}/dovecot/libdovecot*.so %{_libdir}/dovecot/dovecot-config %files pigeonhole %{_bindir}/sieve-dump %{_bindir}/sieve-filter %{_bindir}/sieve-test %{_bindir}/sievec %exclude %{_docdir} %{_libexecdir}/%{name}/managesieve %{_libexecdir}/%{name}/managesieve-login %{_libdir}/dovecot/doveadm/*sieve* %{_libdir}/dovecot/*_sieve_plugin.so %{_libdir}/dovecot/settings/libmanagesieve_*.so %{_libdir}/dovecot/settings/libpigeonhole_*.so %{_libdir}/dovecot/sieve/ %files mysql %{_libdir}/%{name}/libdriver_mysql.so %{_libdir}/%{name}/auth/libdriver_mysql.so %{_libdir}/%{name}/dict/libdriver_mysql.so