%global git 0 %if 0%{!?mkrel:1} %define mkrel(c) %{1}%{?dist} %endif Summary: Utility to synchronize IMAP mailboxes with local maildir folders Name: isync Version: 1.5.1 Release: %mkrel 1.3 License: GPL-2.0+ Group: Applications/Internet Source: https://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.gz URL: http://isync.sf.net/ BuildRoot: %{_tmppath}/%{name}-buildroot BuildRequires: gcc BuildRequires: make BuildRequires: perl >= 5.14 BuildRequires: pkgconfig(libsasl2) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(zlib) # Isync has two different "schemes" to store UID information: "native" uses # plain text files and "alternative" uses Berkeley DB (seemingly a relic from # pre-1.0 versions of isync). "Native" is the default and you have to use # `mdconvert` (not included when built without support for Berkeley DB) to # convert between them. # Most distros stick with Berkeley DB 5.3.28, a late GPL-compatible version # (the latest GPL-compatible version was 6.0.19), but OpenMandriva has the # non-GPL-compatible version 18.40.1, the final version before Oracle ceased # development of Berkeley DB in 2022. Berkeley DB has already been removed from # CentOS 10 and more distros likely to follow. The maintainer of isync # recommends not using "alternative" and sees migrating the code to use a # maintained database to be a waste of time. # See https://sourceforge.net/p/isync/mailman/isync-devel/thread/92ad555b-a177-2fe9-ab70-67f314c793ac%40redhat.com/ # RedHat has deprecated Berkeley DB since Fedora 33, but continues to build # isync with Berkeley DB support. ArchLinux recently removed building with # Berkeley DB. # See https://sourceforge.net/p/isync/mailman/isync-devel/thread/ZyDibt7Y4e6g3f3l%40fettsack/ # I haven't built my RPMs with Berkeley DB support since I learned that it's # not even used by default. # The Berkeley DB package is called libdb-devel in RedHat OSes (Fedora, RHEL, # CentOS, EPEL, etc.) but db-devel elsewhere. There's no pkg-config .pc file # even in 18.40.1, so just pkgconfig(db) isn't possible. # Again, built without Berkeley DB by default. Use --with bdb to build with it. %bcond_with bdb %if 0%{?centos} < 10 && %{with bdb} BuildRequires: (db-devel >= 4.1 or libdb-devel >= 4.1) %endif %if %{git} # Extra things needed when building from Git instead of the release tarball. BuildRequires: automake, autoconf BuildRequires: git BuildRequires: perl(Date::Parse) BuildRequires: unzip %endif # An XOAUTH2 plugin for SASL, necessary XOAuth2 support (Gmail/G Suite without # app passwords enabled, Outlook/Office 365, etc.), with the following preference: # 1. sasl2-kdexoauth2: OpenSUSE's name for the SASL plugin from libkgapi, # KDE's library for using Google APIs. # EPEL, Fedora, and OpenMandriva include the plugin in the libkgapi package, # but Mageia and OpenSUSE package the plugin in a different package from the # rest of libkgapi and libkgapi doesn't depend on the plugin's package, # so recommending libgkapi could result in Mageia and OpenSUSE not having a suitable plugin. # 2. sasl2-plugin-kdexoauth2: Mageia's name. # 3. libkgoogle: An alias of libkgapi used by EPEL and Fedora, # circumventing the above note about not being able to recommend libkgapi. # 4. cyrus-sasl-xoauth2: An outdated, unmaintained plugin known to have various # issues with isync, but it's easy to build, requiring minimal dependencies, # so for distributions other than EPEL, Fedora, OpenSUSE, and Mageia, this # is an acceptable if not ideal option. I've tried it and it worked fine for # me: no hangs, no crashes, but just synchronized my mail. Recommends: (sasl2-kdexoauth2 or sasl2-plugin-kdexoauth2 or libkgoogle or cyrus-sasl-xoauth2) # And OAUTHBEARER, the standardized successor of XOAUTH2, but not supported by # all servers (ahem, M$'s): Recommends: (sasl-oauthbearer) Provides: mbsync %if %{with bdb} Provides: mdconvert %endif %description isync is a command line utility which synchronizes mailboxes; currently Maildir and IMAP4 mailboxes are supported. New messages, message deletions and flag changes can be propagated both ways. It is useful for working in disconnected mode, such as on a laptop or with a non-permanent internet collection (dIMAP), but also for mirroring mailboxes between servers. # From OpenSUSE: Synchronization is based on unique message identifiers (UIDs), so no identification conflicts can occur (as opposed to some other mail synchronizers). Synchronization state is kept in one local text file per mailbox pair; multiple replicas of a mailbox can be maintained. %prep %autosetup -p1 %if %{git} ./autogen.sh %endif %build %configure --docdir=%{_docdir}/%{name} %make_build %install rm -rf $RPM_BUILD_ROOT %make_install rm -rf $RPM_BUILD_ROOT/%{_docdir}/%{name} # systemd unit from ArchLinux %if 0%{!?_userunitdir:1} %define _userunitdir %{_prefix}/lib/systemd/user %endif install -d %{buildroot}%{_userunitdir} cat << EOF > %{buildroot}%{_userunitdir}/mbsync.service [Unit] Description=Mailbox synchronization service [Service] Type=oneshot ExecStart=%{_bindir}/mbsync -Va [Install] WantedBy=default.target EOF cat << EOF > %{buildroot}%{_userunitdir}/mbsync.timer # This timer configures mbsync to be started 2 minutes after boot, and then every 5 minutes. [Unit] Description=Mailbox synchronization timer [Timer] OnBootSec=2m OnUnitActiveSec=5m Unit=mbsync.service [Install] WantedBy=timers.target EOF # Alias mbsync as isync. Historically, isync was the original version (0.x) # that read from ~/.isyncrc; mbsync was a later incompatible version (1.x) that # read from ~/.mbsyncrc and had a wrapper to read from ~/.isyncrc but mostly as # a way to migrate to mbsync. Now, the XDG-compliant location of the config # file is $XDG_CONFIG_HOME/isyncrc (though, ~/.mbsyncrc still works) and isync # no longer exists (removed in 1.4.0), so there's no reason not to create a # symlink, considering that it is easy to type `isync` rather than `mbsync` by # mistake. ln -sr %{buildroot}%{_bindir}/mbsync %{buildroot}%{_bindir}/isync for file in %{buildroot}%{_mandir}/man1/mbsync.1* %{buildroot}%{_userunitdir}/mbsync.*; do dir=$(dirname $file) filename=$(basename $file) ln -sr $file $dir/${filename/mbsync/isync} done %clean rm -rf $RPM_BUILD_ROOT %files %doc AUTHORS COPYING NEWS README TODO ChangeLog src/mbsyncrc.sample %{_bindir}/* %{_mandir}/man1/* %{_userunitdir}/*