Skip to contentSkip to conversation

meson: properly disable docs

PATCH In review Robin Jarry 4 participants 6 messages Oct 22, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: properly disable docs

Fix the following meson warning when -Denable_docs=false:

 $ meson setup build -Denable_docs=false -Denable_drivers=net/null \
      -Denable_libs=rib -Ddisable_apps=* --wipe --fatal-meson-warnings
 ...
 Program doxygen found: YES (/usr/bin/doxygen)
 Configuring doxy-api-html.conf using configuration
 doc/api/meson.build:54: WARNING: The variable(s) 'DTS_API_MAIN_PAGE' in
 the input file 'doc/api/doxy-api.conf.in' are not present in the given
 configuration data.
 doc/api/meson.build:54:17: ERROR: Fatal warnings enabled, aborting

When -Denable_docs=false, do not even enter the doc subdir. Replace all occurrences of get_option('enable_docs') in the doc subdir with true.

Fixes 7f9326423a04 ("dts: add API doc generation")
---
 doc/api/dts/meson.build |  6 +++---
 doc/api/meson.build     | 16 ++++++++--------
 doc/guides/meson.build  |  6 +++---
 meson.build             |  6 ++++--
 4 files changed, 18 insertions(+), 16 deletions(-)
doc/api/dts/meson.build +3 -3
index 5115df70956b..a8edd232ddcf 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2023 PANTHEON.tech s.r.o.
 
-sphinx = find_program('sphinx-build', required: get_option('enable_docs'))
+sphinx = find_program('sphinx-build', required: true)
 if not sphinx.found()
     subdir_done()
 endif
@@ -23,8 +23,8 @@ dts_api_html = custom_target('dts_api_html',
         output: 'html',
         command: [sphinx_wrapper, sphinx, meson.project_version(),
             meson.current_source_dir(), meson.current_build_dir(), extra_sphinx_args],
-        build_by_default: get_option('enable_docs'),
-        install: get_option('enable_docs'),
+        build_by_default: true,
+        install: true,
         install_dir: htmldir)
 
 doc_targets += dts_api_html
doc/api/meson.build +8 -8
index ae23e9825edc..d82803df388d 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <[email protected]>
 
-doxygen = find_program('doxygen', required: get_option('enable_docs'))
+doxygen = find_program('doxygen', required: true)
 
 if not doxygen.found()
   # process DTS API doc build even if DPDK API doc build can't be done
@@ -28,9 +28,9 @@ example = custom_target('examples.dox',
         output: 'examples.dox',
         command: [generate_examples, join_paths(dpdk_source_root, 'examples'), '@OUTPUT@'],
         depfile: 'examples.dox.d',
-        install: get_option('enable_docs'),
+        install: true,
         install_dir: htmldir,
-        build_by_default: get_option('enable_docs'))
+        build_by_default: true)
 
 # set up common Doxygen configuration
 cdata = configuration_data()
@@ -76,9 +76,9 @@ doxy_html_build = custom_target('doxygen-html',
         output: 'html',
         depfile: 'html.d',
         command: [generate_doxygen, '@OUTPUT@', doxygen, '@INPUT@'],
-        install: get_option('enable_docs'),
+        install: true,
         install_dir: htmldir,
-        build_by_default: get_option('enable_docs'))
+        build_by_default: true)
 
 doc_targets += doxy_html_build
 doc_target_names += 'Doxygen_API(HTML)'
@@ -90,9 +90,9 @@ doxy_man_build = custom_target('doxygen-man',
         output: 'man',
         depfile: 'man.d',
         command: [generate_doxygen, '@OUTPUT@', doxygen, '@INPUT@'],
-        install: get_option('enable_docs'),
+        install: true,
         install_dir: get_option('datadir'),
-        build_by_default: get_option('enable_docs'))
+        build_by_default: true)
 
 doc_targets += doxy_man_build
 doc_target_names += 'Doxygen_API(Manpage)'
@@ -100,7 +100,7 @@ doc_target_names += 'Doxygen_API(Manpage)'
 # refresh the manpage database on install
 # if DPDK manpages are installed to a staging directory, not in MANPATH, this has no effect
 mandb = find_program('mandb', required: false)
-if mandb.found() and get_option('enable_docs')
+if mandb.found()
     meson.add_install_script(mandb)
 endif
 
doc/guides/meson.build +3 -3
index f8bbfba9f5b5..840f9c8a6bfb 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-sphinx = find_program('sphinx-build', required: get_option('enable_docs'))
+sphinx = find_program('sphinx-build', required: true)
 
 if not sphinx.found()
     subdir_done()
@@ -20,8 +20,8 @@ html_guides = custom_target('html_guides',
             meson.current_source_dir(), meson.current_build_dir(),
             extra_sphinx_args],
         depfile: '.html.d',
-        build_by_default: get_option('enable_docs'),
-        install: get_option('enable_docs'),
+        build_by_default: true,
+        install: true,
         install_dir: htmldir)
 
 doc_targets += html_guides
meson.build +4 -2
index fe9040369ab9..d67d5577a1d4 100644
@@ -82,8 +82,10 @@ subdir('drivers')
 subdir('usertools')
 subdir('app')
 
-# build docs
-subdir('doc')
+if get_option('enable_docs')
+    # build docs
+    subdir('doc')
+endif
 
 # build any examples explicitly requested - useful for developers - and
 # install any example code into the appropriate install path
Signature · 1 line
2.47.0
#1 lore raw
Quoted 15 lines · Robin Jarry

Fix the following meson warning when -Denable_docs=false:

 $ meson setup build -Denable_docs=false -Denable_drivers=net/null \
      -Denable_libs=rib -Ddisable_apps=* --wipe --fatal-meson-warnings
 ...
 Program doxygen found: YES (/usr/bin/doxygen)
 Configuring doxy-api-html.conf using configuration
 doc/api/meson.build:54: WARNING: The variable(s) 'DTS_API_MAIN_PAGE' in
 the input file 'doc/api/doxy-api.conf.in' are not present in the given
 configuration data.
 doc/api/meson.build:54:17: ERROR: Fatal warnings enabled, aborting

When -Denable_docs=false, do not even enter the doc subdir. Replace all occurrences of get_option('enable_docs') in the doc subdir with true.

Quoted 9 lines
Fixes 7f9326423a04 ("dts: add API doc generation")
---
 doc/api/dts/meson.build |  6 +++---
 doc/api/meson.build     | 16 ++++++++--------
 doc/guides/meson.build  |  6 +++---
 meson.build             |  6 ++++--
 4 files changed, 18 insertions(+), 16 deletions(-)

No strong objection to this. Just FYI, the reason it is currently done as it is in the build, is that even if you configure a build without the docs enabled, you can just build the docs explicitly by doing "ninja -C build doc". That is so that one can do a test build of the docs without
a) having to reconfigure the whole project
b) not have every build from then on rebuild e.g. the APIs doc if you change a header.

Regards,
/Bruce

#2 lore raw

Bruce Richardson, Oct 22, 2024 at 17:25:

Quoted 7 lines

No strong objection to this. Just FYI, the reason it is currently done as it is in the build, is that even if you configure a build without the docs enabled, you can just build the docs explicitly by doing "ninja -C build doc". That is so that one can do a test build of the docs without
a) having to reconfigure the whole project
b) not have every build from then on rebuild e.g. the APIs doc if you change a header.

Oh, I didn't know it was on purpose. I was surprised to see doc related warnings with -Denable_docs=false.

Feel free to disregard this patch if you think it is too drastic.

#3 lore raw
Quoted 9 lines · Robin Jarry

Bruce Richardson, Oct 22, 2024 at 17:25:

Quoted 7 lines

No strong objection to this. Just FYI, the reason it is currently done as it is in the build, is that even if you configure a build without the docs enabled, you can just build the docs explicitly by doing "ninja -C build doc". That is so that one can do a test build of the docs without
a) having to reconfigure the whole project
b) not have every build from then on rebuild e.g. the APIs doc if you change a header.

Quoted 5 lines

Oh, I didn't know it was on purpose. I was surprised to see doc related warnings with -Denable_docs=false.

Feel free to disregard this patch if you think it is too drastic.

Like I said, I don't have that strong of opinions about it - I just wanted to let you and others know that there was *some* (however little) method behind the madness of doing things this way.
It is possible to fix the error directly, so that the warning does not appear if docs are disabled?

/Bruce

#4 lore raw

22/10/2024 17:49, Bruce Richardson:

Quoted 10 lines · Robin Jarry
Quoted 9 lines

Bruce Richardson, Oct 22, 2024 at 17:25:

Quoted 7 lines

No strong objection to this. Just FYI, the reason it is currently done as it is in the build, is that even if you configure a build without the docs enabled, you can just build the docs explicitly by doing "ninja -C build doc". That is so that one can do a test build of the docs without
a) having to reconfigure the whole project
b) not have every build from then on rebuild e.g. the APIs doc if you change a header.

Quoted 8 lines
Quoted 5 lines

Oh, I didn't know it was on purpose. I was surprised to see doc related warnings with -Denable_docs=false.

Feel free to disregard this patch if you think it is too drastic.

Like I said, I don't have that strong of opinions about it - I just wanted to let you and others know that there was *some* (however little) method behind the madness of doing things this way.

Let's not change the convenient behaviour.
I reject this patch.

Quoted 2 lines

It is possible to fix the error directly, so that the warning does not appear if docs are disabled?

We must fix warnings yes.

Acked-by on v1 1/1
#5 lore raw
In reply to Robin Jarry
Quoted 12 lines · On Tue, 22 Oct 2024 17:11:42 +0200 Robin Jarry <[email protected]> wrote:

Fix the following meson warning when -Denable_docs=false:

 $ meson setup build -Denable_docs=false -Denable_drivers=net/null \
      -Denable_libs=rib -Ddisable_apps=* --wipe --fatal-meson-warnings
 ...
 Program doxygen found: YES (/usr/bin/doxygen)
 Configuring doxy-api-html.conf using configuration
 doc/api/meson.build:54: WARNING: The variable(s) 'DTS_API_MAIN_PAGE' in
 the input file 'doc/api/doxy-api.conf.in' are not present in the given
 configuration data.
 doc/api/meson.build:54:17: ERROR: Fatal warnings enabled, aborting
Quoted 5 lines

When -Denable_docs=false, do not even enter the doc subdir. Replace all occurrences of get_option('enable_docs') in the doc subdir with true.

Fixes 7f9326423a04 ("dts: add API doc generation")