From a02d459c968c4631ea62141ea166b63f691adc08 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Dec 04 2023 21:55:52 +0000 Subject: Build docs as PDF instead of HTML --- diff --git a/highfive.spec b/highfive.spec index cafe815..96cc01c 100644 --- a/highfive.spec +++ b/highfive.spec @@ -38,6 +38,11 @@ Known flaws: - The support of fixed length strings isn’t ideal.} %bcond tests 1 +# 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 substitute. %bcond docs 1 # Header only, so no debuginfo is generated @@ -77,6 +82,8 @@ BuildRequires: xtensor-static %if %{with docs} BuildRequires: doxygen +BuildRequires: doxygen-latex +BuildRequires: make %endif %description %_description @@ -107,6 +114,19 @@ Documentation for %{name} %prep %autosetup -n %{pretty_name}-%{version} +%if %{with docs} +# We enable the Doxygen PDF documentation as a substitute. We must enable +# GENERATE_LATEX and LATEX_BATCHMODE; the rest are precautionary and should +# already be set as we like them. We also disable GENERATE_HTML, since we will +# not use it. +sed -r -i \ + -e "s/^([[:blank:]]*(GENERATE_LATEX|LATEX_BATCHMODE|USE_PDFLATEX|\ +PDF_HYPERLINKS)[[:blank:]]*=[[:blank:]]*)NO[[:blank:]]*/\1YES/" \ + -e "s/^([[:blank:]]*(LATEX_TIMESTAMP|GENERATE_HTML)\ +[[:blank:]]*=[[:blank:]]*)YES[[:blank:]]*/\1NO/" \ + doc/Doxyfile +%endif + %build # With g++13, warnings are generated from xtl side, e.g. @@ -135,6 +155,9 @@ CXXFLAGS="${CXXFLAGS} -Wno-deprecated-declarations" %cmake_build %if %{with docs} %cmake_build --target doc +%make_build -C %{_vpath_builddir}/doc/latex +mv %{_vpath_builddir}/doc/latex/refman.pdf \ + %{_vpath_builddir}/doc/latex/%{pretty_name}.pdf %endif @@ -164,7 +187,7 @@ mv -v '%{buildroot}/%{_datadir}/%{pretty_name}/CMake' \ %if %{with docs} %files doc %license LICENSE -%doc %{_vpath_builddir}/doc/html +%doc %{_vpath_builddir}/doc/latex/%{pretty_name}.pdf %endif