+#
+# Conditional build:
+%bcond_without qt4 # Qt4 interface
+%bcond_without qt5 # Qt5 interface
+# "telepathy_qt" name is occupied by earlier work under the same name from different project;
+# thus spec and repo stick to original "telepathy-qt4" name of this project (used before 0.9.0 release)
%define orgname telepathy-qt
-%define qt_ver 4.8.2
+%define qt4_ver 4.8.2
+%define qt5_ver 5.0.0
Summary: Library for Qt4-based Telepathy clients
Summary(pl.UTF-8): Biblioteka dla klientów Telepathy opartych na Qt4
Name: telepathy-qt4
-Version: 0.9.3
-Release: 4
-License: LGPL v2.1
-Group: X11/Applications
+Version: 0.9.4
+Release: 1
+License: LGPL v2.1+
+Group: Libraries
Source0: http://telepathy.freedesktop.org/releases/telepathy-qt/%{orgname}-%{version}.tar.gz
-# Source0-md5: 94ac93aedf5f6fff49837bc8368e5a37
+# Source0-md5: 75b18e151b1c4fab9f149d0eb46a494d
Patch0: %{name}-build.patch
URL: http://telepathy.freedesktop.org/wiki/Telepathy-Qt4
-BuildRequires: QtCore-devel >= %{qt_ver}
-BuildRequires: QtDBus-devel >= %{qt_ver}
-BuildRequires: QtGui-devel >= %{qt_ver}
-BuildRequires: QtNetwork-devel >= %{qt_ver}
-BuildRequires: QtXml-devel >= %{qt_ver}
-BuildRequires: QtTest-devel >= %{qt_ver}
BuildRequires: cmake >= 2.6
BuildRequires: dbus-devel
BuildRequires: dbus-glib-devel
BuildRequires: python-devel >= 1:2.5
BuildRequires: python-modules >= 1:2.5
BuildRequires: python-pygobject
-BuildRequires: qt4-build >= %{qt_ver}
-BuildRequires: qt4-qmake >= %{qt_ver}
BuildRequires: rpmbuild(macros) >= 1.293
BuildRequires: telepathy-farstream-devel >= 0.2.2
-BuildRequires: telepathy-glib-devel >= 0.19.5
-Requires: QtCore >= %{qt_ver}
-Requires: QtDBus >= %{qt_ver}
-Requires: QtNetwork >= %{qt_ver}
-Requires: QtXml >= %{qt_ver}
+BuildRequires: telepathy-glib-devel >= 0.18.0
+%if %{with qt4}
+BuildRequires: QtCore-devel >= %{qt4_ver}
+BuildRequires: QtDBus-devel >= %{qt4_ver}
+BuildRequires: QtGui-devel >= %{qt4_ver}
+BuildRequires: QtHelp >= %{qt4_ver}
+BuildRequires: QtNetwork-devel >= %{qt4_ver}
+BuildRequires: QtXml-devel >= %{qt4_ver}
+BuildRequires: QtTest-devel >= %{qt4_ver}
+BuildRequires: qt4-build >= %{qt4_ver}
+BuildRequires: qt4-qmake >= %{qt4_ver}
+%endif
+%if %{with qt5}
+BuildRequires: Qt5Core-devel >= %{qt5_ver}
+BuildRequires: Qt5DBus-devel >= %{qt5_ver}
+BuildRequires: Qt5Gui-devel >= %{qt5_ver}
+BuildRequires: Qt5Network-devel >= %{qt5_ver}
+BuildRequires: Qt5Test-devel >= %{qt5_ver}
+BuildRequires: Qt5Widgets-devel >= %{qt5_ver}
+BuildRequires: Qt5Xml-devel >= %{qt5_ver}
+BuildRequires: qt5-assistant >= %{qt5_ver}
+BuildRequires: qt5-build >= %{qt5_ver}
+BuildRequires: qt5-qmake >= %{qt5_ver}
+%endif
+Requires: QtCore >= %{qt4_ver}
+Requires: QtDBus >= %{qt4_ver}
+Requires: QtNetwork >= %{qt4_ver}
+Requires: QtXml >= %{qt4_ver}
Requires: telepathy-farstream >= 0.2.2
-Requires: telepathy-glib >= 0.19.5
+Requires: telepathy-glib >= 0.18.0
Obsoletes: telepathy-qt4-yell
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
Summary(pl.UTF-8): Pliki nagłówkowe biblioteki telepathy-qt4
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
-Requires: QtCore-devel >= %{qt_ver}
-Requires: QtDBus-devel >= %{qt_ver}
+Requires: QtCore-devel >= %{qt4_ver}
+Requires: QtDBus-devel >= %{qt4_ver}
+Requires: QtNetwork-devel >= %{qt4_ver}
+Requires: QtXml-devel >= %{qt4_ver}
Obsoletes: telepathy-qt4-yell-devel
%description devel
Header files for telepathy-qt4 library.
%description devel -l pl.UTF-8
-Pliki nagłówkowe biblioteki telepathy-qt4
+Pliki nagłówkowe biblioteki telepathy-qt4.
+
+%package apidocs
+Summary: API documentation for telepathy-qt4 and telepathy-qt5 libraries
+Summary(pl.UTF-8): Dokumentacja API bibliotek telepathy-qt5 i telepathy-qt5
+Group: Documentation
+
+%description apidocs
+API documentation for telepathy-qt4 and telepathy-qt5 libraries.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API bibliotek telepathy-qt5 i telepathy-qt5.
+
+%package -n telepathy-qt5
+Summary: Library for Qt5-based Telepathy clients
+Summary(pl.UTF-8): Biblioteka dla klientów Telepathy opartych na Qt5
+Group: Libraries
+Requires: Qt5Core >= %{qt5_ver}
+Requires: Qt5DBus >= %{qt5_ver}
+Requires: Qt5Network >= %{qt5_ver}
+Requires: Qt5Xml >= %{qt5_ver}
+Requires: telepathy-farstream >= 0.2.2
+Requires: telepathy-glib >= 0.18.0
+
+%description -n telepathy-qt5
+Library for Qt5-based Telepathy clients.
+
+%description -n telepathy-qt5 -l pl.UTF-8
+Biblioteka dla klientów Telepathy opartych na Qt5.
+
+%package -n telepathy-qt5-devel
+Summary: Header files for telepathy-qt5 library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki telepathy-qt5
+Group: Development/Libraries
+Requires: telepathy-qt5 = %{version}-%{release}
+Requires: Qt5Core-devel >= %{qt5_ver}
+Requires: Qt5DBus-devel >= %{qt5_ver}
+
+%description -n telepathy-qt5-devel
+Header files for telepathy-qt5 library.
+
+%description -n telepathy-qt5-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki telepathy-qt5.
%prep
%setup -q -n %{orgname}-%{version}
%patch0 -p1
%build
-install -d build
-cd build
-%cmake \
+%if %{with qt4}
+install -d build-qt4
+cd build-qt4
+%cmake .. \
+ -DENABLE_FARSTREAM:BOOL=ON \
+ -DQT_QMAKE_EXECUTABLE_FINDQT=%{_libdir}/qt4/bin/qmake
+
+%{__make}
+cd ..
+%endif
+
+%if %{with qt5}
+install -d build-qt5
+cd build-qt5
+%cmake .. \
-DENABLE_FARSTREAM:BOOL=ON \
- -DENABLE_FARSIGHT:BOOL=OFF \
- -DQT_QMAKE_EXECUTABLE_FINDQT=%{_libdir}/qt4/bin/qmake \
- ../
+ -DQT_QMAKE_EXECUTABLE_FINDQT=%{_libdir}/qt5/bin/qmake
%{__make}
+cd ..
+%endif
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} -C build install \
+%if %{with qt4}
+%{__make} -C build-qt4 install \
DESTDIR=$RPM_BUILD_ROOT
+%endif
+
+%if %{with qt5}
+%{__make} -C build-qt5 install \
+ DESTDIR=$RPM_BUILD_ROOT
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
+%post -n telepathy-qt5 -p /sbin/ldconfig
+%postun -n telepathy-qt5 -p /sbin/ldconfig
+
+%if %{with qt4}
%files
%defattr(644,root,root,755)
%doc AUTHORS ChangeLog NEWS README
%{_includedir}/telepathy-qt4
%{_pkgconfigdir}/TelepathyQt4.pc
%{_pkgconfigdir}/TelepathyQt4Farstream.pc
+%endif
+
+%files apidocs
+%defattr(644,root,root,755)
+%doc doc/html/*
+
+%if %{with qt5}
+%files -n telepathy-qt5
+%defattr(644,root,root,755)
+%doc AUTHORS ChangeLog NEWS README
+%attr(755,root,root) %{_libdir}/libtelepathy-qt5.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libtelepathy-qt5.so.0
+%attr(755,root,root) %{_libdir}/libtelepathy-qt5-farstream.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libtelepathy-qt5-farstream.so.0
+
+%files -n telepathy-qt5-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libtelepathy-qt5.so
+%attr(755,root,root) %{_libdir}/libtelepathy-qt5-farstream.so
+%{_libdir}/cmake/TelepathyQt5
+%{_libdir}/cmake/TelepathyQt5Farstream
+%{_includedir}/telepathy-qt5
+%{_pkgconfigdir}/TelepathyQt5.pc
+%{_pkgconfigdir}/TelepathyQt5Farstream.pc
+%endif