File dbmail.spec of Package dbmail
#
# spec file for package dbmail
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2024 Georg Pfuetzenreuter <mail+rpm@georg-pfuetzenreuter.net>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define services %{name}-imapd.service %{name}-lmtpd.service %{name}-pop3d.service %{name}-timsieved.service
%bcond_without manpages
Name: dbmail
Version: 3.4.1
Release: 0
Summary: Fast and scalable email services
License: GPL-2.0-or-later
Group: Productivity/Networking/Email/Servers
URL: https://dbmail.org
Source0: %{name}-%{version}.tar.gz
Source1: %{name}.sysusers
BuildRequires: mhash-devel
BuildRequires: pkgconfig
BuildRequires: sysuser-tools
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gmime-3.0)
BuildRequires: pkgconfig(jemalloc)
BuildRequires: pkgconfig(libevent)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zdb)
Requires: %{_sbindir}/sendmail
Recommends: logrotate
Provides: DBMail
%sysusers_requires
%if %{with manpages}
BuildRequires: asciidoc
BuildRequires: xmlto
%endif
%description
DBMail is a collection of programs that enables email to be managed, stored in and retrieved from a database.
%package devel
Summary: Development headers for DBMail
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%description devel
Development header files for DBMail.
%prep
%autosetup
%build
%configure \
%{?with_manpages:--enable-manpages} \
--enable-systemd \
--with-gnu-ld
%make_build
%sysusers_generate_pre %{SOURCE1} %{name}
%install
%make_install
for service in %{services}
do
ln -s service %{buildroot}%{_sbindir}/rc${service%.service}
done
install -D %{SOURCE1} %{buildroot}%{_sysusersdir}/%{name}-user.conf
install -d %{buildroot}%{_localstatedir}/log/%{name} %{buildroot}%{_sharedstatedir}/%{name}
install -d %{buildroot}%{_sysconfdir} %{buildroot}%{_sysconfdir}/logrotate.d
sed -E \
-e s?%{_localstatedir}/tmp?%{_sharedstatedir}/%{name}? \
-e s?%{_localstatedir}/run?%{_rundir}? \
-e 's/(effective_user \s+=) nobody/\1 %{name}/' \
%{name}.conf > %{buildroot}%{_sysconfdir}/%{name}.conf
sed \
-e s?%{_localstatedir}/run?%{_rundir}? \
%{name}.logrotate > %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
rm doc/README.solaris
%pre -f %{name}.pre
%service_add_pre %{services}
%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%service_add_post %{services}
%preun
%service_del_preun %{services}
%postun
%service_del_postun %{services}
%files
%license COPYING
%doc CHANGELOG.md README.md UPGRADING dbmail.schema doc
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/{libauth_sql,libdbmail}.la
%{_sbindir}/%{name}-deliver
%{_sbindir}/%{name}-export
%{_sbindir}/%{name}-httpd
%{_sbindir}/%{name}-imapd
%{_sbindir}/%{name}-lmtpd
%{_sbindir}/%{name}-pop3d
%{_sbindir}/%{name}-users
%{_sbindir}/%{name}-util
%{_unitdir}/%{name}-imapd.service
%{_unitdir}/%{name}-lmtpd.service
%{_unitdir}/%{name}-pop3d.service
%{_unitdir}/%{name}-timsieved.service
%{_tmpfilesdir}/%{name}.conf
%ghost %{_rundir}/%{name}
%{_sbindir}/rc%{name}-imapd
%{_sbindir}/rc%{name}-lmtpd
%{_sbindir}/rc%{name}-pop3d
%{_sbindir}/rc%{name}-timsieved
%if %{with manpages}
%{_mandir}/man1/%{name}.1%{?ext_man}
%{_mandir}/man1/%{name}-deliver.1%{?ext_man}
%{_mandir}/man5/%{name}.conf.5%{?ext_man}
%{_mandir}/man8/%{name}-{export,httpd,imapd,lmtpd,pop3d,sievecmd,sieved,timsieved,users,util}.8%{?ext_man}
%endif
# only the unversioned libdbmail can be split out
%{_libdir}/%{name}/libauth_sql.so*
%{_libdir}/%{name}/lib%{name}.so.*
%attr(0644,-,-) %{_sysusersdir}/%{name}-user.conf
%attr(0640,-,%{name}) %config(noreplace) %{_sysconfdir}/%{name}.conf
%attr(0750,%{name},%{name}) %dir %{_sharedstatedir}/%{name}
%attr(0750,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
%config %{_sysconfdir}/logrotate.d/%{name}
%files devel
%{_libdir}/%{name}/lib%{name}.so
%changelog