File libquentier.spec of Package libquentier-master

%if 0%{?fedora_version} >= 33
%global _vpath_builddir .
%endif

%define lname libqt5quentier0
Name:       libquentier
Summary:    Set of Qt/C++ APIs for feature rich desktop clients for Evernote service
Version:    0.5.0
Release:    1%{?dist}

Group:      Development/Libraries/C and C++

%if 0%{?fedora_version}
License:    GPLv3 or LGPLv3
%else
License:	GPL-3.0-only or LGPL-3.0-only
%endif

URL:        https://github.com/d1vanov/libquentier
Source:     %{name}-%{version}.tar.gz

BuildRequires: cmake
BuildRequires: cmake(Qt5Core)
BuildRequires: cmake(Qt5Gui)
BuildRequires: cmake(Qt5Widgets)
BuildRequires: cmake(Qt5Network)
BuildRequires: cmake(Qt5PrintSupport)
BuildRequires: cmake(Qt5Xml)
BuildRequires: cmake(Qt5Xml)
BuildRequires: cmake(Qt5Sql)
BuildRequires: cmake(Qt5Test)
BuildRequires: cmake(Qt5LinguistTools)
BuildRequires: cmake(Qt5DBus)
BuildRequires: cmake(Qt5WebEngine)
BuildRequires: cmake(Qt5WebEngineCore)
BuildRequires: cmake(Qt5WebEngineWidgets)
BuildRequires: cmake(Qt5WebSockets)
BuildRequires: cmake(Qt5WebChannel)
BuildRequires: cmake(QEverCloud-qt5)
BuildRequires: cmake(Qt5Keychain)
BuildRequires: coreutils
BuildRequires: pkgconfig(hunspell)
BuildRequires: pkgconfig(openssl)
BuildRequires: libxml2-devel
BuildRequires: boost-devel
BuildRequires: libtidy-devel
BuildRequires: doxygen
BuildRequires: graphviz

%if 0%{?fedora_version}
BuildRequires: xorg-x11-server-Xvfb
%else
%if 0%{?suse_version} > 1500
BuildRequires: libtidy58
%else
BuildRequires: libtidy5
%endif
BuildRequires: xvfb-run
BuildRequires: libQt5Sql5-sqlite
Requires: libQt5Sql5-sqlite
%endif


%description
This library presents a set of Qt/C++ APIs useful for applications working as
feature rich desktop clients for Evernote service. The most important and
useful components of the library are the following:

 - Local storage - persistence of data downloaded from Evernote service in
   a local SQLite database
 - Synchronization - the logics of exchanging new and/or modified data
   with Evernote service
 - Note editor - the UI component capable for notes displaying and editing

The library is based on the lower level functionality provided by QEverCloud
library. It also serves as the functional core of Quentier application.


%package -n %{lname}
Summary:		Set of Qt/C++ APIs for feature rich desktop clients for Evernote service
Group:			Development/Libraries/C and C++
%if 0%{?suse_version}
Recommends:     %lname-lang
%endif

%description -n %{lname}
This library presents a set of Qt/C++ APIs useful for applications working as
feature rich desktop clients for Evernote service. The most important and
useful components of the library are the following:

 - Local storage - persistence of data downloaded from Evernote service in
   a local SQLite database
 - Synchronization - the logics of exchanging new and/or modified data
   with Evernote service
 - Note editor - the UI component capable for notes displaying and editing

The library is based on the lower level functionality provided by QEverCloud
library. It also serves as the functional core of Quentier application.


%package devel
Summary:       	Development files for %{name}
Requires:      	%{lname} = %{version}-%{release}

%description devel
Files for developing applications that use %{name}.


%package doc
Summary: Documentation for %{name}

%description doc
%{summary}.

%if 0%{?suse_version}
%lang_package -n %lname
%endif

%prep
%setup -q

%if 0%{?suse_version}
sed -i '10s/.*/set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ldl")/g' $(pwd)/cmake/modules/LibquentierLinkerSettings.cmake
%if 0%{?suse_version} > 1500
sed -i '5s/${QTKEYCHAIN_LIBRARIES}/Qt5Keychain::Qt5Keychain/g' $(pwd)/cmake/modules/LibquentierFindQtKeychain.cmake
%endif
%endif

%if 0%{?sle_version} >= 150400 && 0%{?is_opensuse}
sed -i '5s/${QTKEYCHAIN_LIBRARIES}/Qt5Keychain::Qt5Keychain/g' $(pwd)/cmake/modules/LibquentierFindQtKeychain.cmake
%endif

%build
%if 0%{?fedora_version}
mkdir build && cd build
%else
%define _qt5_libdir %{_libdir}
%define _qt5_docdir %{_docdir}
%endif

%if 0%{?fedora_version} >= 36
%cmake ../ -DCMAKE_INSTALL_LIBDIR=%{_qt5_libdir} \
           -DQt5_LUPDATE_EXECUTABLE=%{_bindir}/lupdate-qt5 \
           -DQt5_LRELEASE_EXECUTABLE=%{_bindir}/lrelease-qt5 \
           -DUSE_LD_GOLD=NO \
           -DLIB_QUENTIER_BUILD_INFO="OpenSUSE build service, stable. $(date --utc '+%Y-%m-%d %H:%M') UTC"
%else
%cmake ../ -DCMAKE_INSTALL_LIBDIR=%{_qt5_libdir} \
           -DQt5_LUPDATE_EXECUTABLE=%{_bindir}/lupdate-qt5 \
           -DQt5_LRELEASE_EXECUTABLE=%{_bindir}/lrelease-qt5 \
           -DLIB_QUENTIER_BUILD_INFO="OpenSUSE build service, stable. $(date --utc '+%Y-%m-%d %H:%M') UTC"
%endif

%if 0%{?sle_version} == 120300 && 0%{?is_opensuse}
make
%else
%make_build
%endif

make lupdate
make lrelease
make doc


%install
cd build
%make_install

mkdir -p %{buildroot}%{_qt5_docdir}/%{name}
cp -aR doc/html/* %{buildroot}%{_qt5_docdir}/%{name}

%post -n %{lname} -p /sbin/ldconfig
%postun -n %{lname} -p /sbin/ldconfig

%check
# For some reason xvfb-run fails to initialize GLX only on OpenSUSE Leap 42.3 so fuck it
%if 0%{?sle_version} == 120300 && 0%{?is_opensuse}
echo "Check skipped"
%else
cd build
LD_LIBRARY_PATH=$(pwd) xvfb-run %{__make} check
%endif


%files -n %{lname}
%defattr(-,root,root)
%doc CONTRIBUTING.md README.md
%license COPYING.LESSER COPYING.txt
%{_qt5_libdir}/libqt5quentier.so.*
%if 0%{?fedora_version}
%dir %{_datadir}/libquentier
%dir %{_datadir}/libquentier/translations
%{_datadir}/libquentier/translations/*.qm
%endif


%files devel
%defattr(-,root,root)
%{_includedir}/quentier
%{_qt5_libdir}/libqt5quentier.so
%{_qt5_libdir}/cmake/Libquentier-qt5/


%files doc
%defattr(-,root,root)
%doc CONTRIBUTING.md README.md
%license COPYING.LESSER COPYING.txt
%{_qt5_docdir}/%{name}


%if 0%{?suse_version}
%files -n %lname-lang
%defattr(-,root,root)
%dir %{_datadir}/libquentier
%dir %{_datadir}/libquentier/translations
%{_datadir}/libquentier/translations/*.qm
%endif


%changelog
* Sun Dec 23 2018 Dmitry Ivanov <dm.vl.ivanov@gmail.com> - 0.5.0-1
- Change the layout of note attachments local storage

* Mon Mar 12 2018 Dmitry Ivanov <dm.vl.ivanov@gmail.com> - 0.4.0-1
- Adaptation for OpenSUSE build service

* Mon Mar 05 2018 Robert-André Mauchin <zebob.m@gmail.com> - 0.4.0-0.3.20180301git4ce8e3b
- Master snapshot 4ce8e3b76bd9bedd75fe8cb398ddf2a91556b59a

* Tue Feb 27 2018 Robert-André Mauchin <zebob.m@gmail.com> - 0.4.0-0.2.20180226git5db522e
- Master snapshot 5db522e5257001f65fdcae6bc8f49956ed264623

* Fri Feb 02 2018 Robert-André Mauchin <zebob.m@gmail.com> - 0.4.0-0.1.20180130git45bb65b
- Initial RPM release.
openSUSE Build Service is sponsored by