From: grantseltzer <grantseltzer@gmail.com>
To: andrii@kernel.org, daniel@iogearbox.net
Cc: grantseltzer@gmail.com, bpf@vger.kernel.org
Subject: [PATCH bpf-next 1/3] bpf: Add sphinx documentation build files
Date: Thu, 29 Apr 2021 05:47:32 +0000 [thread overview]
Message-ID: <20210429054734.53264-2-grantseltzer@gmail.com> (raw)
In-Reply-To: <20210429054734.53264-1-grantseltzer@gmail.com>
This adds the ability for sphinx, a tool for creating html documentation
to read in .rst documentation files. It also enables it to use the breathe
plugin to read in xml files that are generated by doxygen, a code
documentation tool.
Sphinx pulls in rst or xml documentation and generates pretty html
which also conveniently can be hosted by readthedocs.org.
The requirements.txt file tells sphinx that it requires the 'breathe'
plugin to be installed. breathe is a plugin that acts as the translation
layer between doxygen and sphinx.
Signed-off-by: grantseltzer <grantseltzer@gmail.com>
---
tools/lib/bpf/docs/conf.py | 38 ++++++++++++++++++++++
tools/lib/bpf/docs/index.rst | 15 +++++++++
tools/lib/bpf/docs/sphinx/Makefile | 9 +++++
tools/lib/bpf/docs/sphinx/requirements.txt | 1 +
4 files changed, 63 insertions(+)
create mode 100644 tools/lib/bpf/docs/conf.py
create mode 100644 tools/lib/bpf/docs/index.rst
create mode 100644 tools/lib/bpf/docs/sphinx/Makefile
create mode 100644 tools/lib/bpf/docs/sphinx/requirements.txt
diff --git a/tools/lib/bpf/docs/conf.py b/tools/lib/bpf/docs/conf.py
new file mode 100644
index 000000000..a67dff0dd
--- /dev/null
+++ b/tools/lib/bpf/docs/conf.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0
+# Configuration file for the Sphinx documentation builder.
+#
+# This file only contains a selection of the most common options. For a full
+# list see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
+
+import os
+import subprocess
+
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.doctest',
+ 'sphinx.ext.mathjax',
+ 'sphinx.ext.viewcode',
+ 'sphinx.ext.imgmath',
+ 'sphinx.ext.todo',
+ 'breathe',
+]
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path.
+exclude_patterns = []
+
+read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
+
+if read_the_docs_build:
+ subprocess.call('make clean', shell=True)
+ subprocess.call('cd sphinx/doxygen ; doxygen', shell=True)
+
+html_theme = 'sphinx_rtd_theme'
+
+breathe_projects = { "libbpf": "./sphinx/doxygen/build/xml/" }
+breathe_default_project = "libbpf"
+breathe_show_define_initializer = True
+breathe_show_enumvalue_initializer = True
diff --git a/tools/lib/bpf/docs/index.rst b/tools/lib/bpf/docs/index.rst
new file mode 100644
index 000000000..31a6ecfab
--- /dev/null
+++ b/tools/lib/bpf/docs/index.rst
@@ -0,0 +1,15 @@
+libbpf documentation
+=======================================
+
+This is documentation for libbpf, a userspace library for loading and
+interacting with bpf programs.
+
+All general BPF questions, including kernel functionality, libbpf APIs and
+their application, should be sent to bpf@vger.kernel.org mailing list.
+You can subscribe to it `here <http://vger.kernel.org/vger-lists.html#bpf>`_
+and search its archive `here <https://lore.kernel.org/bpf/>`_.
+Please search the archive before asking new questions. It very well might
+be that this was already addressed or answered before.
+
+.. toctree::
+ :caption: Documentation:
diff --git a/tools/lib/bpf/docs/sphinx/Makefile b/tools/lib/bpf/docs/sphinx/Makefile
new file mode 100644
index 000000000..69305958f
--- /dev/null
+++ b/tools/lib/bpf/docs/sphinx/Makefile
@@ -0,0 +1,9 @@
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = ..
+BUILDDIR = build
+
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)"
+
+%:
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)"
diff --git a/tools/lib/bpf/docs/sphinx/requirements.txt b/tools/lib/bpf/docs/sphinx/requirements.txt
new file mode 100644
index 000000000..188f51e62
--- /dev/null
+++ b/tools/lib/bpf/docs/sphinx/requirements.txt
@@ -0,0 +1 @@
+breathe
\ No newline at end of file
--
2.29.2
next prev parent reply other threads:[~2021-04-29 21:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 5:47 [PATCH bpf-next 0/3] Autogenerating API documentation grantseltzer
2021-04-29 5:47 ` grantseltzer [this message]
2021-04-29 5:47 ` [PATCH bpf-next 2/3] bpf: Add doxygen configuration file grantseltzer
2021-04-29 5:47 ` [PATCH bpf-next 3/3] bpf: Add rst docs for libbpf grantseltzer
2021-04-29 22:57 ` [PATCH bpf-next 0/3] Autogenerating API documentation Jonathan Corbet
2021-04-30 14:04 ` Grant Seltzer Richman
2021-04-30 14:22 ` Jonathan Corbet
2021-04-30 14:27 ` Grant Seltzer Richman
2021-04-30 17:30 ` Andrii Nakryiko
2021-05-10 14:58 ` Grant Seltzer Richman
2021-05-10 17:48 ` Andrii Nakryiko
2021-05-26 3:22 ` Grant Seltzer Richman
2021-05-26 20:45 ` Andrii Nakryiko
2021-05-28 14:50 ` Grant Seltzer Richman
2021-06-01 19:01 ` Jonathan Corbet
2021-06-01 22:49 ` Grant Seltzer Richman
2021-06-01 23:19 ` Jonathan Corbet
2021-06-02 1:06 ` Grant Seltzer Richman
2021-06-04 21:18 ` Grant Seltzer Richman
2021-06-07 22:45 ` Andrii Nakryiko
2021-06-09 17:04 ` Grant Seltzer Richman
2021-06-10 17:14 ` Andrii Nakryiko
2021-06-11 20:00 ` Grant Seltzer Richman
2021-06-14 22:35 ` Andrii Nakryiko
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=20210429054734.53264-2-grantseltzer@gmail.com \
--to=grantseltzer@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
/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