Allow building without Qt

Building with `--without=qt` builds without Qt, and drops the -qt subpackages.
This commit is contained in:
Amit Shah 2022-06-08 12:46:30 +00:00 committed by Amit Shah
parent 34f97a4a32
commit 12a8765ec2

View File

@ -1,17 +1,21 @@
%global test_sha 03a4b9eb854a06a83c465e82de601796c458bbe9
%global test_date 2021-01-11
%bcond qt 1
# Enable qt6 support (or not)
# FIXME: qt6-qtdeclarative doesn't build on S390x
# BUG: https://bugreports.qt.io/browse/QTBUG-93101
%if %{with qt}
%ifnarch s390x
%global qt6 1
%endif
%endif
Summary: PDF rendering library
Name: poppler
Version: 22.08.0
Release: 1%{?dist}
Release: 2%{?dist}
License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT
URL: http://poppler.freedesktop.org/
Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz
@ -46,11 +50,13 @@ BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libtiff-4)
BuildRequires: pkgconfig(nss)
BuildRequires: pkgconfig(poppler-data)
%if %{with qt}
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(Qt5Xml)
%endif
%if 0%{?qt6}
BuildRequires: cmake(Qt6Core)
BuildRequires: cmake(Qt6Gui)
@ -98,6 +104,7 @@ BuildArch: noarch
%description glib-doc
%{summary}.
%if %{with qt}
%package qt5
Summary: Qt5 wrapper for poppler
Requires: %{name}%{?_isa} = %{version}-%{release}
@ -113,6 +120,7 @@ Requires: qt5-qtbase-devel
Obsoletes: %{name}-qt-devel < 0.90.0-9
%description qt5-devel
%{summary}.
%endif
%if 0%{?qt6}
%package qt6
@ -163,6 +171,12 @@ chmod -x poppler/CairoFontEngine.cc
-DENABLE_DCTDECODER=libjpeg \
-DENABLE_GTK_DOC=ON \
-DENABLE_LIBOPENJPEG=openjpeg2 \
%if ! %{with qt}
-DENABLE_QT5=OFF \
%endif
%if ! 0%{?qt6}
-DENABLE_QT6=OFF \
%endif
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON \
-DENABLE_ZLIB=OFF \
..
@ -179,7 +193,9 @@ export PKG_CONFIG_PATH=%{buildroot}%{_datadir}/pkgconfig:%{buildroot}%{_libdir}/
test "$(pkg-config --modversion poppler)" = "%{version}"
test "$(pkg-config --modversion poppler-cpp)" = "%{version}"
test "$(pkg-config --modversion poppler-glib)" = "%{version}"
%if %{with qt}
test "$(pkg-config --modversion poppler-qt5)" = "%{version}"
%endif
%if 0%{?qt6}
test "$(pkg-config --modversion poppler-qt6)" = "%{version}"
%endif
@ -188,7 +204,9 @@ test "$(pkg-config --modversion poppler-qt6)" = "%{version}"
%ldconfig_scriptlets glib
%if %{with qt}
%ldconfig_scriptlets qt5
%endif
%if 0%{?qt6}
%ldconfig_scriptlets qt6
@ -225,6 +243,7 @@ test "$(pkg-config --modversion poppler-qt6)" = "%{version}"
%license COPYING
%{_datadir}/gtk-doc/
%if %{with qt}
%files qt5
%{_libdir}/libpoppler-qt5.so.1*
@ -232,6 +251,7 @@ test "$(pkg-config --modversion poppler-qt6)" = "%{version}"
%{_libdir}/libpoppler-qt5.so
%{_libdir}/pkgconfig/poppler-qt5.pc
%{_includedir}/poppler/qt5/
%endif
%if 0%{?qt6}
%files qt6
@ -256,6 +276,9 @@ test "$(pkg-config --modversion poppler-qt6)" = "%{version}"
%{_mandir}/man1/*
%changelog
* Tue Sep 6 2022 Amit Shah <amitshah@fedoraproject.org> - 22.08.0-2
- Allow building without Qt
* Tue Aug 2 2022 Marek Kasik <mkasik@redhat.com> - 22.08.0-1
- Update to 22.08.0
- Resolves: #2049336