From 61deb167daa13bf5bfeff954e5ce8e98fd8b6a28 Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Fri, 21 May 2021 11:57:54 -0600 Subject: [PATCH] man: Allow building HTML man pages Add a --enable-man-html configure option to build HTML man pages using a different stylesheet. The HTML pages aren't installed as I don't know what purpose they'd serve on an actual installation. --- Makefile-man.am | 25 ++++++++++++++++++++++--- configure.ac | 10 ++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Makefile-man.am b/Makefile-man.am index 78025fff..1779edc1 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -52,9 +52,23 @@ man5_files = ostree.repo.5 ostree.repo-config.5 man1_MANS = $(addprefix man/,$(man1_files)) man5_MANS = $(addprefix man/,$(man5_files)) +manhtml_files = \ + $(addprefix man/html/,$(man1_files:.1=.html)) \ + $(addprefix man/html/,$(man5_files:.5=.html)) \ + $(NULL) + +if ENABLE_MAN_HTML +noinst_DATA += $(manhtml_files) + +# Convenience target for building the just the HTML man pages +manhtml: $(manhtml_files) +.PHONY: manhtml +endif + EXTRA_DIST += $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml) -XSLT_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl +XSLT_MAN_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl +XSLT_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl XSLTPROC_FLAGS = \ --nonet \ @@ -67,14 +81,19 @@ XSLTPROC_FLAGS = \ XSLTPROC_MAN = $(XSLTPROC) $(XSLTPROC_FLAGS) %.1: %.xml - $(AM_V_GEN) $(XSLTPROC_MAN) --output $@ $(XSLT_STYLESHEET) $< + $(AM_V_GEN) $(XSLTPROC_MAN) --output $@ $(XSLT_MAN_STYLESHEET) $< %.5: %.xml - $(AM_V_GEN) $(XSLTPROC_MAN) --output $@ $(XSLT_STYLESHEET) $< + $(AM_V_GEN) $(XSLTPROC_MAN) --output $@ $(XSLT_MAN_STYLESHEET) $< + +man/html/%.html: man/%.xml + @mkdir -p man/html + $(AM_V_GEN) $(XSLTPROC_MAN) --output $@ $(XSLT_HTML_STYLESHEET) $< CLEANFILES += \ $(man1_MANS) \ $(man5_MANS) \ + $(manhtml_files) \ $(NULL) endif diff --git a/configure.ac b/configure.ac index 8ca2f451..693261ca 100644 --- a/configure.ac +++ b/configure.ac @@ -292,6 +292,16 @@ AS_IF([test "$enable_man" != no], [ ]) AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) +AC_ARG_ENABLE([man-html], + [AS_HELP_STRING([--enable-man-html], + [generate man HTML pages [default=no]])],, + enable_man_html=no) + +AS_IF([test "$enable_man_html" = yes && test "$enable_man" = no], [ + AC_MSG_ERROR([--enable-man is required for --enable-man-html]) +]) +AM_CONDITIONAL(ENABLE_MAN_HTML, test "$enable_man_html" = yes) + AC_ARG_WITH(libarchive, AS_HELP_STRING([--without-libarchive], [Do not use libarchive]), :, with_libarchive=maybe)