Skip to contentSkip to conversation

trace-cmd libtracecmd: Fix the man page building and installing

PATCH New Steven Rostedt 1 participant 1 message Apr 10, 2021 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd libtracecmd: Fix the man page building and installing

From: "Steven Rostedt (VMware)" <[email protected]>

When trying to do a make install_doc, the make hung due to the hacky way of searching for the docbook.xsl on the system. As libtracecmd (and libtracefs and libtraceevent) have a better way of creating and installing the documentation, update the trace-cmd documentation to do the same. In the mean time, also consolidate some of the build of the libtracecmd with trace-cmd man pages.

Also fixed some leftover references to libtracefs.

---
 Documentation/Makefile                        |  92 +++++++++++-
 Documentation/{libtracecmd => }/asciidoc.conf |   0
 Documentation/libtracecmd/Makefile            |  92 +-----------
 .../{libtracecmd => }/manpage-1.72.xsl        |   0
 .../{libtracecmd => }/manpage-base.xsl        |   0
 .../manpage-bold-literal.xsl                  |   0
 .../{libtracecmd => }/manpage-normal.xsl      |   0
 .../{libtracecmd => }/manpage-suppress-sp.xsl |   0
 Documentation/trace-cmd/Makefile              | 142 ++++++++++++++----
 scripts/utils.mk                              |  22 +--
 10 files changed, 215 insertions(+), 133 deletions(-)
 rename Documentation/{libtracecmd => }/asciidoc.conf (100%)
 rename Documentation/{libtracecmd => }/manpage-1.72.xsl (100%)
 rename Documentation/{libtracecmd => }/manpage-base.xsl (100%)
 rename Documentation/{libtracecmd => }/manpage-bold-literal.xsl (100%)
 rename Documentation/{libtracecmd => }/manpage-normal.xsl (100%)
 rename Documentation/{libtracecmd => }/manpage-suppress-sp.xsl (100%)
Documentation/Makefile +84 -8
index 8e979ece..ec364916 100644
@@ -1,21 +1,97 @@
 # SPDX-License-Identifier: GPL-2.0
 
-# Most likely a docbook.xsl is already installed on the users system
-# instead of creating a new wheel, lets reuse what's already there.
-#
-FIND_MANPAGE_DOCBOOK_XSL :=  $(shell find /usr -name docbook.xsl 2>/dev/null | grep manpages | head -1)
-
-MANPAGE_DOCBOOK_XSL ?= ${FIND_MANPAGE_DOCBOOK_XSL}
-
 doc_dir:=$(src)/Documentation
 
-export MANPAGE_DOCBOOK_XSL doc_dir
+export doc_dir
 
 SUBDIR += trace-cmd
 SUBDIR += libtracecmd
 
 .PHONY: $(SUBDIR)
 
+DOCDIR = $(src)/Documentation
+ASCIIDOC=asciidoc
+ASCIIDOC_CONF	 =  $(DOCDIR)/asciidoc.conf
+ASCIIDOC_EXTRA = --unsafe -f $(ASCIIDOC_CONF)
+ASCIIDOC_HTML = xhtml11
+MANPAGE_XSL = $(DOCDIR)/manpage-normal.xsl
+XMLTO_EXTRA =
+INSTALL?=install
+RM ?= rm -f
+
+ASCIIDOC_INSTALLED := $(shell command -v $(ASCIIDOC) 2> /dev/null)
+ifndef ASCIIDOC_INSTALLED
+	missing_tools += $(ASCIIDOC)
+endif
+
+XMLTO=xmlto
+XMLTO_INSTALLED := $(shell command -v $(XMLTO) 2> /dev/null)
+ifndef XMLTO_INSTALLED
+	missing_tools += $(XMLTO)
+endif
+
+#
+# For asciidoc ...
+#	-7.1.2,	no extra settings are needed.
+#	8.0-,	set ASCIIDOC8.
+#
+
+#
+# For docbook-xsl ...
+#	-1.68.1,	set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
+#	1.69.0,		no extra settings are needed?
+#	1.69.1-1.71.0,	set DOCBOOK_SUPPRESS_SP?
+#	1.71.1,		no extra settings are needed?
+#	1.72.0,		set DOCBOOK_XSL_172.
+#	1.73.0-,	set ASCIIDOC_NO_ROFF
+#
+
+#
+# If you had been using DOCBOOK_XSL_172 in an attempt to get rid
+# of 'the ".ft C" problem' in your generated manpages, and you
+# instead ended up with weird characters around callouts, try
+# using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
+#
+
+ifdef ASCIIDOC8
+ASCIIDOC_EXTRA += -a asciidoc7compatible
+endif
+ifdef DOCBOOK_XSL_172
+ASCIIDOC_EXTRA += -a libtracecmd-asciidoc-no-roff
+MANPAGE_XSL = $(DOCDIR)/manpage-1.72.xsl
+else
+	ifdef ASCIIDOC_NO_ROFF
+	# docbook-xsl after 1.72 needs the regular XSL, but will not
+	# pass-thru raw roff codes from asciidoc.conf, so turn them off.
+	ASCIIDOC_EXTRA += -a libtracecmd-asciidoc-no-roff
+	endif
+endif
+ifdef MAN_BOLD_LITERAL
+XMLTO_EXTRA += -m $(DOCDIR)/manpage-bold-literal.xsl
+endif
+ifdef DOCBOOK_SUPPRESS_SP
+XMLTO_EXTRA += -m $(DOCDIR)/manpage-suppress-sp.xsl
+endif
+
+ifdef USE_ASCIIDOCTOR
+ASCIIDOC = asciidoctor
+ASCIIDOC_EXTRA = -a compat-mode
+ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
+ASCIIDOC_HTML = xhtml5
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),w),w)
+PRINT_DIR = --no-print-directory
+else # "make -w"
+NO_SUBDIR = :
+endif
+
+export ASCIIDOC ASCIIDOC_CONF ASCIIDOC_EXTRA ASCIIDOC_HTML
+export MANPAGE_XSL
+export XMLTO XMLTO_INSTALLED XMLTO_EXTRA
+export  missing_tools
+export RM
+
 all: $(SUBDIR)
 clean: $(SUBDIR)
 install: $(SUBDIR)
Documentation/asciidoc.conf renamed from Documentation/libtracecmd/asciidoc.conf +0 -0
similarity index 100%
rename from Documentation/libtracecmd/asciidoc.conf
rename to Documentation/asciidoc.conf
Documentation/libtracecmd/Makefile +4 -88

121 lines not on this page · raw message

Documentation/manpage-1.72.xsl renamed from Documentation/libtracecmd/manpage-1.72.xsl +0 -0
similarity index 100%
rename from Documentation/libtracecmd/manpage-1.72.xsl
rename to Documentation/manpage-1.72.xsl
Documentation/manpage-base.xsl renamed from Documentation/libtracecmd/manpage-base.xsl +0 -0
similarity index 100%
rename from Documentation/libtracecmd/manpage-base.xsl
rename to Documentation/manpage-base.xsl
Documentation/manpage-bold-literal.xsl renamed from Documentation/libtracecmd/manpage-bold-literal.xsl +0 -0
similarity index 100%
rename from Documentation/libtracecmd/manpage-bold-literal.xsl
rename to Documentation/manpage-bold-literal.xsl
Documentation/manpage-normal.xsl renamed from Documentation/libtracecmd/manpage-normal.xsl +0 -0
similarity index 100%
rename from Documentation/libtracecmd/manpage-normal.xsl
rename to Documentation/manpage-normal.xsl
Documentation/manpage-suppress-sp.xsl renamed from Documentation/libtracecmd/manpage-suppress-sp.xsl +0 -0
similarity index 100%
rename from Documentation/libtracecmd/manpage-suppress-sp.xsl
rename to Documentation/manpage-suppress-sp.xsl
Documentation/trace-cmd/Makefile +115 -27

157 lines not on this page · raw message

scripts/utils.mk +12 -10
index ae8c9e77..237b2fc9 100644
@@ -172,16 +172,6 @@ define do_make_pkgconfig_file
 	sed -i "s|HEADER_DIR|$(includedir)/trace-cmd|g" ${PKG_CONFIG_FILE};
 endef
 
-define manpage.xsl
-	if [ -z ${MANPAGE_DOCBOOK_XSL} ]; then 			\
-		echo "*********************************";	\
-		echo "** No docbook.xsl is installed **";	\
-		echo "** Can't make man pages        **";	\
-		echo "*********************************";	\
-		exit 1;						\
-	fi
-endef
-
 do_asciidoc_build =				\
 	($(print_asciidoc)			\
 	 asciidoc -d manpage -b docbook -o $@ $<)
@@ -205,3 +195,15 @@ define do_install_docs
 	fi;						\
 	$(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2'
 endef
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifneq ($(V),1)
+	QUIET_ASCIIDOC	= @echo '  ASCIIDOC  '$@;
+	QUIET_XMLTO	= @echo '  XMLTO    '$@;
+	QUIET_SUBDIR0	= +@subdir=
+	QUIET_SUBDIR1	= ;$(NO_SUBDIR) \
+			   echo '  SUBDIR   ' $$subdir; \
+			  $(MAKE) $(PRINT_DIR) -C $$subdir
+	export V
+endif
+endif
Signature · 1 line
2.29.2