From e39b16e692e1cefac20be1e2d4721a1b6071be4e Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 7 Oct 2021 00:25:09 -0400 Subject: [PATCH] Build Doxygen PDF documentation --- libfakekey.spec | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/libfakekey.spec b/libfakekey.spec index 54722cf..e949c4b 100644 --- a/libfakekey.spec +++ b/libfakekey.spec @@ -1,3 +1,10 @@ +# 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: libfakekey Version: 0.3 %global so_version 0 @@ -18,6 +25,11 @@ BuildRequires: libtool BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(xtst) +%if %{with doc_pdf} +BuildRequires: doxygen +BuildRequires: doxygen-latex +%endif + %description libfakekey is a simple library for converting UTF-8 characters into 'fake' X key-presses. @@ -34,17 +46,44 @@ The libfakekey-devel package contains libraries and header files for developing applications that use libfakekey. +%if %{with doc_pdf} +%package doc +Summary: Documentation for the libfakekey library + +BuildArch: noarch + +%description doc +Documentation for the libfakekey library. +%endif + + %prep %autosetup +%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. 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.in +%endif + %build # The tarball generated from the git tag has no configure script, so this is # mandatory. See autogen.sh (which, however, we do not use because we need to # use the %%configure macro). autoreconf -f -i -v -%configure --disable-static +%configure --disable-static %{?with_doc_pdf:--enable-doxygen-docs} %make_build +%if %{with doc_pdf} +%make_build -C doc/latex +%endif %install @@ -67,5 +106,12 @@ rm -vf '%{buildroot}%{_libdir}/libfakekey.la' %{_libdir}/pkgconfig/libfakekey.pc +%if %{with doc_pdf} +%files doc +%license COPYING +%doc doc/latex/refman.pdf +%endif + + %changelog %autochangelog