# DOVECOT # https://github.com/dovecot/core # https://build.opensuse.org/projects/openSUSE:Factory/packages/dovecot24/files/dovecot24.spec # https://doc.dovecot.org/2.4.1/installation/installation.html # Upgrading Dovecot CE from 2.3 to 2.4 # https://doc.dovecot.org/2.4.0/installation/upgrade/2.3-to-2.4.html # https://doc.dovecot.org/2.4.0/core/summaries/settings.html#ssl_server # https://doc.dovecot.org/2.4.0/core/config/mailbox/mail_location.html#mail-location-setting %global _dove0_scm_host https://github.com %global _dove0_scm_repo dovecot/core # %%global _dove0_scm_branch release-2.4.1 # BUILD FAIL #... # settings-history.c:7:10: fatal error: settings-history-core.c: No such file or directory # 7 | #include "settings-history-core.c" #... %global _dove0_scm_branch main # PIGEONHOLE SIEVE # https://github.com/dovecot/pigeonhole # https://pigeonhole.dovecot.org/ # https://doc.dovecot.org/2.4.1/installation/sieve.html#sieve-pigeonhole-installation %global _dove1_scm_host %{_dove0_scm_host} %global _dove1_scm_repo dovecot/pigeonhole %global _dove1_scm_branch %{_dove0_scm_branch} %global _owner pgnd %global _lib_legacy %( echo %{_lib} | sed 's|64$||g' ) %global _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S --utc ) %global _dist .%{_build_timestamp}.%{_owner}.fc%{fedora} # https://stackoverflow.com/questions/47838041/rpmbuild-how-to-disable-check-buildroot # https://rpm-software-management.github.io/rpm/manual/dependency_generators.html # %%global __spec_install_pre /bin/true # %%global __arch_install_post %%{nil} # %%global __os_install_post %%{nil} %global _disable_source_fetch 0 %global debug_package %{nil} # %%undefine _auto_set_build_flags %global _hardened_build 1 %global __brp_check_rpaths %{nil} # %%global __brp_mangle_shebangs %%{nil} # %%global __brp_strip %%{nil} # %%global __requires_exclude ^.*/xxx/bin/python.*$ # %%global __requires_exclude_from ^.*/xxx/bin/python.*$ # %%global _build_id_links none # %%bcond_with XXX : opt build with XXX; default, without # %%bcond_without XXX : opt build without XXX; default, with %global _dove_name dovecot %global _dove_pkgnm dovecot-current %global _dove_unitnm dovecot-current %global _ph_name pigeonhole %global _dove_comment Dovecot IMAP Server (Current Upstream 24x Release) %global _dove_descrip %{expand: %{_dove_comment}.} %global _ph_comment Sieve and Managesieve plug-in for Dovecot %global _ph_descrip %{expand: %{_ph_comment}.} # https://spdx.org/licenses/MIT.html and https://spdx.org/licenses/LGPL-2.1.html %global _license MIT and LGPL-2.1-only %global _dove_usr dovecot %global _dove_grp dovecot %global _dove_usr_mail vmail %global _dove_grp_mail vmail %global _dove_usr_null dovenull %global _dove_grp_null dovenull %global _dove_usr_solr solr %global _dove_grp_solr solr %global _dove_bin_dir_r bin %global _dove_conf_dir /usr/local/etc/dovecot %global _dove_conf_dir_orig_r share/CONF_ORIG %global _dove_conf_file dovecot.conf %global _dove_data_indx_dir /var/vmail-index/ %global _dove_data_mail_dir /data/vmail/ %global _dove_data_solr_dir /data/solr/ %global _dove_dataroot_dir_r share %global _dove_doc_dir_r share/doc %global _dove_install_dir /usr/local/dovecot-pgnd/dovecot-current %global _dove_lib_dir_r lib64 %global _dove_libexec_dir_r libexec %global _dove_man_dir_r share/man %global _dove_log_dir /var/log/dovecot %global _dove_pid_file master.pid %global _dove_run_dir /run/dovecot %global _dove_sbin_dir_r %{_dove_bin_dir_r} %global _dove_sieve_dir %{_dove_conf_dir}/sieve %global _dove_ssl_dir /data/etc/security/ssl/vmail %global _dove_unit_dir /etc/systemd/system #!!! https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin %global _dove_exec_dir_r bin %global _dove_exec_dir %{_dove_install_dir}/%{_dove_exec_dir_r}/%{_dove_exec_dir_r} %global _dove_exec %{_dove_exec_dir}/dovecot # ??? %global ssldir %{_sysconfdir}/pki/%{name} %global restart_flag /run/%{name}/%{name}-restart-after-rpm-install %global __provides_exclude_from %{_docdir} %global __requires_exclude_from %{_docdir} %global _dove0_scm_url %{_dove0_scm_host}/%{_dove0_scm_repo} %global _dove0_scm_repo_esc %( echo %{_dove0_scm_repo} | sed 's|_|-|g' | sed 's|/|%2F|g') %global _dove0_scm_repo_norm %( echo %{_dove0_scm_repo} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _dove0_scm_branch_norm %( echo %{_dove0_scm_branch} | sed 's|_|-|g' | sed 's|/|-|g' ) %global _dove0_commit %( git ls-remote %{_dove0_scm_url} | grep /%{_dove0_scm_branch}$ | cut -f1 ) %global _dove0_shortcommit %( c=%{_dove0_commit}; echo ${c} | head -c 7 ) # GITHUB API: https://docs.github.com/en/rest/repos %global _dove0_scm_host_api https://api.github.com/repos %global _dove0_scm_tarball %{_dove0_scm_host_api}/%{_dove0_scm_repo}/tarball/%{_dove0_commit} %global _dove0_scm_extract_dir %{_dove0_scm_repo_norm}-%{shortcommit0} %global forgeurl0 %{_dove0_scm_url} %global commit0 %{_dove0_commit} %global shortcommit0 %{_dove0_shortcommit} %global forgesource0 %{_dove0_scm_tarball} %global extractdir0 %{_dove0_scm_extract_dir} %global forgesetupargs0 -T -D -b 0 -n %{extractdir0} # https://github.com/openresty/headers-more-nginx-module %global _dove1_scm_url %{_dove1_scm_host}/%{_dove1_scm_repo} %global forgeurl1 %{_dove1_scm_url} %global branch1 %{_dove1_scm_branch} %forgemeta -i -a %global dist %{_dist} # Vendor Pinning Vendor: %{_owner} # NEVRA (n-e:v-r.a) Name: %{_dove_pkgnm} Epoch: 3 # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ Version: %{scm0}_%( echo %{_dove0_scm_branch} | sed 's|-|_|g' ) Release: 0%{?dist} # https://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/ %global _same_evr %{epoch}:%{version}-%{release} Summary: %{_dove_comment} License: %{_license} URL: %{forgeurl0} Source0: %{forgesource0} Source1: %{forgesource1} Source100: %{_dove_unitnm}.service #Source101: %%{_dove_unitnm}.socket Source102: %{_dove_pkgnm}.pam Source103: %{_dove_pkgnm}.logrotate Source104: %{_dove_pkgnm}.rsyslog # do not use own implementation of HMAC, use OpenSSL for certification purposes # not sent upstream as proper fix would use dovecot's lib-dcrypt but it introduces # hard to break circular dependency between lib and lib-dcrypt # Patch100: dovecot-2.4.1-opensslhmac3.patch # # Fedora/RHEL specific, drop OTP which uses SHA1 so we dont use SHA1 for crypto purposes # Patch101: dovecot-2.4.1-nolibotp.patch # Patch102: dovecot-2.4.1-gssapi.patch ExcludeArch: %{ix86} BuildRequires: autoconf BuildRequires: automake BuildRequires: bison BuildRequires: flex BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: gettext-devel #BuildRequires: libpq-devel BuildRequires: libsodium-devel BuildRequires: libstemmer-devel BuildRequires: libtool BuildRequires: lua-devel BuildRequires: lua-json #BuildRequires: mariadb-connector-c-devel BuildRequires: make BuildRequires: multilib-rpm-config BuildRequires: pkgconf BuildRequires: pkgconfig(bzip2) BuildRequires: pkgconfig(expat) BuildRequires: pkgconfig(icu-uc) BuildRequires: pkgconfig(krb5) BuildRequires: pkgconfig(ldap) BuildRequires: pkgconfig(libcap) BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(libexttextcat) BuildRequires: pkgconfig(liblz4) BuildRequires: pkgconfig(libxcrypt) BuildRequires: pkgconfig(libzstd) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(pam) BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(xapian-core) BuildRequires: pkgconfig(zlib) BuildRequires: rpcgen BuildRequires: quota-devel BuildRequires: xz-devel BuildRequires: systemd BuildRequires: systemd-rpm-macros %{?systemd_requires} Provides: %{_dove_pkgnm} = %{_same_evr} Provides: %{_dove_name} = %{_same_evr} Obsoletes: %{_dove_name} < %{_same_evr} Requires(pre): user(dovecot) Requires(pre): group(dovecot) Requires: tika-server %description %{_dove_descrip} %{_ph_descrip} # %%package %%{_ph_name} # Requires: %%{_dove_pkgnm} = %%{_same_evr} # Summary: %%{_ph_comment} # License: %%{_license} # # %%description %%{_ph_name} # %%{_ph_descrip} %prep echo '##### STARTING PREP #####' %forgesetup -a # if `release-2.4.1` # build-aux/git-version-gen -> 2.4.1 # build-aux/git-abi-version-gen -> "2.4.ABIv1" # if `main` echo 2.4.1 > %{_builddir}/%{extractdir0}/version echo 2.4.1 > %{_builddir}/%{extractdir1}/version echo 2.4.ABIv1 > %{_builddir}/%{extractdir0}/abi-version echo 2.4.ABIv1 > %{_builddir}/%{extractdir1}/abi-version # DOVECOT CORE echo '## PREP: DOVECOT ##' cd %{_builddir}/%{extractdir0} chmod +x \ autogen.sh \ build-aux/git-version-gen \ build-aux/git-abi-version-gen echo "### DOVECOT PATCHES ###" # @ Fedora/2.4.1 #patch -p2 < %%{PATCH100} -b .opensslhmac3 #patch -p2 < %%{PATCH101} -b .nolibotp #patch -p1 < %%{PATCH102} -b .gssapi mkdir -p m4 ./autogen.sh # PIGEONHOLE echo '## PREP: PIGEONHOLE ##' cd %{_builddir}/%{extractdir1} chmod +x \ autogen.sh \ build-aux/git-version-gen \ build-aux/git-abi-version-gen %build echo '##### STARTING BUILD #####' echo '##### PFX SOURCE FLAGS PREP #####' CFLAGS="" CFLAGS+=" %{__global_cflags}" CFLAGS+=" -fno-strict-aliasing" CFLAGS+=" -fstack-reuse=none" export CFLAGS LDFLAGS="" LDFLAGS+=" -Wl,--enable-new-dtags" LDFLAGS+=" -Wl,-rpath,%{_dove_install_dir}/%{_dove_lib_dir_r}" LDFLAGS+=" %{?__global_ldflags}" export LDFLAGS # DOVECOT CORE cd %{_builddir}/%{extractdir0} _common_build_flags=() _common_build_flags+=("--prefix=%{_dove_install_dir}") _common_build_flags+=("--exec-prefix=%{_dove_install_dir}") _common_build_flags+=("--bindir=%{_dove_install_dir}/%{_dove_bin_dir_r}") _common_build_flags+=("--sbindir=%{_dove_install_dir}/%{_dove_sbin_dir_r}") _common_build_flags+=("--libdir=%{_dove_install_dir}/%{_dove_lib_dir_r}") _common_build_flags+=("--libexecdir=%{_dove_install_dir}/%{_dove_libexec_dir_r}") _common_build_flags+=("--sysconfdir=%{_dove_install_dir}/%{_dove_conf_dir_orig_r}") _common_build_flags+=("--datarootdir=%{_dove_install_dir}/%{_dove_dataroot_dir_r}") _common_build_flags+=("--mandir=%{_dove_install_dir}/%{_dove_man_dir_r}") _common_build_flags+=("--docdir=%{_dove_install_dir}/%{_dove_doc_dir_r}") echo '## BUILD:configure: DOVECOT ##' ./configure \ INSTALL_DATA="install -c -p -m644" \ --program-prefix="" --program-suffix="" \ "${_common_build_flags[@]}" \ --enable-shared --with-shared-libs --disable-static \ --enable-hardening=yes \ --with-pam \ --with-systemd \ --without-apparmor \ --enable-year2038 \ --with-notify=inotify \ --with-icu \ --with-pcre2 \ --with-sodium \ --with-libcap \ --with-sql=plugin \ --with-sqlite \ --without-cassandra \ --without-cdb \ --without-ldap \ --without-mysql \ --without-pgsql \ --with-flatcurve \ --with-stemmer \ --with-textcat \ --without-solr \ --with-bzlib \ --with-lz4 \ --with-zstd \ --with-lua=plugin echo '## BUILD:make: DOVECOT ##' make V=1 -j${RPM_BUILD_NCPUS} # PIGEONHOLE cd %{_builddir}/%{extractdir1} echo '## BUILD:configure: PIGEONHOLE ##' autoreconf -I . -fiv ./configure \ INSTALL_DATA="install -c -p -m644" \ --enable-shared --disable-static \ --with-dovecot=%{_builddir}/%{extractdir0} \ --without-unfinished-features \ "${_common_build_flags[@]}" echo '## BUILD:make: PIGEONHOLE ##' make V=1 -j${RPM_BUILD_NCPUS} %install echo '##### STARTING INSTALL #####' ## modify rpmbuild rpath check criteria # cref: /usr/lib/rpm/check-rpaths-worker # _this_QA_RPATHS=$(( 0x0001|0x0002|0x0004|0x0008|0x0010|0x0020 )) # allow 'invalid' RPATHs _this_QA_RPATHS=$(( 0x0002 )) export _this_QA_RPATHS export QA_RPATHS=${_this_QA_RPATHS} # pre-clean rm -rf "${RPM_BUILD_ROOT}/%{_dove_install_dir}" cd %{_builddir}/%{extractdir0} DESTDIR="${RPM_BUILD_ROOT}" make install cd %{_builddir}/%{extractdir1} DESTDIR="${RPM_BUILD_ROOT}" make install #remove the libtool archives find "${RPM_BUILD_ROOT}%{_dove_install_dir}/%{_dove_lib_dir_r}" -type f -name '*.la' -print0 | xargs -0r rm -f # GENERATE .service FILES, scripts sed -i \ -e 's|__DOVE_CONFDIR__|%{_dove_conf_dir}|g' \ -e 's|__DOVE_CONFFILE__|%{_dove_conf_file}|g' \ -e 's|__DOVE_DATA_INDXDIR__|%{_dove_data_indx_dir}|g' \ -e 's|__DOVE_DATA_MAILDIR__|%{_dove_data_mail_dir}|g' \ -e 's|__DOVE_DATA_SOLRDIR__|%{_dove_data_solr_dir}|g' \ -e 's|__DOVE_EXEC__|%{_dove_exec}|g' \ -e 's|__DOVE_EXECDIR__|%{_dove_exec_dir}|g' \ -e 's|__DOVE_GRP__|%{_dove_grp}|g' \ -e 's|__DOVE_GRP_MAIL__|%{_dove_grp_mail}|g' \ -e 's|__DOVE_GRP_NULL__|%{_dove_grp_null}|g' \ -e 's|__DOVE_GRP_SOLR__|%{_dove_grp_solr}|g' \ -e 's|__DOVE_LIBEXECDIR__|%{_dove_install_dir}/%{_dove_libexec_dir_r}/dovecot|g' \ -e 's|__DOVE_INSTALLDIR__|%{_dove_install_dir}|g' \ -e 's|__DOVE_LOGDIR__|%{_dove_log_dir}|g' \ -e 's|__DOVE_NAME__|%{_dove_name}|g' \ -e 's|__DOVE_PIDFILE__|%{_dove_pid_file}|g' \ -e 's|__DOVE_RUNDIR__|%{_dove_run_dir}|g' \ -e 's|__DOVE_SIEVEDIR__|%{_dove_sieve_dir}|g' \ -e 's|__DOVE_SSLDIR__|%{_dove_ssl_dir}|g' \ -e 's|__DOVE_UNITNM__|%{_dove_unitnm}|g' \ -e 's|__DOVE_USR__|%{_dove_usr}|g' \ -e 's|__DOVE_USR_MAIL__|%{_dove_usr_mail}|g' \ -e 's|__DOVE_USR_NULL__|%{_dove_usr_null}|g' \ -e 's|__DOVE_USR_SOLR__|%{_dove_usr_solr}|g' \ %{SOURCE100} %{SOURCE102} %{SOURCE103} %{SOURCE104} # DIRS mkdir -p ${RPM_BUILD_ROOT}/%{_dove_unit_dir} mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/pam.d mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/logrotate.d mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rsyslog.d # SERVICEs install -D -p -m 644 \ %{SOURCE100} \ ${RPM_BUILD_ROOT}/%{_dove_unit_dir}/%{_dove_unitnm}.service pushd ${RPM_BUILD_ROOT}/%{_dove_unit_dir}/ ln -s /dev/null %{_dove_unitnm}.socket popd rm -rf ${RPM_BUILD_ROOT}/%{_dove_install_dir}/%{_dove_dataroot_dir_r}/SYSTEMD_ORIG mv -f \ ${RPM_BUILD_ROOT}%{_unitdir} \ ${RPM_BUILD_ROOT}/%{_dove_install_dir}/%{_dove_dataroot_dir_r}/SYSTEMD_ORIG install -D -p -m 644 \ %{SOURCE102} \ ${RPM_BUILD_ROOT}/%{_sysconfdir}/pam.d/dovecot install -D -p -m 644 \ %{SOURCE103} \ ${RPM_BUILD_ROOT}/%{_sysconfdir}/logrotate.d/%{_dove_pkgnm} install -D -p -m 644 \ %{SOURCE104} \ ${RPM_BUILD_ROOT}/%{_sysconfdir}/rsyslog.d/%{_dove_pkgnm}.conf %pre %post %systemd_post %{_dove_unitnm}.service %preun %systemd_preun %{_dove_unitnm}.service %postun %systemd_postun_with_restart %{_dove_unitnm}.service %posttrans %check %files # http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html %{_dove_install_dir} %{_dove_unit_dir}/%{_dove_unitnm}.service %{_dove_unit_dir}/%{_dove_unitnm}.socket %config(noreplace) %{_sysconfdir}/pam.d/dovecot %{_sysconfdir}/logrotate.d/%{_dove_pkgnm} %{_sysconfdir}/rsyslog.d/%{_dove_pkgnm}.conf %changelog * Thu Mar 13 2025 pgnd _ - bump 1741902447