File maildrop.spec of Package maildrop

#
# spec file for package maildrop
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%define makeinstall make install DESTDIR=%{buildroot}
%define name822      librfc822
%define soname822    %{name822}-0
%define name2045     librfc2045
%define soname2045   %{name2045}-0
Name:           maildrop
Version:        2.9.3
Release:        0
Summary:        The mail filter/mail delivery agent from the Courier Mail suite
License:        GPL-3.0+
Group:          Productivity/Networking/Email/Utilities
Url:            http://www.courier-mta.org/maildrop/
Source:         http://prdownloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2
Source1:        http://prdownloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2.sig
Source2:        %{name}.keyring
Patch1:         maildrop-2.7.1-reformime-filenamedecode.patch
BuildRequires:  courier-authlib-devel
BuildRequires:  gcc-c++
BuildRequires:  gdbm-devel
BuildRequires:  pcre-devel
BuildRequires:  libcourier-unicode-devel
Requires:       %{_bindir}/deliverquota
Requires:       %{_bindir}/maildirmake
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} <= 1220
BuildRequires:  fam-devel
%else
BuildRequires:  gamin-devel
%endif
%if 0%{?suse_version} >= 1030 && 0%{?suse_version} <= 1140
BuildRequires:  licenses
Requires:       licenses
%endif

%description
maildrop is a replacement for a local mail delivery agent. maildrop reads a
mail message from standard input, then delivers the message to an mailbox.
maildrop knows how to deliver mail to mbox-style mailboxes and maildirs.
"maildir" is a mailbox format used by Courier, Qmail and Postfix.

maildrop optionally reads instructions from a file, which describe how to
filter incoming mail. These instructions can direct maildrop to deliver the
message to an alternate mailbox, or forward it somewhere else. Unlike procmail,
maildrop uses a structured filtering language.

maildrop is written in C++, and is significantly larger than procmail. However,
much more efficiently. Unlike procmail, it uses resources better and will not
read a 10 megabyte mail message into memory, but save large messages in a
temporary file, and then get filtered. If the standard input to maildrop is a
file, and not a pipe, a temporary file will not be necessary.

maildrop checks the mail delivery instruction syntax from the filter file
before attempting to deliver a message. Unlike procmail, if the filter file
contains syntax errors, maildrop terminates without delivering the message. The
user can fix the typo without causing any mail to be lost.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name2045}-devel = %{version}-%{release}
Requires:       %{name822}-devel = %{version}-%{release}
Requires:       %{name} = %{version}

%description devel
Development header and library files for %{name}.

%package maildirutils
Summary:        Utilities used by maildrop
Group:          Productivity/Networking/Email/Utilities
Conflicts:      courier-imap

%description maildirutils
This package contains deliverquota and maildirmake which are required by
maildrop.

The reason for the separate package is to avoid conflicts with courier-imap
which also ships these applications.

%package -n %{soname822}
Summary:        Library for RFC822 ARPA Internet Message Handling
Group:          System/Libraries

%description -n %{soname822}
This library implements parsing and manipulation of ARPA Internet Messages
according to RFC 822.

%package -n %{name822}-devel
Summary:        Library for RFC822 ARPA Internet Message Handling
Group:          Development/Libraries/C and C++
Requires:       %{soname822} = %{version}-%{release}

%description -n %{name822}-devel
This library implements parsing and manipulation of ARPA Internet Messages
according to RFC 822.

%package -n %{soname2045}
Summary:        Library for RFC2045 MIME Extension Handling
Group:          System/Libraries

%description -n %{soname2045}
This library implements parsing and manipulation of MIME extensions
according to RFC 2045.

%package -n %{name2045}-devel
Summary:        Library for RFC2045 MIME Extension Handling
Group:          Development/Libraries/C and C++
Requires:       %{soname2045} = %{version}-%{release}

%description -n %{name2045}-devel
This library implements parsing and manipulation of MIME extensions
according to RFC 2045.

%package doc
Summary:        Additional maildrop Documentation
Group:          Productivity/Networking/Email/Utilities
BuildArch:      noarch

%description doc
This package contains additional maildrop documentation.

%prep
%setup -q
%patch1 -p1

%build
%configure                                      \
    --disable-static                            \
    --docdir=%{_docdir}/%{name}                 \
    --enable-syslog=1                           \
    --with-etcdir=%{_sysconfdir}/mail/%{name}   \
    --enable-maildirquota                       \
    --enable-keep-fromline=1                    \
    --with-devel                                \
    --enable-userdb                             \
    --enable-sendmail=%{_sbindir}/sendmail      \
    --enable-restrict-trusted=0                 \
    --enable-trusted-users='root mail daemon postmaster qmaild mmdf'

make %{?_smp_mflags}

%install
%{make_install} MAILDROPUID='' MAILDROPGID=''

# fix pathnames ('[set $man.base.url.for.relative.links]') in manpages
sed -i "s#\[set \$man.base.url.for.relative.links\]#%{_defaultdocdir}/%{name}#" \
       %{buildroot}%{_mandir}/man*/*

# remove pointless .la files (brp-check-la)
find %{buildroot} -type f -name "*.la" -delete -print

cat<<EOF >README.%{name}-devel
This is an obsolete package, use librfc822-devel and librfc2045-devel
instead.
EOF

h=%{_datadir}/doc/licenses/md5/$(md5sum COPYING|cut -f1 -d" ")
test -e "$h" && ln -s -f "$h" .

%post   -n %{soname822} -p /sbin/ldconfig

%postun -n %{soname822} -p /sbin/ldconfig

%post   -n %{soname2045} -p /sbin/ldconfig

%postun -n %{soname2045} -p /sbin/ldconfig

%files
%defattr(-,root,root)
#%%doc maildir/README.maildirquota.html maildir/README.maildirquota.txt
%doc COPYING* README README.postfix NEWS UPGRADE ChangeLog maildroptips.txt
# work around strange behaviour of the above %%doc line, see:
#     https://pagure.io/packaging-committee/issue/338
# although the html subdir is not mentioned, it will be implicitly packaged
# into the main package, duplicate files errors will be reported against the
# doc subpackage. The exclude helps.
%exclude %{_docdir}/%{name}/html
%attr(755, root, mail) %{_bindir}/maildrop
%attr(755, root, mail) %{_bindir}/lockmail
%{_bindir}/mailbot
%{_bindir}/reformail
%{_bindir}/makemime
%{_bindir}/reformime
%{_mandir}/man1/lockmail.1%{ext_man}
%{_mandir}/man1/mailbot.1%{ext_man}
%{_mandir}/man1/maildrop.1%{ext_man}
%{_mandir}/man1/makemime.1%{ext_man}
%{_mandir}/man1/reformail.1%{ext_man}
%{_mandir}/man1/reformime.1%{ext_man}
%{_mandir}/man5/maildir.5%{ext_man}
%{_mandir}/man7/maildirquota.7%{ext_man}
%{_mandir}/man7/maildropex.7%{ext_man}
%{_mandir}/man7/maildropfilter.7%{ext_man}
%{_mandir}/man7/maildropgdbm.7%{ext_man}

%files devel
%defattr(-, root, root)
%doc README.%{name}-devel

%files -n %{soname822}
%defattr(-, root, root)
%{_libdir}/%{name822}.so.*

%files -n %{name822}-devel
%defattr(-, root, root)
%{_includedir}/rfc822.h
%{_libdir}/%{name822}.so
%{_mandir}/man3/rfc822.3%{ext_man}

%files -n %{soname2045}
%defattr(-, root, root)
%{_libdir}/%{name2045}.so.*

%files -n %{name2045}-devel
%defattr(-, root, root)
%{_includedir}/rfc2045.h
%{_includedir}/rfc2047.h
%{_libdir}/%{name2045}.so
%{_mandir}/man3/rfc2045.3%{ext_man}

%files doc
%defattr(-, root, root)
%doc %{_docdir}/%{name}/html

%files maildirutils
%defattr(-, root, root)
%{_bindir}/maildirmake
%{_bindir}/makedat
%{_bindir}/makedatprog
%{_bindir}/deliverquota
%{_mandir}/man1/maildirmake.1%{ext_man}
%{_mandir}/man8/deliverquota.8%{ext_man}
%{_mandir}/man1/makedat.1%{ext_man}

%changelog
openSUSE Build Service is sponsored by