[vala/wip/meson] meson: Make valadoc optional



commit 3136c4eee0daf1d35f1c8171c0771eed9be1b931
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Feb 11 10:39:08 2019 +0100

    meson: Make valadoc optional

 doc/meson.build   | 11 +++++++----
 meson.build       | 16 +++++++++++-----
 meson_options.txt |  9 +++++++++
 3 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/doc/meson.build b/doc/meson.build
index c87631d0e..7e72fb2e9 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -1,14 +1,17 @@
 manpages = files(
        'vala-gen-introspect.1',
        'valac.1',
-       'valadoc.1',
        'vapigen.1',
 )
 
-install_man(manpages)
-
 # https://github.com/mesonbuild/meson/issues/1602
 meson.add_install_script('sh', '-c', 'cd $DESTDIR@0@/man1; ln -fs --relative vala-gen-introspect.1 
@1@'.format(join_paths(get_option('prefix'), get_option('mandir')), 
'vala-gen-introspect@0@.1'.format(vala_version_suffix)))
 meson.add_install_script('sh', '-c', 'cd $DESTDIR@0@/man1; ln -fs --relative valac.1 
@1@'.format(join_paths(get_option('prefix'), get_option('mandir')), 'valac@0@.1'.format(vala_version_suffix)))
-meson.add_install_script('sh', '-c', 'cd $DESTDIR@0@/man1; ln -fs --relative valadoc.1 
@1@'.format(join_paths(get_option('prefix'), get_option('mandir')), 
'valadoc@0@.1'.format(vala_version_suffix)))
 meson.add_install_script('sh', '-c', 'cd $DESTDIR@0@/man1; ln -fs --relative vapigen.1 
@1@'.format(join_paths(get_option('prefix'), get_option('mandir')), 
'vapigen@0@.1'.format(vala_version_suffix)))
+
+if valadoc_enabled
+       manpages += files('valadoc.1')
+       meson.add_install_script('sh', '-c', 'cd $DESTDIR@0@/man1; ln -fs --relative valadoc.1 
@1@'.format(join_paths(get_option('prefix'), get_option('mandir')), 
'valadoc@0@.1'.format(vala_version_suffix)))
+endif
+
+install_man(manpages)
diff --git a/meson.build b/meson.build
index ba4494c51..c87a43d7a 100644
--- a/meson.build
+++ b/meson.build
@@ -5,6 +5,8 @@ project('vala',
        license: 'LGPL2.1'
 )
 
+cc = meson.get_compiler('c')
+
 vala_version = meson.project_version()
 version_array = vala_version.split('.')
 vala_api_version = '0.44'
@@ -101,14 +103,15 @@ add_project_arguments([
 glib_version_required = '2.40.0'
 libgvc_version_required = '2.16'
 
+valadoc_enabled = get_option('valadoc')
+
 glib_dep = dependency('glib-2.0', version: '>= @0@'.format(glib_version_required))
 gobject_dep = dependency('gobject-2.0', version: '>= @0@'.format(glib_version_required))
 gmodule_dep = dependency('gmodule-2.0', version: '>= @0@'.format(glib_version_required))
-libgvc_dep = dependency('libgvc', version: '>= @0@'.format(libgvc_version_required))
+libgvc_dep = dependency('libgvc', version: '>= @0@'.format(libgvc_version_required), required: 
valadoc_enabled)
 
 # Check for CGraph support of libgvc
-cc = meson.get_compiler('c')
-if cc.run('''#include <gvc.h>
+if valadoc_enabled and cc.run('''#include <gvc.h>
                int main(void) {
                #ifdef WITH_CGRAPH
                        return 0;
@@ -127,12 +130,15 @@ subdir('ccode')
 subdir('codegen')
 subdir('compiler')
 subdir('vapigen')
-subdir('libvaladoc')
-subdir('valadoc')
 subdir('vapi')
 subdir('doc')
 subdir('tests')
 
+if valadoc_enabled
+       subdir('libvaladoc')
+       subdir('valadoc')
+endif
+
 install_data('vala.m4', install_dir: join_paths('share', 'aclocal'))
 
 pycat = find_program(join_paths(meson.source_root(), 'build-aux', 'meson', 'cat.py'))
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 000000000..af3596ced
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,9 @@
+# Optional dependencies
+option('valadoc', type: 'boolean', value : 'true',
+  description : 'Enable build of libvaladoc and valadoc')
+
+# Documentation
+option('documentation', type: 'boolean', value: 'false',
+  description : 'Build API reference and tools documentation')
+option('man-pages', type: 'boolean', value: 'false',
+  description : 'Build man pages for installed tools')


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