[gimp] configure, meson, devel-docs: make gi-docgen into an auto option.



commit d5e22ad3132597b314f1d38d89747e149625c23e
Author: Jehan <jehan girinstud io>
Date:   Wed Dec 29 00:55:17 2021 +0100

    configure, meson, devel-docs: make gi-docgen into an auto option.
    
    Also called "feature" option in meson, so that by default it depends on
    auto-detection of the gi-docgen hence won't break the configuration when
    the tool is missing (the feature is simply disabled).
    
    Also move the program check into the root meson file, which is anyway
    much better to have a better visibility of features, otherwise we'd end
    up just having tests everywhere in any possible random directory of the
    repo.
    
    Finally add a line in the summary of the configuration step, displaying
    the docs generation being enabled or disabled.

 configure.ac                     | 15 ++++++++++++---
 devel-docs/meson.build           |  3 +--
 devel-docs/reference/meson.build |  2 --
 meson.build                      |  4 ++++
 meson_options.txt                |  2 +-
 5 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f397fa163c..4d9de9d605 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2752,13 +2752,21 @@ fi
 # Check for gi-docgen
 ########################################
 
-AC_ARG_ENABLE(gi-docgen, [  --enable-gi-docgen       build gi-docgen documentation (default=yes)], , 
enable_gi_docgen=yes)
+AC_ARG_ENABLE(gi-docgen, [  --enable-gi-docgen       build gi-docgen documentation (default=auto)], , 
enable_gi_docgen=auto)
 
-if test "x$enable_gi_docgen" = xyes; then
+if test "x$enable_gi_docgen" != xno; then
   AC_PATH_PROG(GI_DOCGEN, gi-docgen, no)
   if test "x$GI_DOCGEN" = xno; then
-    add_deps_error([gi-docgen], [Could not find gi-docgen in your PATH.])
+    if test "x$enable_gi_docgen" = xyes; then
+      add_deps_error([gi-docgen], [Could not find gi-docgen in your PATH.])
+    else
+      enable_gi_docgen="no (gi-docgen missing)"
+    fi
+  else
+    enable_gi_docgen="yes"
   fi
+else
+  enable_gi_docgen="no"
 fi
 
 AM_CONDITIONAL(ENABLE_GI_DOCGEN, test "x$enable_gi_docgen" = xyes)
@@ -3272,6 +3280,7 @@ Tests:
   Test desktop file          $have_desktop_file_validate
 
 Documentation:
+  libgimp API Reference:     $enable_gi_docgen
   GObject Introspection:     $enable_g_ir_doc
 
 Bug report URL: $with_bug_report_url
diff --git a/devel-docs/meson.build b/devel-docs/meson.build
index 4f65f92edb..8b80f8c005 100644
--- a/devel-docs/meson.build
+++ b/devel-docs/meson.build
@@ -16,8 +16,7 @@ mkdb_args_common = [
   '--name-space=gimp',
 ]
 
-
-if get_option('gi-docgen')
+if gi_docgen.found()
   subdir('reference')
 endif
 
diff --git a/devel-docs/reference/meson.build b/devel-docs/reference/meson.build
index e885a51a21..147eb7fd2f 100644
--- a/devel-docs/reference/meson.build
+++ b/devel-docs/reference/meson.build
@@ -1,4 +1,2 @@
-gi_docgen = find_program('gi-docgen')
-
 subdir('gimp')
 subdir('gimp-ui')
diff --git a/meson.build b/meson.build
index caeb4d87fe..cb353ec138 100644
--- a/meson.build
+++ b/meson.build
@@ -1009,6 +1009,9 @@ desktop_validate    = find_program('desktop-file-validate', required: false)
 appstream_util = find_program('appstream-util', required: get_option('appdata-test'))
 
 # Check for doc generation tools
+
+gi_docgen = find_program('gi-docgen', required: get_option('gi-docgen'))
+
 if get_option('g-ir-doc')
   gir_doc_tool = find_program('g-ir-doc-tool', required: true)
   yelp_build   = find_program('yelp-build', required: true)
@@ -1828,6 +1831,7 @@ final_message = [
 '''  Test appdata         @0@'''.format(appstream_util.found()),
 '',
 '''Documentation:''',
+'''  libgimp API Reference: @0@'''.format(gi_docgen.found()),
 '''  GObject Introspection: @0@'''.format(get_option('g-ir-doc')),
 '',
 '''Bug report URL: @0@'''.format(bug_report_url),
diff --git a/meson_options.txt b/meson_options.txt
index 94f620a399..aaf0982ca4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -51,7 +51,7 @@ option('xcursor',           type: 'feature', value: 'auto', description: 'Xcurso
 option('xpm',               type: 'feature', value: 'auto', description: 'XPM support')
 option('headless-tests',    type: 'feature', value: 'auto', description: 'Use xvfb-run/dbus-run-session for 
UI-dependent automatic tests')
 
-option('gi-docgen',         type: 'boolean', value: true,   description: 'Build developer documentation 
(uses gi-docgen)')
+option('gi-docgen',         type: 'feature', value: 'auto', description: 'Build developer documentation 
(uses gi-docgen)')
 option('g-ir-doc',          type: 'boolean', value: false,  description: 'Build developer documentation for 
introspected API')
 
 option('linux-input',       type: 'feature', value: 'auto', description: 'Linux input event controller 
module')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]