From b89cf86abca5cf68bcac48a7083374ad217dfc0d Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 27 Sep 2021 11:21:10 -0400 Subject: [PATCH] Package PDF docs in lieu of HTML See https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. --- cairomm.spec | 60 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/cairomm.spec b/cairomm.spec index 8b6982d..7a780b8 100644 --- a/cairomm.spec +++ b/cairomm.spec @@ -6,6 +6,13 @@ # building an autotools-generated tarball with meson, or vice versa. %bcond_without maintainer_mode +# Doxygen HTML help is not suitable for packaging due to a minified JavaScript +# bundle inserted by Doxygen itself. See discussion at +# https://bugzilla.redhat.com/show_bug.cgi?id=2006555. +# +# We can enable the Doxygen PDF documentation as a lesser substitute. +%bcond_without doc_pdf + Name: cairomm Summary: C++ API for the cairo graphics library Version: 1.14.2 @@ -50,12 +57,15 @@ BuildRequires: mm-common BuildRequires: perl-interpreter BuildRequires: perl(Getopt::Long) BuildRequires: doxygen -BuildRequires: web-assets-devel # dot BuildRequires: graphviz # xsltproc BuildRequires: libxslt BuildRequires: pkgconfig(mm-common-libstdc++) +%if %{with doc_pdf} +BuildRequires: doxygen-latex +BuildRequires: make +%endif # For tests: BuildRequires: boost-devel @@ -89,30 +99,14 @@ The API/ABI version series is %{apiver}. %package doc Summary: Documentation for cairomm -# The documentation is licensed LGPLv2, same as the base package, except that -# several files inserted by Doxygen are MIT-licensed: -# - %%{_docdir}/cairomm-%%{apiver}/reference/html/dynsections.js -# - %%{_docdir}/cairomm-%%{apiver}/reference/html/menu.js -# - %%{_docdir}/cairomm-%%{apiver}/reference/html/menudata.js -# - %%{_docdir}/cairomm-%%{apiver}/reference/html/search/search.js -License: LGPLv2 and MIT BuildArch: noarch -Requires: libstdc++-docs -Requires: libsigc++20-doc - -Requires: js-jquery -# We do not treat the Doxygen-generated JavaScript files as bundled libraries, -# but as generated helper code that may potentially vary from project to -# project based on the settings in the Doxyfile. - Provides: cairomm%{apiver}-doc = %{version}-%{release} %description doc -Documentation for cairomm can be viewed either through the devhelp -documentation browser or through a web browser at -%{_docdir}/cairomm-%{apiver}/. +Documentation for cairomm can be viewed through the devhelp documentation +browser. The API/ABI version series is %{apiver}. @@ -135,10 +129,21 @@ rm -rf "${workdir}" # sources are banned in Fedora. (Note also that the bundled JavaScript had a # different license.) We also remove the tag file, which triggers a rebuild of # the documentation. While we are at it, we might as well rebuild the devhelp -# XML too. +# XML too. Note that we will not install the HTML documentation. rm -rf untracked/docs/reference/html rm untracked/docs/reference/cairomm-%{apiver}.tag \ untracked/docs/reference/cairomm-%{apiver}.devhelp2 +%if %{with doc_pdf} +# We enable the Doxygen PDF documentation as a lesser substitute. We must +# enable GENERATE_LATEX and LATEX_BATCHMODE; the rest are precautionary and +# should already be set as we like them. +sed -r -i \ + -e "s/^([[:blank:]]*(GENERATE_LATEX|LATEX_BATCHMODE|USE_PDFLATEX|\ +PDF_HYPERLINKS)[[:blank:]]*=[[:blank:]]*)NO[[:blank:]]*/\1YES/" \ + -e "s/^([[:blank:]]*(LATEX_TIMESTAMP)\ +[[:blank:]]*=[[:blank:]]*)YES[[:blank:]]*/\1NO/" \ + docs/reference/Doxyfile.in +%endif %build @@ -151,6 +156,10 @@ rm untracked/docs/reference/cairomm-%{apiver}.tag \ -Dwarnings=max %meson_build +%if %{with doc_pdf} +%make_build -C '%{_vpath_builddir}/docs/reference/latex' +%endif + %install %meson_install @@ -160,9 +169,11 @@ install -t %{buildroot}%{_docdir}/cairomm-%{apiver} -m 0644 -p \ AUTHORS ChangeLog MAINTAINERS NEWS README cp -rp examples %{buildroot}%{_docdir}/cairomm-%{apiver}/ -# Unbundle jquery inserted by Doxygen -ln -svf '%{_jsdir}/jquery/3/jquery.js' \ - '%{buildroot}%{_docdir}/cairomm-%{apiver}/reference/html/' +rm -vrf '%{buildroot}%{_docdir}/cairomm-%{apiver}/reference/html' +%if %{with doc_pdf} +install -t '%{buildroot}%{_docdir}/cairomm-%{apiver}/reference' -p -m 0644 \ + '%{_vpath_builddir}/docs/reference/latex/refman.pdf' +%endif %check @@ -185,7 +196,8 @@ ln -svf '%{_jsdir}/jquery/3/jquery.js' \ %files doc %license COPYING -%doc %{_docdir}/cairomm-%{apiver}/ +# Note: HTML reference manual has been removed. See comment in %%install. +%doc %{_docdir}/cairomm-%{apiver} %doc %{_datadir}/devhelp/