dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: david.marchand@redhat.com, john.mcnamara@intel.com, bluca@debian.org
Cc: dev@dpdk.org, aconole@redhat.com, thomas@monjalon.net,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH v3 5/6] doc/guides: rebuild with meson whenever a file changes
Date: Thu,  9 Jan 2020 15:31:11 +0000	[thread overview]
Message-ID: <20200109153112.501282-6-bruce.richardson@intel.com> (raw)
In-Reply-To: <20200109153112.501282-1-bruce.richardson@intel.com>

Add proper support for calling sphinx whenever a file in the doc
directory changes. This is accomplished by using a wrapper script
for sphinx, which runs sphinx but also emits a gcc-format dependency
file listing all the doc files. This is used by ninja so that any
change to the doc files triggers a rebuild of the docs.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Aaron Conole <aconole@redhat.com>
---
 buildtools/call-sphinx-build.py | 23 +++++++++++++++++++++++
 buildtools/meson.build          |  6 ++++--
 doc/guides/meson.build          | 22 ++++++++--------------
 3 files changed, 35 insertions(+), 16 deletions(-)
 create mode 100755 buildtools/call-sphinx-build.py

diff --git a/buildtools/call-sphinx-build.py b/buildtools/call-sphinx-build.py
new file mode 100755
index 000000000..80bda2661
--- /dev/null
+++ b/buildtools/call-sphinx-build.py
@@ -0,0 +1,23 @@
+#! /usr/bin/env python3
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Intel Corporation
+#
+
+import sys
+import os
+from os.path import join
+from subprocess import run
+
+(sphinx, src, dst) = sys.argv[1:]  # assign parameters to variables
+
+# find all the files sphinx will process so we can write them as dependencies
+srcfiles = []
+for root, dirs, files in os.walk(src):
+    srcfiles.extend([join(root, f) for f in files])
+
+# run sphinx, putting the html output in a "html" directory
+run([sphinx, '-j', 'auto', '-b', 'html', src, join(dst, 'html')], check=True)
+
+# create a gcc format .d file giving all the dependencies of this doc build
+with open(join(dst, '.html.d'), 'w') as d:
+    d.write('html: ' + ' '.join(srcfiles) + '\n')
diff --git a/buildtools/meson.build b/buildtools/meson.build
index 6ef2c5721..cd1d05403 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -10,10 +10,12 @@ check_experimental_syms = find_program('check-experimental-syms.sh')
 # set up map-to-def script using python, either built-in or external
 python3 = import('python').find_installation(required: false)
 if python3.found()
-	map_to_def_cmd = [python3, files('map_to_def.py')]
+	py3 = [python3]
 else
-	map_to_def_cmd = ['meson', 'runpython', files('map_to_def.py')]
+	py3 = ['meson', 'runpython']
 endif
+map_to_def_cmd = py3 + files('map_to_def.py')
+sphinx_wrapper = py3 + files('call-sphinx-build.py')
 
 # stable ABI always starts with "DPDK_"
 is_experimental_cmd = [find_program('grep', 'findstr'), '^DPDK_']
diff --git a/doc/guides/meson.build b/doc/guides/meson.build
index 80c21d168..732e7ad3a 100644
--- a/doc/guides/meson.build
+++ b/doc/guides/meson.build
@@ -7,24 +7,18 @@ if not sphinx.found()
 	subdir_done()
 endif
 
-htmldir = join_paths('share', 'doc', 'dpdk')
+htmldir = join_paths(get_option('datadir'), 'doc', 'dpdk')
 html_guides = custom_target('html_guides',
-	input: meson.current_source_dir(),
-	output: 'guides',
-	command: [sphinx, '-b', 'html',
-		'-d', meson.current_build_dir() + '/.doctrees',
-		'@INPUT@', meson.current_build_dir() + '/guides'],
+	input: files('index.rst'),
+	output: 'html',
+	command: [sphinx_wrapper, sphinx, meson.current_source_dir(), meson.current_build_dir()],
+	depfile: '.html.d',
 	build_by_default: get_option('enable_docs'),
 	install: get_option('enable_docs'),
 	install_dir: htmldir)
 
+install_data(files('custom.css'),
+			install_dir: join_paths(htmldir,'_static', 'css'))
+
 doc_targets += html_guides
 doc_target_names += 'HTML_Guides'
-
-# sphinx leaves a .buildinfo in the target directory, which we don't
-# want to install. Note that sh -c has to be used, otherwise the
-# env var does not get expanded if calling rm/install directly.
-meson.add_install_script('sh', '-c',
-	'rm -f $MESON_INSTALL_DESTDIR_PREFIX/share/doc/dpdk/guides/.buildinfo')
-meson.add_install_script('sh', '-c',
-	'install -D -m0644 $MESON_SOURCE_ROOT/doc/guides/custom.css $MESON_INSTALL_DESTDIR_PREFIX/share/doc/dpdk/guides/_static/css/custom.css')
-- 
2.24.1


  parent reply	other threads:[~2020-01-09 15:32 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09 11:56 [dpdk-dev] [PATCH 0/6] meson build improvements Bruce Richardson
2020-01-09 11:56 ` [dpdk-dev] [PATCH 1/6] kernel/linux/kni: fix meson warning about console keyword Bruce Richardson
2020-01-09 11:56 ` [dpdk-dev] [PATCH 2/6] build: skip processing docs folder if docs disabled Bruce Richardson
2020-01-09 11:56 ` [dpdk-dev] [PATCH 3/6] doc/api: fix warning with meson build Bruce Richardson
2020-01-09 11:56 ` [dpdk-dev] [PATCH 4/6] doc/guides: reduce whitespace in meson build file Bruce Richardson
2020-01-09 11:56 ` [dpdk-dev] [PATCH 5/6] doc/guides: rebuild with meson whenever a file changes Bruce Richardson
2020-01-09 11:56 ` [dpdk-dev] [PATCH 6/6] doc/api: reduce indentation in meson build file Bruce Richardson
2020-01-09 12:07 ` [dpdk-dev] [PATCH v2 0/6] meson build improvements Bruce Richardson
2020-01-09 12:07 ` Bruce Richardson
2020-01-09 12:07   ` [dpdk-dev] [PATCH v2 1/6] kernel/linux/kni: fix meson warning about console keyword Bruce Richardson
2020-01-09 14:17     ` Aaron Conole
2020-01-09 12:07   ` [dpdk-dev] [PATCH v2 2/6] build: skip processing docs folder if docs disabled Bruce Richardson
2020-01-09 14:18     ` Aaron Conole
2020-01-09 12:07   ` [dpdk-dev] [PATCH v2 3/6] doc/api: fix warning with meson build Bruce Richardson
2020-01-09 14:19     ` Aaron Conole
2020-01-09 12:07   ` [dpdk-dev] [PATCH v2 4/6] doc/guides: reduce whitespace in meson build file Bruce Richardson
2020-01-09 14:20     ` Aaron Conole
2020-01-09 12:08   ` [dpdk-dev] [PATCH v2 5/6] doc/guides: rebuild with meson whenever a file changes Bruce Richardson
2020-01-09 14:27     ` Aaron Conole
2020-01-09 14:52       ` Bruce Richardson
2020-01-09 12:08   ` [dpdk-dev] [PATCH v2 6/6] doc/api: reduce indentation in meson build file Bruce Richardson
2020-01-09 14:28     ` Aaron Conole
2020-01-09 15:30   ` [dpdk-dev] [PATCH v2 0/6] meson build improvements Luca Boccassi
2020-01-09 15:31 ` [dpdk-dev] [PATCH v3 " Bruce Richardson
2020-01-09 15:31   ` [dpdk-dev] [PATCH v3 1/6] kernel/linux/kni: fix meson warning about console keyword Bruce Richardson
2020-01-09 18:02     ` David Marchand
2020-01-10 19:40       ` Kevin Traynor
2020-01-09 15:31   ` [dpdk-dev] [PATCH v3 2/6] build: skip processing docs folder if docs disabled Bruce Richardson
2020-01-09 15:31   ` [dpdk-dev] [PATCH v3 3/6] doc/api: fix warning with meson build Bruce Richardson
2020-01-09 18:03     ` David Marchand
2020-01-10  9:16       ` Bruce Richardson
2020-01-09 15:31   ` [dpdk-dev] [PATCH v3 4/6] doc/guides: reduce whitespace in meson build file Bruce Richardson
2020-01-09 15:31   ` Bruce Richardson [this message]
2020-01-09 18:03     ` [dpdk-dev] [PATCH v3 5/6] doc/guides: rebuild with meson whenever a file changes David Marchand
2020-01-09 18:06       ` David Marchand
2020-01-10  9:15         ` Bruce Richardson
2020-01-10 15:51     ` Bruce Richardson
2020-01-09 15:31   ` [dpdk-dev] [PATCH v3 6/6] doc/api: reduce indentation in meson build file Bruce Richardson
2020-01-10 21:51 ` [dpdk-dev] [PATCH v4 0/6] meson build improvements Bruce Richardson
2020-01-10 21:52   ` [dpdk-dev] [PATCH v4 1/6] kernel/linux/kni: fix meson warning about console keyword Bruce Richardson
2020-01-10 21:52   ` [dpdk-dev] [PATCH v4 2/6] build: skip processing docs folder if docs disabled Bruce Richardson
2020-01-10 21:52   ` [dpdk-dev] [PATCH v4 3/6] doc/api: fix warning with meson build Bruce Richardson
2020-01-10 21:52   ` [dpdk-dev] [PATCH v4 4/6] doc/guides: reduce whitespace in meson build file Bruce Richardson
2020-01-10 21:52   ` [dpdk-dev] [PATCH v4 5/6] doc/guides: rebuild with meson whenever a file changes Bruce Richardson
2020-01-14 15:59     ` David Marchand
2020-01-14 16:17       ` Bruce Richardson
2020-01-17 11:15       ` Richardson, Bruce
2020-01-10 21:52   ` [dpdk-dev] [PATCH v4 6/6] doc/api: reduce indentation in meson build file Bruce Richardson
2020-01-14 16:00   ` [dpdk-dev] [PATCH v4 0/6] meson build improvements David Marchand
2020-01-14 16:19     ` Bruce Richardson
2020-01-14 16:26       ` David Marchand
2020-01-14 16:35       ` Luca Boccassi
2020-01-14 17:35         ` Bruce Richardson
2020-01-15  8:50           ` David Marchand

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=20200109153112.501282-6-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=aconole@redhat.com \
    --cc=bluca@debian.org \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=thomas@monjalon.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;
as well as URLs for NNTP newsgroup(s).