#
-# TODO:
-# - maybe split leaf editor ??
-# - look at html files
-#
-Summary: CONE - COnsole Newsreader and Emailer
-Summary(pl): CONE - tekstowy klient poczty i czytnik newsów
+# Conditional build:
+%bcond_with tests # "make check" (requires operational valgrind, i.e. with glibc-debuginfo)
+%bcond_with gnutls # GnuTLS instead of OpenSSL
+%bcond_with socks # (Courier) Socks support
+
+Summary: CONE - Console Newsreader and Emailer
+Summary(pl.UTF-8): CONE - tekstowy klient poczty i czytnik newsów
Name: cone
-Version: 0.60
-Release: 0.1
-License: GPL
+Version: 1.8
+Release: 1
+License: GPL v3 with OpenSSL exception
Group: Applications/Mail
-Source0: http://dl.sourceforge.net/courier/%{name}-%{version}.tar.bz2
-# Source0-md5: b2ae0cb3808e5485d566474c8bf251f9
+Source0: https://downloads.sourceforge.net/courier/%{name}-%{version}.tar.bz2
+# Source0-md5: 3b5c398c693d6aa60ea90f4d19f0ac39
+Patch0: %{name}-maildir.patch
+Patch1: %{name}-curses.patch
URL: http://www.courier-mta.org/cone/
BuildRequires: aspell-devel
-BuildRequires: autoconf
-BuildRequires: fam-devel
-BuildRequires: ncurses-devel
+BuildRequires: autoconf >= 2.59
+BuildRequires: automake
+%{?with_socks:BuildRequires: courier-sox-devel}
+BuildRequires: courier-unicode-devel >= 2.1
+BuildRequires: gettext-tools
+# or gnupg2 --with-gpg2, will use the same at runtime
+BuildRequires: gnupg
+%{?with_gnutls:BuildRequires: gnutls-devel >= 3.0}
+%{?with_gnutls:BuildRequires: libgcrypt-devel}
+%{?with_gnutls:BuildRequires: libgpg-error-devel}
+BuildRequires: libidn2-devel >= 0.0.0
BuildRequires: libstdc++-devel
-BuildRequires: libtool
-BuildRequires: libxml2-devel
-BuildRequires: openssl-devel
-BuildRequires: openssl-tools-perl
+BuildRequires: libtool >= 2:1.5
+BuildRequires: libxml2-devel >= 2.0
+BuildRequires: ncurses-devel >= 5
+BuildRequires: openldap-devel
+%{!?with_gnutls:BuildRequires: openssl-devel >= 0.9.7d}
+BuildRequires: pcre2-8-devel
BuildRequires: perl-base
+BuildRequires: pkgconfig
+BuildRequires: procps
+BuildRequires: sysconftool
+%{?with_tests:BuildRequires: valgrind}
BuildRequires: zlib-devel
+Requires: ca-certificates
+Suggests: gnupg
+Conflicts: courier-imap < 5
+Conflicts: courier-imapd < 1
+Conflicts: maildrop < 3
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
CONE is a simple, text-based E-mail reader and writer, and a simple
newsreader.
-%description -l pl
-CONE jest prostym, tekstowym klientem pocztowym, a tak¿e prostym
-czytnikiem newsów.
+%description -l pl.UTF-8
+CONE jest prostym, tekstowym klientem pocztowym, a także prostym
+czytnikiem newsów.
%package devel
-Summary: Header files for LibMAIL
-Summary(pl): Pliki nag³ówkowe LibMAIL
-Group: Development/Languages
-Requires: %{name} = %{version}-%{release}
-
-%description devel
-This package includes the header files for developing applications
-using LibMAIL - a high level, C++ OO library for mail clients.
-
-%description devel -l pl
-Ten pakiet zawiera pliki nag³ówkowe do tworzenia aplikacji z u¿yciem
-LibMAIL - wysokopoziomowej, zorientowanej obiektowo biblioteki C++ dla
-klientów pocztowych.
-
-%package static
-Summary: Static LibMAIL library
-Summary(pl): Biblioteka statyczna LibMAIL
+Summary: Header files and static LibMAIL library
+Summary(pl.UTF-8): Pliki nagłówkowe i biblioteka statyczna LibMAIL
Group: Development/Libraries
-Requires: %{name}-devel = %{version}-%{release}
-
-%description static
-This package contains static library for developing application using
-LibMAIL - a high level, C++ OO library for mail clients.
+Requires: courier-unicode-devel >= 2.0
+%{?with_gnutls:Requires: gnutls-devel >= 3.0}
+Requires: libidn2-devel >= 0.0.0
+Requires: libstdc++-devel
+%{!?with_gnutls:Requires: openssl-devel >= 0.9.7d}
+Obsoletes: cone-static < 0.96
-%description static -l pl
-Ten pakiet zawiera statyczn± bibliotekê do tworzenia aplikacji z
-u¿yciem LibMAIL - wysokopoziomowej, zorientowanej obiektowo biblioteki
-C++ dla klientów pocztowych.
+%description devel
+This package includes the header files and static library for
+developing applications using LibMAIL - a high level, C++ OO library
+for mail clients.
+
+%description devel -l pl.UTF-8
+Ten pakiet zawiera pliki nagłówkowe i bibliotekę statyczną do
+tworzenia aplikacji z użyciem LibMAIL - wysokopoziomowej,
+zorientowanej obiektowo biblioteki C++ dla klientów pocztowych.
+
+%package -n leaf
+Summary: Console text file editor
+Summary(pl.UTF-8): Konsolowy edytor plików tekstowych
+Group: Applications/Editors
+
+%description -n leaf
+Leaf is a simple console text file editor, with paragraph
+word-wrapping and spell checking. Leaf is based on the text editor in
+the Cone mail reader and composer.
+
+%description -n leaf -l pl.UTF-8
+Leaf jest prostym konsolowym edytorem plików tekstowych, z zawijaniem
+wierszy w akapitach i sprawdzaniem pisowni. Jest oparty na edytorze
+używanym w czytniku poczty Cone.
%prep
%setup -q
+%patch0 -p1
%build
-CXXFLAGS="%{rpmcflags} -I%{_includedir}/ncurses"
-PATH=$PATH:/usr/%{_lib}/openssl; export PATH
+%{__libtoolize}
+for d in $(sed -ne 's/.*AC_CONFIG_SUBDIRS(\([^)]*\))/\1/p' configure.ac) . ; do
+ if [ -d "$d" ]; then
+ cd $d
+ %{__aclocal}
+ %{__autoconf}
+ if grep -q AC_CONFIG_HEADER configure.ac ; then
+ %{__autoheader}
+ fi
+ %{__automake}
+ cd -
+ fi
+done
+
%configure \
- --with-devel
+ SENDMAIL=/usr/lib/sendmail \
+ --with-certdb=%{_sysconfdir}/certs/ca-certificates.crt \
+ --with-devel \
+ %{?with_gnutls:--with-gnutls} \
+ --with-notice=unicode
%{__make}
+%if %{with tests}
%{__make} check
+%endif
%install
rm -rf $RPM_BUILD_ROOT
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-# start cone directly
-mv -f $RPM_BUILD_ROOT%{_libdir}/cone $RPM_BUILD_ROOT%{_bindir}
-mv -f $RPM_BUILD_ROOT%{_sysconfdir}/cone.dist $RPM_BUILD_ROOT%{_sysconfdir}/cone
+%{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/cone.dist $RPM_BUILD_ROOT%{_sysconfdir}/cone
-# move devel docs from datadir
-mkdir devel
-for file in account-* address.html book.html c2*.html e*.html folder-* \
-mail-* mimestruct* native* r11* r8* synchronous.html; do
-mv -f $RPM_BUILD_ROOT%{_datadir}/cone/$file devel
-done
-
-# rest *.html will go to primary docs
-mkdir docs
-mv -f $RPM_BUILD_ROOT%{_datadir}/cone/*.html docs
-
-# install missing files
-install libmail/mailtool $RPM_BUILD_ROOT%{_bindir}/mailtool
-install help.txt $RPM_BUILD_ROOT%{_datadir}/cone
+# move docs to more specific location
+install -d $RPM_BUILD_ROOT%{_docdir}/%{name}
+%{__mv} $RPM_BUILD_ROOT%{_datadir}/cone/{*.html,manpage.css} $RPM_BUILD_ROOT%{_docdir}/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
+%triggerpostun -- %{name} < 1
+%banner -e cone-unicode <<EOF
+WARNING: you have to convert any existing maildirs to Unicode naming scheme.
+See INSTALL file for details.
+EOF
+
%files
%defattr(644,root,root,755)
-%doc ABOUT-NLS ChangeLog README NEWS AUTHORS docs/
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/cone
+%doc AUTHORS COPYING ChangeLog NEWS README
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/cone
%attr(755,root,root) %{_bindir}/cone
-%attr(755,root,root) %{_bindir}/leaf
%attr(755,root,root) %{_bindir}/mailtool
+%attr(755,root,root) %{_libexecdir}/cone
%{_datadir}/cone
-%{_mandir}/man1/*
+%{_mandir}/man1/cone.1*
+%{_mandir}/man1/mailtool.1*
+%dir %{_docdir}/%{name}
+%{_docdir}/%{name}/FAQ.html
+%{_docdir}/%{name}/INSTALL.html
+%{_docdir}/%{name}/README.html
+%{_docdir}/%{name}/add.html
+%{_docdir}/%{name}/attributes.html
+%{_docdir}/%{name}/bk01-toc.html
+%{_docdir}/%{name}/cone*.html
+%{_docdir}/%{name}/conn.html
+%{_docdir}/%{name}/index.html
+%{_docdir}/%{name}/maillist.html
+%{_docdir}/%{name}/mailtool.html
+%{_docdir}/%{name}/manpage.css
+%{_docdir}/%{name}/moredocs.html
+%{_docdir}/%{name}/search.html
+%{_docdir}/%{name}/smap*.html
+%{_docdir}/%{name}/store.html
%files devel
%defattr(644,root,root,755)
-%doc devel/
+%{_libdir}/libmail.a
+%{_libdir}/libmail.la
%{_includedir}/libmail
-%{_mandir}/man[35]/*
-
-%files static
+%{_mandir}/man3/mail::*.3x*
+%dir %{_docdir}/%{name}
+%{_docdir}/%{name}/account-*.html
+%{_docdir}/%{name}/address.html
+%{_docdir}/%{name}/cppnamespace.html
+%{_docdir}/%{name}/emailaddress.html
+%{_docdir}/%{name}/envelope.html
+%{_docdir}/%{name}/folder-*.html
+%{_docdir}/%{name}/header-*.html
+%{_docdir}/%{name}/libmail*.html
+%{_docdir}/%{name}/mail-*.html
+%{_docdir}/%{name}/mimestruct.html
+%{_docdir}/%{name}/misc.html
+%{_docdir}/%{name}/native.html
+%{_docdir}/%{name}/synchronous.html
+
+%files -n leaf
%defattr(644,root,root,755)
-%{_libdir}/libmail.a
+%attr(755,root,root) %{_bindir}/leaf
+%{_mandir}/man1/leaf.1*
+%dir %{_docdir}/%{name}
+%{_docdir}/%{name}/leaf.html