This commit is contained in:
TI_Eugene 2021-01-07 18:07:49 +03:00
parent 2fd7c47e3b
commit 1b6695ef06
1 changed files with 82 additions and 44 deletions

View File

@ -1,72 +1,92 @@
#%%global prerelease beta1
# RHEL & Fedora <= 33
%global with_qt4 0%{?rhel} || 0%{?fedora} <= 33
# Fedora *
%global with_qt5 0%{?fedora}
Name: qpdfview
Version: 0.4.18
Release: 4%{?dist}
Release: 5%{?dist}
# Use the following format for beta
#Release: 0.1.%%{?prerelease}%%{?dist}
License: GPLv2+
Summary: Tabbed PDF Viewer
Url: https://launchpad.net/qpdfview
Source0: https://launchpad.net/qpdfview/trunk/%{version}%{?prerelease}/+download/%{name}-%{version}%{?prerelease}.tar.gz
Patch0: %{name}_model.patch
BuildRequires: desktop-file-utils
BuildRequires: file-devel
BuildRequires: cups-devel
BuildRequires: hicolor-icon-theme
BuildRequires: pkgconfig(libspectre)
BuildRequires: pkgconfig(zlib)
BuildRequires: file-devel
BuildRequires: cups-devel
BuildRequires: hicolor-icon-theme
BuildRequires: pkgconfig(libspectre)
BuildRequires: pkgconfig(zlib)
%if 0%{?fedora}
BuildRequires: pkgconfig(ddjvuapi)
# check if required for qt4
BuildRequires: pkgconfig(ddjvuapi)
%endif
# Qt4
BuildRequires: pkgconfig(poppler-qt4)
BuildRequires: pkgconfig(QtGui)
BuildRequires: pkgconfig(QtDBus)
%if 0%{?rhel}
Requires: qt-sqlite
%endif
# Build Qt5 only for Fedora
%if 0%{?fedora}
BuildRequires: qt5-qttools-devel
BuildRequires: pkgconfig(poppler-qt5)
BuildRequires: pkgconfig(Qt5DBus)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Svg)
BuildRequires: pkgconfig(Qt5Widgets)
%endif # build with Qt5 for Fedora
Requires: %{name}-common = %{version}-%{release}
%description
qpdfview is a tabbed PDF viewer.
It uses the Poppler library for rendering and CUPS for printing.
It provides a clear and simple graphical user interface using the Qt framework.
%package common
Summary: Common files for %{name}
BuildArch: noarch
Summary: Common files for %{name}
BuildArch: noarch
%description common
This package provides common files for %{name}.
%if 0%{?fedora}
%if %{with_qt4}
%package qt4
Summary: Tabbed PDF Viewer
BuildRequires: pkgconfig(poppler-qt4)
BuildRequires: pkgconfig(QtGui)
BuildRequires: pkgconfig(QtDBus)
%if 0%{?rhel}
Requires: qt-sqlite
%endif
Requires: %{name}-common = %{version}-%{release}
Obsoletes: %{name} < %{version}-%{release}
%description qt4
qpdfview is a tabbed PDF viewer.
It uses the Poppler library for rendering and CUPS for printing.
It provides a clear and simple graphical user interface using the Qt framework.
%endif
%if %{with_qt5}
%package qt5
Summary: Tabbed PDF Viewer
Requires: %{name}-common = %{version}-%{release}
Summary: Tabbed PDF Viewer
BuildRequires: qt5-qttools-devel
BuildRequires: pkgconfig(poppler-qt5)
BuildRequires: pkgconfig(Qt5DBus)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Svg)
BuildRequires: pkgconfig(Qt5Widgets)
Requires: %{name}-common = %{version}-%{release}
%if 0%{?fedora} > 33
Obsoletes: %{name} < %{version}-%{release}
%endif
%description qt5
qpdfview is a tabbed PDF viewer.
It uses the Poppler library for rendering and CUPS for printing.
It provides a clear and simple graphical user interface using the Qt framework.
%endif # with Qt5 for Fedora
%endif
%prep
%setup -qc
%patch0 -p0
%build
%if %{with_qt4}
cp -a %{name}-%{version}%{?prerelease} build-qt4
cp -a %{name}-%{version}%{?prerelease} build-qt5
pushd build-qt4
lrelease-qt4 qpdfview.pro
%{qmake_qt4} \
@ -78,8 +98,10 @@ lrelease-qt4 qpdfview.pro
qpdfview.pro
make %{?_smp_mflags}
popd
%endif
%if 0%{?fedora}
%if %{with_qt5}
cp -a %{name}-%{version}%{?prerelease} build-qt5
pushd build-qt5
lrelease-qt5 qpdfview.pro
# Some adjustments to avoid conflict with Qt4 package
@ -96,48 +118,60 @@ sed -i "s/Name=qpdfview/Name=qpdfview (Qt5)/g" miscellaneous/qpdfview-qt5.deskto
qpdfview.pro
make %{?_smp_mflags}
popd
%endif # build with Qt5 for Fedora
%endif
%install
%if %{with_qt4}
pushd build-qt4
make INSTALL_ROOT=%{buildroot} install
popd
%endif
%if 0%{?fedora}
%if %{with_qt5}
pushd build-qt5
make INSTALL_ROOT=%{buildroot} install
popd
%endif # build with Qt5 for Fedora
%endif
%find_lang %{name} --with-qt --without-mo
# Common files are equal for both Qt4 and Qt5
cd %{name}-%{version}%{?prerelease}
install -Dm 0644 icons/%{name}.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%if %{with_qt4}
desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%if 0%{?fedora}
%endif
%if %{with_qt5}
desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}-qt5.desktop
%endif # build with Qt5 for Fedora
%endif
# unknown language
rm -f %{buildroot}/%{_datadir}/%{name}/%{name}_ast.qm
%ldconfig_scriptlets
%if 0%{?fedora}
%if %{with_qt4}
%ldconfig_scriptlets
%endif
%if %{with_qt5}
# Scriptlets qt5 subpackage
%ldconfig_scriptlets qt5
%endif # build with Qt5 for Fedora
%endif
%files
%if %{with_qt4}
%files qt4
%{_bindir}/%{name}
%{_libdir}/%{name}
%{_datadir}/applications/%{name}.desktop
%endif
%if 0%{?fedora}
%if %{with_qt5}
%files qt5
%{_bindir}/%{name}-qt5
%{_libdir}/%{name}-qt5
%{_datadir}/applications/%{name}-qt5.desktop
%endif # build with Qt5 for Fedora
%endif
%files common -f %{name}.lang
%license %{name}-%{version}%{?prerelease}/COPYING
@ -149,6 +183,10 @@ rm -f %{buildroot}/%{_datadir}/%{name}/%{name}_ast.qm
%{_mandir}/man?/*
%changelog
* Wed Jan 06 2021 TI_Eugene <ti.eugene@gmail.com> - 0.4.18-5
- Move Qt4 things into qpdfview-qt4 subpackage
- Disable Qt4 version for F34
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.18-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild