Blob Blame History Raw
%bcond_with doxy

#%%global gitdate 20160610
#%%global commit0 8901a5c0465637e98bb998518ae644198d6728e2
%global srcurl  https://github.com/jktjkt/%{name}

Name:           trojita
%if 0%{?gitdate}
Version:        0.7
Release:        0.4.%{gitdate}git%(c=%{commit0}; echo ${c:0:7} )%{?dist}.1
Source0:        %{srcurl}/archive/%{commit0}.tar.gz#/%{name}-%{commit0}.tar.gz
%else
Version:        0.7
Release:        4%{?dist}.1
Source0:        %{srcurl}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
%endif
# manually generated manpage with help2man
# help2man -o trojita.1 --no-info --no-discard-stderr -h --version-string=0.6 /usr/bin/trojita
#Source1:        trojita.1

# python2 ./l10n-fetch-po-files.py ; tar czf %{name}_common-po-20160612.tar.gz po/
# calls svn to get latest po files
Source10:       %{name}_common-po-20160612.tar.gz

# Almost everything: dual-licensed under the GPLv2 or GPLv3
# (with KDE e.V. provision for relicensing)
# src/XtConnect: BSD
# src/Imap/Parser/3rdparty/kcodecs.*: LGPLv2
# Nokia imports: LGPLv2.1 or GPLv3
# src/Imap/Parser/3rdparty/rfccodecs.cpp: LGPLv2+
# src/qwwsmtpclient/: GPLv2
## note that LGPL 2.1 short name is LGPLv2 according to
## https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
#License:        GPLv2+ and LGPLv2+ and BSD
License:        GPLv2+

Summary:        IMAP e-mail client
URL:            http://%{name}.flaska.net

BuildRequires:  kf5-rpm-macros
%global ctest ctest%{?rhel:3} %{?_smp_mflags} --output-on-failure -VV

# pre-build: generation of additional sources
#BuildRequires:  python2 subversion
#BuildRequires:  help2man

BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5Svg)
BuildRequires:  pkgconfig(Qt5Test)
BuildRequires:  pkgconfig(Qt5WebKit)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  qt5-qttools-devel

# explicitly install Qt5Svg for runtime, rpmbuild's magic fails
Requires:       qt5-qtsvg

# (optional) features
BuildRequires:  pkgconfig(zlib)
BuildRequires:  qtkeychain-qt5-devel
%if 0%{?fedora}
BuildRequires:  ragel
%endif

# (optional) support for GPG and S/MIME
BuildRequires:  kf5-gpgmepp-devel
BuildRequires:  gpgme-devel
BuildRequires:  libgpg-error-devel
BuildRequires:  boost-devel
BuildRequires:  mimetic-devel
# fix for inside mockbuild, gpg: deleting secret key failed: No pinentry
BuildRequires:  pinentry

%if %{with doxy}
BuildRequires:  doxygen graphviz
%endif

# needs for %%check
BuildRequires:  desktop-file-utils
%if 0%{?fedora}
BuildRequires:  libappstream-glib
%endif
BuildRequires:  xorg-x11-server-Xvfb

# provide some icons
Requires:       hicolor-icon-theme

%description
Trojitá is a IMAP e-mail client which:
  * Enables you to access your mail anytime, anywhere.
  * Does not slow you down. If we can improve the productivity of an e-mail
    user, we better do.
  * Respects open standards and facilitates modern technologies. We value
    the vendor-neutrality that IMAP provides and are committed to be as
    inter-operable as possible.
  * Is efficient — be it at conserving the network bandwidth, keeping memory
    use at a reasonable level or not hogging the system's CPU.
  * Can be used on many platforms. One UI is not enough for everyone, but our
    IMAP core works fine on anything from desktop computers to cell phones
    and big ERP systems.
  * Plays well with the rest of the ecosystem. We don't like reinventing wheels,
    but when the existing wheels quite don't fit the tracks, we're not afraid
    of making them work.

This application is heavily based on Qt and uses WebKit.


%prep
%if 0%{?gitdate}
%setup -qn%{name}-%{commit0}
%else
%autosetup
%endif
%{__tar} xf %{SOURCE10}

%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
# change path for the library, https://bugs.kde.org/show_bug.cgi?id=332579
%cmake_kf5 .. \
    -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir}/%{name} \
    -DCMAKE_INSTALL_RPATH=%{_libdir}/%{name} \
    -DBUILD_SHARED_LIBS:BOOL=OFF
popd
%make_build -C %{_target_platform}

%if %{with doxy}
doxygen src/Doxyfile
%endif

%install
%make_install -C %{_target_platform}
%find_lang %{name}_common --with-qt
#install -m644 -p -D %{SOURCE1} %{buildroot}%{_mandir}/man1/%{name}.1


%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
# appstream is not available in EPEL
%if 0%{?fedora}
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
%endif
# do tests in some fake X
#xvfb-run -a find %{_target_platform} -name test_\* -print -exec '{}' \;
pushd %{_target_platform}
xvfb-run -a %ctest


%post
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files -f %{name}_common.lang
%license LICENSE
%doc README src/Doxyfile
#%%{_mandir}/man1/%{name}.1*
%{_libdir}/%{name}/
%{_bindir}/%{name}
%{_bindir}/be.contacts
%{_datadir}/appdata/*.appdata.xml
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/32x32/apps/*.png
%{_datadir}/icons/hicolor/scalable/apps/*.svg

%if %{with doxy}
# optional developer documentation
%package doc
BuildArch: noarch
Summary:   Documentation files for %{name}

%description doc
%{summary}.

%files doc
%license LICENSE
%doc _doxygen/*
%endif


%changelog
* Mon Jan 16 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.7-4.1
- Rebuild for gpgme 1.8.0

* Sat Jul 02 2016 Raphael Groner <projects.rg@smart.ms> - 0.7-4
- [epel7] rebuild for qtkeychain-0.7.0

* Sat Jun 25 2016 Raphael Groner <projects.rg@smart.ms> - 0.7-3
- explicitly R: qt5-qtsvg

* Sat Jun 25 2016 Raphael Groner <projects.rg@smart.ms> - 0.7-2
- [epel7] enable gpg and mimetic
- [epel7] fix cmake for kf5
- improve some comments
- [epel7] appstream is not available
- [epel7] fix ctest

* Sun Jun 12 2016 Raphael Groner <projects.rg@smart.ms> - 0.7-1
- official upstream version

* Sun Jun 12 2016 Raphael Groner <projects.rg@smart.ms> - 0.7-0.1.20160610git8901a5c
- switch to git snapshot
- add support for GPG and MIME
- drop manpage
- use target build folder

* Mon May 23 2016 Nikos Roussos <comzeradd@fedoraproject.org> 0.6-6
- Rebuild for qtkeychain new release

* Fri May 20 2016 Raphael Groner <projects.rg@smart.ms> - 0.6-5
- rebuild due to qtkeychain ABI change

* Tue Apr 05 2016 Raphael Groner <projects.rg@smart.ms> - 0.6-4
- reenable tests on all arches, icu/gcc6 bug is fixed, rhbz#1307633, rhbz#1309731

* Tue Mar 08 2016 Rex Dieter <rdieter@fedoraproject.org> 0.6-3
- drop DBUS_FATAL_WARNINGS=0 hack, rhbz#1309731 fixed
- use pregenerated trojita manpage (built-time one is bad)

* Sun Feb 21 2016 Raphael Groner <projects.rg@smart.ms> - 0.6-2
- use xvfb-run -a
- workaround for FTBFS cause of dbus, rhbz#1309731
- disable fatal warnings

* Tue Feb 02 2016 Raphael Groner <projects.rg@smart.ms> - 0.6-1
- new version
- use xvfb-run

* Wed Dec 16 2015 Raphael Groner <projects.rg@smart.ms> - 0.5a-2.20151216gitefa30f3
- add QtKeyChain
- drop qt4

* Wed Dec 16 2015 Raphael Groner <projects.rg@smart.ms> - 0.5a-1.20151216gitefa30f3
- use latest upstream snapshot as post-release
- finally well Qt5.6 support!

* Sat Dec 12 2015 Raphael Groner <projects.rg@smart.ms> - 0.5-9
- add upstream patches for Qt5.x

* Mon Oct 05 2015 Raphael Groner <projects.rg@smart.ms> - 0.5-8
- add missing headers inclusion, rhbz#1266712

* Fri Jun 26 2015 Raphael Groner <projects.rg@smart.ms> - 0.5-7
- fix build conditional for optional doxygen

* Fri Jun 26 2015 Raphael Groner <projects.rg@smart.ms> - 0.5-6
- optional BR: at EPEL

* Wed Jun 24 2015 Raphael Groner <projects.rg@smart.ms> - 0.5-5
- add files validation
- use license GPLv2+ aggregated
- use build conditionals
- insert some comments
- insert BR: zlib-devel (optional imap compression)

* Wed Apr 01 2015 Raphael Groner <projects.rg@smart.ms> - 0.5-4
- reenable html formatting testcase
- optional doxygen

* Wed Apr 01 2015 Raphael Groner <projects.rg@smart.ms> - 0.5-3
- ease switching build with qt4 or qt5
- disable doxygen
- remove toolkit from summary
- use build subfolder
- improve tests execution

* Tue Mar 31 2015 Raphael Groner <projects.rg@smart.ms> - 0.5-2
- build for qt5

* Sat Feb 28 2015 Raphael Groner <projects.rg (AT) smart.ms> - 0.5-1
- clean files section and R: hicolor-icon-theme
- introduce license macro
- use name macro generally
- new upstream version 0.5
- distribute doxygen files

* Mon Oct 27 2014 Karel Volný <kvolny@redhat.com> 0.4.1-3
- Added ragel build requirement

* Mon Apr 14 2014 Karel Volný <kvolny@redhat.com> 0.4.1-2
- Fixed icon handling and added comments as per the package review
- https://bugzilla.redhat.com/show_bug.cgi?id=1080411#c2

* Tue Mar 25 2014 Karel Volný <kvolny@redhat.com> 0.4.1-1
- Initial Fedora version based on upstream OBS package