[libsoup/wip/docs-updates: 5/9] build: Change docs to a feature set to auto




commit 1b51db848bdb17794c4e8184f5a2b582d37ea988
Author: Patrick Griffis <pgriffis igalia com>
Date:   Thu Apr 14 12:35:23 2022 -0500

    build: Change docs to a feature set to auto

 docs/reference/meson.build | 61 ++++++++++++++++++++++++----------------------
 meson.build                |  8 +++---
 meson_options.txt          |  6 ++---
 3 files changed, 38 insertions(+), 37 deletions(-)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index e36c2fd3..d868201c 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -10,37 +10,40 @@ expand_content_md_files = [
 toml_data = configuration_data()
 toml_data.set('VERSION', meson.project_version())
 
-libsoup_toml = configure_file(
-  input: 'libsoup.toml.in',
-  output: 'libsoup.toml',
-  configuration: toml_data
+gidocgen_dep = dependency('gi-docgen', version: '>= 2021.1',
+  fallback: ['gi-docgen', 'dummy_dep'],
+  native: true,
+  required: get_option('docs')
 )
 
-dependency('gi-docgen', version: '>= 2021.1',
-           fallback: ['gi-docgen', 'dummy_dep'],
-           native: true,
-           required: get_option('gtk_doc'))
+if gidocgen_dep.found()
+  libsoup_toml = configure_file(
+    input: 'libsoup.toml.in',
+    output: 'libsoup.toml',
+    configuration: toml_data
+  )
 
-gidocgen = find_program('gi-docgen')
+  gidocgen = find_program('gi-docgen')
 
-docs_dir = get_option('datadir') / 'doc'
+  docs_dir = get_option('datadir') / 'doc'
 
-custom_target('libsoup-doc',
-  input: [ libsoup_toml, soup_gir_gen_sources[0] ],
-  output: 'libsoup-@0@'.format(apiversion),
-  command: [
-    gidocgen,
-    'generate',
-    '--quiet',
-    '--add-include-path=@0@'.format(meson.current_build_dir() / '../../libsoup'),
-    '--config=@INPUT0@',
-    '--output-dir=@OUTPUT@',
-    '--no-namespace-dir',
-    '--content-dir=@0@'.format(meson.current_source_dir()),
-    '@INPUT1@',
-  ],
-  depend_files: [ expand_content_md_files ],
-  build_by_default: true,
-  install: true,
-  install_dir: docs_dir,
-)
+  custom_target('libsoup-doc',
+    input: [ libsoup_toml, soup_gir_gen_sources[0] ],
+    output: 'libsoup-@0@'.format(apiversion),
+    command: [
+      gidocgen,
+      'generate',
+      '--quiet',
+      '--add-include-path=@0@'.format(meson.current_build_dir() / '../../libsoup'),
+      '--config=@INPUT0@',
+      '--output-dir=@OUTPUT@',
+      '--no-namespace-dir',
+      '--content-dir=@0@'.format(meson.current_source_dir()),
+      '@INPUT1@',
+    ],
+    depend_files: [ expand_content_md_files ],
+    build_by_default: true,
+    install: true,
+    install_dir: docs_dir,
+  )
+endif
\ No newline at end of file
diff --git a/meson.build b/meson.build
index b2f6798a..6ac3ebad 100644
--- a/meson.build
+++ b/meson.build
@@ -404,10 +404,8 @@ if get_option('tests')
   subdir('tests')
  endif
 
-if get_option('gtk_doc')
-  srcdir = include_directories('libsoup')
-  subdir('docs/reference')
-endif
+srcdir = include_directories('libsoup')
+subdir('docs/reference')
 
 summary({
     'prefix' : get_option('prefix'),
@@ -424,7 +422,7 @@ summary({
     'Translations' : xgettext.found(),
     'GIR' : enable_introspection,
     'VAPI' : enable_vapi,
-    'Documentation' : get_option('gtk_doc'),
+    'Documentation' : gidocgen_dep.found(),
   },
   section : 'Features'
 )
diff --git a/meson_options.txt b/meson_options.txt
index 906e5597..85c09058 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -47,9 +47,9 @@ option('vapi',
   description : 'Build Vala bindings'
 )
 
-option('gtk_doc',
-  type: 'boolean',
-  value: false,
+option('docs',
+  type: 'feature',
+  value: 'auto',
   description: 'Enable generating the API reference'
 )
 


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