linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Vincent Fazio <vfazio@xes-inc.com>,
	Kent Gibson <warthog618@gmail.com>,
	 Linus Walleij <linus.walleij@linaro.org>,
	 Erik Schilling <erik.schilling@linaro.org>,
	 Phil Howard <phil@gadgetoid.com>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	 linux-gpio@vger.kernel.org
Subject: [PATCH libgpiod v3 14/16] doc: add documentation for gpio-tools
Date: Thu, 06 Feb 2025 13:22:11 +0100	[thread overview]
Message-ID: <20250206-improve-docs-v3-14-2065191fff6f@linaro.org> (raw)
In-Reply-To: <20250206-improve-docs-v3-0-2065191fff6f@linaro.org>

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

We already generate man pages for gpio-tools. Let's use man2html to make
them part of the sphinx docs.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 .readthedocs.yaml   |  2 ++
 configure.ac        | 32 +++++++++++++++++++-------------
 docs/.gitignore     |  8 ++++++++
 docs/Makefile.am    |  1 +
 docs/conf.py        | 22 ++++++++++++++++++++++
 docs/gpio_tools.rst | 25 +++++++++++++++++++++++++
 docs/index.rst      |  1 +
 7 files changed, 78 insertions(+), 13 deletions(-)

diff --git a/.readthedocs.yaml b/.readthedocs.yaml
index 97086fa..c2b0a7f 100644
--- a/.readthedocs.yaml
+++ b/.readthedocs.yaml
@@ -19,11 +19,13 @@ build:
       - autoconf-archive
       # doxygen is available by default, but just in case.
       - doxygen
+      - help2man
       - gi-docgen
       - gir1.2-glib-2.0-dev
       - gobject-introspection
       - graphviz
       - libtool
+      - pandoc
       - pkg-config
 
 sphinx:
diff --git a/configure.ac b/configure.ac
index 8eec855..af5d53d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -327,18 +327,6 @@ then
 		      AC_MSG_ERROR([systemdsystemunitdir not found - needed to enable systemd support]))
 fi
 
-AC_CHECK_PROG([has_doxygen], [doxygen], [true], [false])
-AC_CHECK_PROG([has_sphinx], [sphinx-build], [true], [false])
-AM_CONDITIONAL([WITH_DOCS], [test "x$has_doxygen" = xtrue && test "x$has_sphinx" = xtrue])
-if test "x$has_doxygen" = xfalse
-then
-	AC_MSG_NOTICE([doxygen not found - documentation cannot be generated])
-fi
-if test "x$has_sphinx" = xfalse
-then
-	AC_MSG_NOTICE([sphinx-build not found - documentation cannot be generated])
-fi
-
 if test "x$cross_compiling" = xno
 then
 	AC_CHECK_PROG([has_help2man], [help2man], [true], [false])
@@ -346,7 +334,25 @@ fi
 AM_CONDITIONAL([WITH_MANPAGES], [test "x$has_help2man" = xtrue])
 if test "x$has_help2man" = xfalse
 then
-	AC_MSG_NOTICE([help2man not found - man pages cannot be generated automatically])
+	AC_MSG_NOTICE([help2man not found - man pages and documentation cannot be generated])
+fi
+
+AC_DEFUN([DOC_PROG_NOT_FOUND], [AC_MSG_NOTICE([$1 not found - documentation cannot be generated])])
+AC_CHECK_PROG([has_doxygen], [doxygen], [true], [false])
+AC_CHECK_PROG([has_sphinx], [sphinx-build], [true], [false])
+AC_CHECK_PROG([has_pandoc], [pandoc], [true], [false])
+AM_CONDITIONAL([WITH_DOCS], [test "x$has_doxygen" = xtrue && test "x$has_sphinx" = xtrue && test "x$has_pandoc" = xtrue && test "x$has_help2man" = xtrue])
+if test "x$has_doxygen" = xfalse
+then
+	DOC_PROG_NOT_FOUND(["doxygen"])
+fi
+if test "x$has_sphinx" = xfalse
+then
+	DOC_PROG_NOT_FOUND(["sphinx-build"])
+fi
+if test "x$has_pandoc" = xfalse
+then
+	DOC_PROG_NOT_FOUND(["pandoc"])
 fi
 
 AC_CONFIG_FILES([Makefile
diff --git a/docs/.gitignore b/docs/.gitignore
index 86f8cfd..c9ffb90 100644
--- a/docs/.gitignore
+++ b/docs/.gitignore
@@ -3,3 +3,11 @@
 
 doxygen-output
 sphinx-output
+
+# Automatically generated .rst
+gpiodetect.rst
+gpioinfo.rst
+gpioget.rst
+gpioset.rst
+gpiomon.rst
+gpionotify.rst
diff --git a/docs/Makefile.am b/docs/Makefile.am
index ef9ebf2..269dd7e 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -33,6 +33,7 @@ DOCS_DEPS = \
 	Doxyfile \
 	index.rst \
 	glib_api.rst \
+	gpio_tools.rst \
 	python_api.rst \
 	python_chip_info.rst \
 	python_chip.rst \
diff --git a/docs/conf.py b/docs/conf.py
index 33fc89f..5e20c17 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -100,8 +100,30 @@ subprocess.run(
         "--enable-tools",
         "--enable-bindings-glib",
         "--enable-introspection",
+        "--enable-tools",
     ],
     check=True,
 )
 subprocess.run(["make", "-j"], check=True)
 os.chdir(cwd)
+
+for page in [
+    "gpiodetect",
+    "gpioinfo",
+    "gpioget",
+    "gpioset",
+    "gpiomon",
+    "gpionotify",
+]:
+    subprocess.run(
+        [
+            "pandoc",
+            "--from=man",
+            "--to=rst",
+            "--standalone",
+            "--wrap=none",
+            f"--output={page}.rst",
+            f"../man/{page}.man",
+        ],
+        check=True,
+    )
diff --git a/docs/gpio_tools.rst b/docs/gpio_tools.rst
new file mode 100644
index 0000000..7372de4
--- /dev/null
+++ b/docs/gpio_tools.rst
@@ -0,0 +1,25 @@
+..
+   SPDX-License-Identifier: CC-BY-SA-4.0
+   SPDX-FileCopyrightText: 2025 Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+
+..
+   This file is part of libgpiod.
+
+   GPIO tools documentation
+
+Command-line tools
+==================
+
+The **libgpiod** project includes a suite of **command-line tools** to
+facilitate GPIO manipulation from console and shell scripts.
+
+.. toctree::
+   :maxdepth: 1
+   :caption: Manual entries
+
+   gpiodetect<gpiodetect>
+   gpioinfo<gpioinfo>
+   gpioget<gpioget>
+   gpioset<gpioset>
+   gpiomon<gpiomon>
+   gpionotify<gpionotify>
diff --git a/docs/index.rst b/docs/index.rst
index 8dcea20..a52cc3a 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -26,3 +26,4 @@ this interface.
 
    core_api
    bindings
+   gpio_tools

-- 
2.45.2


  parent reply	other threads:[~2025-02-06 12:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06 12:21 [PATCH libgpiod v3 00/16] doc: improvements for ReadTheDocs Bartosz Golaszewski
2025-02-06 12:21 ` [PATCH libgpiod v3 01/16] build: set PACKAGE_URL Bartosz Golaszewski
2025-02-06 12:21 ` [PATCH libgpiod v3 02/16] bindings: cxx: doc: remove the gpiod_cxx doxygen group Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 03/16] bindings: python: doc: update the docstring for gpiod.request_lines() Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 04/16] bindings: python: doc: make code examples appear as such in sphinx Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 05/16] bindings: python: doc: describe undocumented members Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 06/16] bindings: glib: add the configuration file for gi-docgen Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 07/16] dbus: daemon: add a more detailed description to help text Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 08/16] dbus: client: tweak " Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 09/16] dbus: improve comments in API xml Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 10/16] doc: create man entries for gpio-manager and gpiocli Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 11/16] doc: provide sphinx docs for the core C API and C++ bindings Bartosz Golaszewski
2025-02-10 14:53   ` [External] - " Vincent Fazio
2025-02-11 12:19     ` Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 12/16] doc: add documentation for python bindings Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 13/16] doc: add documentation for GLib bindings Bartosz Golaszewski
2025-02-10 15:10   ` [External] - " Vincent Fazio
2025-02-11 12:51     ` Bartosz Golaszewski
2025-02-06 12:22 ` Bartosz Golaszewski [this message]
2025-02-06 12:22 ` [PATCH libgpiod v3 15/16] doc: add documentation for D-Bus API, daemon and command-line client Bartosz Golaszewski
2025-02-06 12:22 ` [PATCH libgpiod v3 16/16] doc: move README contents to sphinx docs Bartosz Golaszewski
2025-02-10 13:48   ` [External] - " Vincent Fazio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250206-improve-docs-v3-14-2065191fff6f@linaro.org \
    --to=brgl@bgdev.pl \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=erik.schilling@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=phil@gadgetoid.com \
    --cc=vfazio@xes-inc.com \
    --cc=viresh.kumar@linaro.org \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).