[gegl] docs: don't try to build docs if asciidoc cannot be found in the build environment



commit 2e3d2c1c0a1d1a55628657868bacf76a6cf9edee
Author: John Marshall <jtm home gmail com>
Date:   Tue Feb 2 14:31:34 2021 +0000

    docs: don't try to build docs if asciidoc cannot
    be found in the build environment

 docs/meson.build         | 44 ++++++++++++++++++++------------------------
 docs/website/meson.build | 46 +++++++++++++++++++++-------------------------
 meson.build              | 13 ++++++++++---
 3 files changed, 51 insertions(+), 52 deletions(-)
---
diff --git a/docs/meson.build b/docs/meson.build
index 6a6bb6fe0..f4df25616 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -25,7 +25,7 @@ images = files(
 # stylesheets
 stylesheets = files(
   'gegl.css',
-  'devhelp.css',
+  'devhelp.css'
 )
 configure_file(
   input : files('gegl.css'),
@@ -55,29 +55,25 @@ asciidoc_files += [
 ]
 
 # asciidoc html files
-if asciidoc.found()
-  _tgt = []
-  foreach _file: asciidoc_files
-    _tgt += custom_target('@0@.html'.format(_file).underscorify(),
-      output: '@BASENAME@.html',
-      input: _file,
-      command: [
-        asciidoc,
-        '--unsafe',
-        '-o', '@OUTPUT@',
-        '-a', 'stylesheet=@0@'.format(
-            project_source_root / 'docs' / 'gegl.css'
-          ),
-        '-a', 'quirks!',
-        '@INPUT@',
-      ],
-      build_by_default : true,
-    )
-  endforeach
-  news_html = _tgt[0]
-else
-  error('asciidoc is required to build docs')
-endif
+_tgt = []
+foreach _file: asciidoc_files
+  _tgt += custom_target('@0@.html'.format(_file).underscorify(),
+    output: '@BASENAME@.html',
+    input: _file,
+    command: [
+      asciidoc,
+      '--unsafe',
+      '-o', '@OUTPUT@',
+      '-a', 'stylesheet=@0@'.format(
+        meson.current_build_dir() / 'gegl.css'
+      ),
+      '-a', 'quirks!',
+      '@INPUT@',
+    ],
+    build_by_default : true,
+  )
+endforeach
+news_html = _tgt[0]
 
 # website html files
 if can_run_host_binaries
diff --git a/docs/website/meson.build b/docs/website/meson.build
index 7fadb96fc..91267dcac 100644
--- a/docs/website/meson.build
+++ b/docs/website/meson.build
@@ -26,31 +26,27 @@ else
 endif
 
 # asciidoc html files
-if asciidoc.found()
-  _tgt = []
-  foreach _file: website_asciidoc_files
-    _tgt += custom_target('@0@.html'.format(_file).underscorify(),
-      output: '@BASENAME@.html',
-      input: _file,
-      command: [
-        asciidoc,
-        '--unsafe',
-        '-o', '@OUTPUT@',
-        '-a', 'gegl_usage=@0@'.format(gegl_usage.full_path()),
-        '-a', 'stylesheet=@0@'.format(
-            project_source_root / 'docs' / 'gegl.css'
-          ),
-        '-a', 'quirks!',
-        '@INPUT@',
-      ],
-      build_by_default : true,
-      depends: gegl_usage,
-    )
-  endforeach
-  index_html = _tgt[0]
-else
-  error('asciidoc is required to build website')
-endif
+_tgt = []
+foreach _file: website_asciidoc_files
+  _tgt += custom_target('@0@.html'.format(_file).underscorify(),
+    output: '@BASENAME@.html',
+    input: _file,
+    command: [
+      asciidoc,
+      '--unsafe',
+      '-o', '@OUTPUT@',
+      '-a', 'gegl_usage=@0@'.format(gegl_usage.full_path()),
+      '-a', 'stylesheet=@0@'.format(
+        meson.current_build_dir() / 'gegl.css'
+      ),
+      '-a', 'quirks!',
+      '@INPUT@',
+    ],
+    build_by_default : true,
+    depends: gegl_usage,
+  )
+endforeach
+index_html = _tgt[0]
 
 # enscript html files
 enscript_files = {
diff --git a/meson.build b/meson.build
index faf60be3a..34c71dd79 100644
--- a/meson.build
+++ b/meson.build
@@ -433,11 +433,18 @@ endif
 
 # Docs
 build_docs = true
-if get_option('docs') == 'auto' and meson.is_cross_build()
-  build_docs = false
-  message('configure with -Ddocs=true to cross-build docs')
+if get_option('docs') == 'auto'
+  if meson.is_cross_build()
+    build_docs = false
+    message('configure with -Ddocs=true to cross-build docs')
+  elif not asciidoc.found()
+    build_docs = false
+  endif
 elif get_option('docs') == 'false'
   build_docs = false
+elif not asciidoc.found()
+  build_docs = false
+  warning('asciidoc is required to build website')
 endif
 build_reference = get_option('gtk-doc')
 


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