diff mbox series

[kmod,03/20] man: build the scdoc based man pages

Message ID 20240611-man-v1-3-bd6864d49639@gmail.com (mailing list archive)
State Handled Elsewhere
Headers show
Series man: convert to scdoc and minor improvements | expand

Commit Message

Emil Velikov via B4 Relay June 11, 2024, 3:05 p.m. UTC
From: Emil Velikov <emil.l.velikov@gmail.com>

Note that scdoc does not handle natively handle the dummy
modules.dep.bin.5 entry, so we need to create one manually.

Not a big deal, since it's single static line anyway.

Also: pkg-config --variable=scdoc scdoc, produces the full executable
and path, although for now we stick with the AC_PATH_PROG approach.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 configure.ac          |  2 +-
 man/Makefile.am       | 24 ++++++++----------------
 man/modules.dep.bin.5 |  1 +
 3 files changed, 10 insertions(+), 17 deletions(-)

Comments

Lucas De Marchi June 29, 2024, 6:04 p.m. UTC | #1
On Tue, Jun 11, 2024 at 04:05:03PM GMT, Emil Velikov via B4 Relay wrote:
>From: Emil Velikov <emil.l.velikov@gmail.com>
>
>Note that scdoc does not handle natively handle the dummy
>modules.dep.bin.5 entry, so we need to create one manually.
>
>Not a big deal, since it's single static line anyway.
>
>Also: pkg-config --variable=scdoc scdoc, produces the full executable
>and path, although for now we stick with the AC_PATH_PROG approach.
>
>Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
>---
> configure.ac          |  2 +-
> man/Makefile.am       | 24 ++++++++----------------
> man/modules.dep.bin.5 |  1 +
> 3 files changed, 10 insertions(+), 17 deletions(-)
>
>diff --git a/configure.ac b/configure.ac
>index 9527aa2..dcf7479 100644
>--- a/configure.ac
>+++ b/configure.ac
>@@ -32,7 +32,7 @@ AC_PROG_SED
> AC_PROG_MKDIR_P
> AC_PROG_LN_S
> PKG_PROG_PKG_CONFIG
>-AC_PATH_PROG([XSLTPROC], [xsltproc])
>+AC_PATH_PROG([SCDOC], [scdoc])

we should fail it if scdoc is not found and --disable-manpages
is not passed. Right now, it just proceeds without failing,
and create bogus manpages:

$ scdoc
bash: scdoc: command not found
$ make
...
Making all in man
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/depmod.d.5.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/depmod.d.5.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > depmod.d.5
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/modprobe.d.5.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/modprobe.d.5.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > modprobe.d.5
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/modules.dep.5.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/modules.dep.5.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > modules.dep.5
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/kmod.8.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/kmod.8.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > kmod.8
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/depmod.8.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/depmod.8.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > depmod.8
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/insmod.8.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/insmod.8.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > insmod.8
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/lsmod.8.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/lsmod.8.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > lsmod.8
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/rmmod.8.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/rmmod.8.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > rmmod.8
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/modprobe.8.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/modprobe.8.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > modprobe.8
if [ '/usr/lib' != '/lib' ] ; then sed -e 's|@DISTCONFDIR@|/usr/lib|g' ../../man/modinfo.8.scd ; else sed -e '/@DISTCONFDIR@/d' ../../man/modinfo.8.scd ; fi | sed -e 's|@MODULE_DIRECTORY@|/lib/modules|g' |  > modinfo.8
$ cat man/modprobe.8
$


>
> AC_PROG_CC_C99
>
>diff --git a/man/Makefile.am b/man/Makefile.am
>index d62ff21..0285fdd 100644
>--- a/man/Makefile.am
>+++ b/man/Makefile.am
>@@ -2,37 +2,29 @@ MAN5 = depmod.d.5 modprobe.d.5 modules.dep.5
> MAN8 = kmod.8 depmod.8 insmod.8 lsmod.8 rmmod.8 modprobe.8 modinfo.8
> MAN_STUB = modules.dep.bin.5
>
>-AM_V_XSLT = $(AM_V_XSLT_$(V))
>-AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
>-AM_V_XSLT_0 = @echo "  XSLT    " $@;
>-
>-XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc)
>+AM_V_SCDOC = $(AM_V_SCDOC_$(V))
>+AM_V_SCDOC_ = $(AM_V_SCDOR_$(AM_DEFAULT_VERBOSITY))

			   ^ typo here,

so quieting the command doesn't work. Once fixed I get:

Making all in man
   SCDOC     modprobe.d.5
   SCDOC     depmod.d.5
   SCDOC     modules.dep.5
   SCDOC     kmod.8
   SCDOC     depmod.8
   SCDOC     insmod.8
   SCDOC     lsmod.8
   SCDOC     rmmod.8
   SCDOC     modprobe.8
   SCDOC     modinfo.8


thanks
Lucas De Marchi

>+AM_V_SCDOC_0 = @echo "  SCDOC    " $@;
>
> if BUILD_TOOLS
> dist_man_MANS = $(MAN5) $(MAN8) $(MAN_STUB)
>-modules.dep.bin.5: modules.dep.5
> endif
>
>-EXTRA_DIST = $(MAN5:%.5=%.5.xml) $(MAN8:%.8=%.8.xml)
>+EXTRA_DIST = $(MAN5:%.5=%.5.scd) $(MAN8:%.8=%.8.scd)
> CLEANFILES = $(dist_man_MANS)
>
> define generate_manpage
>-	$(AM_V_XSLT)if [ '$(distconfdir)' != '/lib' ] ; then \
>+	$(AM_V_SCDOC)if [ '$(distconfdir)' != '/lib' ] ; then \
> 		sed -e 's|@DISTCONFDIR@|$(distconfdir)|g' $< ; \
> 	else \
> 		sed -e '/@DISTCONFDIR@/d' $< ; \
> 	fi | \
> 	sed -e 's|@MODULE_DIRECTORY@|$(module_directory)|g' | \
>-	$(XSLT) \
>-		-o $@ \
>-		--nonet \
>-		--stringparam man.output.quietly 1 \
>-		--param funcsynopsis.style "'ansi'" \
>-		http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl -
>+	$(SCDOC) > $@
> endef
>
>-%.5: %.5.xml
>+%.5: %.5.scd
> 	$(generate_manpage)
>
>-%.8: %.8.xml
>+%.8: %.8.scd
> 	$(generate_manpage)
>diff --git a/man/modules.dep.bin.5 b/man/modules.dep.bin.5
>new file mode 100644
>index 0000000..795636b
>--- /dev/null
>+++ b/man/modules.dep.bin.5
>@@ -0,0 +1 @@
>+.so modules.dep.5
>
>-- 
>2.45.0
>
>
Lucas De Marchi July 3, 2024, 10:05 p.m. UTC | #2
On Sat, Jun 29, 2024 at 01:04:52PM GMT, Lucas De Marchi wrote:
>On Tue, Jun 11, 2024 at 04:05:03PM GMT, Emil Velikov via B4 Relay wrote:
>>From: Emil Velikov <emil.l.velikov@gmail.com>
>>
>>Note that scdoc does not handle natively handle the dummy
>>modules.dep.bin.5 entry, so we need to create one manually.
>>
>>Not a big deal, since it's single static line anyway.
>>
>>Also: pkg-config --variable=scdoc scdoc, produces the full executable
>>and path, although for now we stick with the AC_PATH_PROG approach.
>>
>>Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
>>---
>>configure.ac          |  2 +-
>>man/Makefile.am       | 24 ++++++++----------------
>>man/modules.dep.bin.5 |  1 +
>>3 files changed, 10 insertions(+), 17 deletions(-)
>>
>>diff --git a/configure.ac b/configure.ac
>>index 9527aa2..dcf7479 100644
>>--- a/configure.ac
>>+++ b/configure.ac
>>@@ -32,7 +32,7 @@ AC_PROG_SED
>>AC_PROG_MKDIR_P
>>AC_PROG_LN_S
>>PKG_PROG_PKG_CONFIG
>>-AC_PATH_PROG([XSLTPROC], [xsltproc])
>>+AC_PATH_PROG([SCDOC], [scdoc])
>
>we should fail it if scdoc is not found and --disable-manpages

I added a patch on top to make it a required tool

>>+AM_V_SCDOC_ = $(AM_V_SCDOR_$(AM_DEFAULT_VERBOSITY))
>
>			   ^ typo here,

and squashed this fix in your patch.

Applied patches 2, 3 and 4 for now.

Lucas De Marchi
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 9527aa2..dcf7479 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@  AC_PROG_SED
 AC_PROG_MKDIR_P
 AC_PROG_LN_S
 PKG_PROG_PKG_CONFIG
-AC_PATH_PROG([XSLTPROC], [xsltproc])
+AC_PATH_PROG([SCDOC], [scdoc])
 
 AC_PROG_CC_C99
 
diff --git a/man/Makefile.am b/man/Makefile.am
index d62ff21..0285fdd 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -2,37 +2,29 @@  MAN5 = depmod.d.5 modprobe.d.5 modules.dep.5
 MAN8 = kmod.8 depmod.8 insmod.8 lsmod.8 rmmod.8 modprobe.8 modinfo.8
 MAN_STUB = modules.dep.bin.5
 
-AM_V_XSLT = $(AM_V_XSLT_$(V))
-AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
-AM_V_XSLT_0 = @echo "  XSLT    " $@;
-
-XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc)
+AM_V_SCDOC = $(AM_V_SCDOC_$(V))
+AM_V_SCDOC_ = $(AM_V_SCDOR_$(AM_DEFAULT_VERBOSITY))
+AM_V_SCDOC_0 = @echo "  SCDOC    " $@;
 
 if BUILD_TOOLS
 dist_man_MANS = $(MAN5) $(MAN8) $(MAN_STUB)
-modules.dep.bin.5: modules.dep.5
 endif
 
-EXTRA_DIST = $(MAN5:%.5=%.5.xml) $(MAN8:%.8=%.8.xml)
+EXTRA_DIST = $(MAN5:%.5=%.5.scd) $(MAN8:%.8=%.8.scd)
 CLEANFILES = $(dist_man_MANS)
 
 define generate_manpage
-	$(AM_V_XSLT)if [ '$(distconfdir)' != '/lib' ] ; then \
+	$(AM_V_SCDOC)if [ '$(distconfdir)' != '/lib' ] ; then \
 		sed -e 's|@DISTCONFDIR@|$(distconfdir)|g' $< ; \
 	else \
 		sed -e '/@DISTCONFDIR@/d' $< ; \
 	fi | \
 	sed -e 's|@MODULE_DIRECTORY@|$(module_directory)|g' | \
-	$(XSLT) \
-		-o $@ \
-		--nonet \
-		--stringparam man.output.quietly 1 \
-		--param funcsynopsis.style "'ansi'" \
-		http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl -
+	$(SCDOC) > $@
 endef
 
-%.5: %.5.xml
+%.5: %.5.scd
 	$(generate_manpage)
 
-%.8: %.8.xml
+%.8: %.8.scd
 	$(generate_manpage)
diff --git a/man/modules.dep.bin.5 b/man/modules.dep.bin.5
new file mode 100644
index 0000000..795636b
--- /dev/null
+++ b/man/modules.dep.bin.5
@@ -0,0 +1 @@ 
+.so modules.dep.5