[elbe-devel] [PATCH v2 7/9] docs: switch build over to sphinx

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Apr 9 13:11:36 CEST 2024


Instead of using asciidoc, xmlto, docbook, pandoc and sphinx reduce the
amount of tools needed.

This makes the generation simpler to adapt, allows usage of more
expressive markup and unifies the HTML docs on elbe-rfs.org and in
/usr/share/doc/elbe-doc.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 debian/control |  6 ++++--
 debian/rules   |  2 +-
 docs/Makefile  | 19 +++++++++++++++----
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/debian/control b/debian/control
index 5cb54581b485..86c815226b93 100644
--- a/debian/control
+++ b/debian/control
@@ -33,7 +33,9 @@ Build-Depends: debhelper-compat (= 12),
   python3-gpg,
   python3-libvirt,
   python3-passlib,
-  python3-pytest
+  python3-pytest,
+  python3-sphinx,
+  python3-sphinx-rtd-theme
 Standards-Version: 3.9.6
 Rules-Requires-Root: no
 Homepage: http://elbe-rfs.org
@@ -41,7 +43,7 @@ Homepage: http://elbe-rfs.org
 Package: elbe-doc
 Section: doc
 Architecture: all
-Depends: ${misc:Depends}
+Depends: ${misc:Depends} ${sphinxdoc:Depends}
 Description: man-pages, examples and documentation
  man-pages for elbe and all elbe subcommands. Some documentation and howtos.
  And examples for several targets.
diff --git a/debian/rules b/debian/rules
index 0d51b5fdcd5b..7e7cd7735d78 100755
--- a/debian/rules
+++ b/debian/rules
@@ -27,4 +27,4 @@ override_dh_install:
 	dh_installxmlcatalogs
 
 %:
-	dh $@ --buildsystem=pybuild --with bash-completion,python3
+	dh $@ --buildsystem=pybuild --with bash-completion,python3,sphinxdoc
diff --git a/docs/Makefile b/docs/Makefile
index a207b6a2b775..e65c9eb47e41 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -34,6 +34,8 @@ man1dir=$(mandir)/man1
 man5dir=$(mandir)/man5
 man7dir=$(mandir)/man7
 
+sphinxbuilddir?=_build
+
 MAN_BASE_URL = file://$(htmldir)/
 
 ASCIIDOC=asciidoc
@@ -42,6 +44,7 @@ MANPAGE_XSL = manpage-normal.xsl
 XMLTO_EXTRA =
 INSTALL?=install
 RM ?= rm -f
+CP ?= cp
 
 DOCBOOK_XSL_172=1
 
@@ -54,13 +57,21 @@ endif
 
 ASCIIDOC_DATA_URI = -a data-uri -a iconsdir=/usr/share/asciidoc/icons
 
-all: html man
+all: sphinx
 html: $(DOC_HTML)
 
 sphinx:
-	sphinx-build . _build
+	sphinx-build -b man  . $(sphinxbuilddir)/man
+	sphinx-build -b html . $(sphinxbuilddir)/html
+
+install-sphinx: sphinx
+	$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
+	$(INSTALL) -m 644 $(sphinxbuilddir)/man/* $(DESTDIR)$(man1dir)
+
+	$(INSTALL) -d -m 755 $(DESTDIR)$(htmldir)
+	$(CP) -r $(sphinxbuilddir)/html/ $(DESTDIR)$(htmldir)
 
-install: install-man install-html
+install: install-sphinx
 
 install-man: man
 	$(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
@@ -79,7 +90,7 @@ man7: $(DOC_MAN7)
 
 
 clean:
-	$(RM) -r _build
+	$(RM) -r $(sphinxbuilddir)
 	$(RM) article*.rst elbe*.rst *.xml *.xml+ *.html *.html+ *.1 *.5 *.7
 	$(RM) *.texi *.texi+ *.texi++ git.info gitman.info
 	$(RM) *.pdf

-- 
2.44.0



More information about the elbe-devel mailing list