meson: Convert common options to feature options
authorNirbheek Chauhan <nirbheek@centricular.com>
Wed, 25 Jul 2018 11:57:03 +0000 (17:27 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Fri, 27 Jul 2018 13:19:13 +0000 (18:49 +0530)
The rest will be converted later, these are necessary for gst-build to
set options correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=795107

meson.build
meson_options.txt
validate/docs/validate/meson.build
validate/meson.build

index 230799b..60f24ec 100644 (file)
@@ -1,6 +1,6 @@
 project('gst-devtools', 'c',
   version : '1.15.0.1',
-  meson_version : '>= 0.46.0',
+  meson_version : '>= 0.47',
   default_options : [ 'warning_level=1',
                       'c_std=gnu99',
                       'buildtype=debugoptimized' ])
@@ -88,12 +88,10 @@ gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' +
     'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
     'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
     'gst_init(NULL,NULL);' ]
-gir = find_program('g-ir-scanner', required : false)
-build_gir = gir.found() and not meson.is_cross_build() and get_option('introspection')
+gir = find_program('g-ir-scanner', required : get_option('introspection'))
+build_gir = gir.found() and not meson.is_cross_build()
 gnome = import('gnome')
 
-gtkdoc = find_program('gtkdoc-scan', required : false)
-
 if gst_dep.type_name() == 'internal'
   gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
 else
index 0b65811..f8228a2 100644 (file)
@@ -2,7 +2,7 @@ option('validate', type : 'boolean', value : true,
        description : 'Build GstValidate')
 option('debug_viewer', type : 'boolean', value : true,
         description : 'Build GstDebugViewer')
-option('introspection', type : 'boolean', value : true, yield : true,
-        description : 'Generate gobject-introspection bindings')
-option('gtk_doc', type : 'boolean', value : true, yield : true,
-        description : 'Generate API documentation with gtk-doc')
+option('gtk_doc', type : 'feature', value : 'auto', yield : true,
+       description : 'Build API documentation with gtk-doc')
+option('introspection', type : 'feature', value : 'auto', yield : true,
+       description : 'Generate gobject-introspection bindings')
index 451bec6..9f8cc4d 100644 (file)
@@ -1,6 +1,6 @@
 types = configure_file(input : 'gst-validate.types',
   output : 'gst-validate.types',
-  configuration : configuration_data())
+  copy: true)
 
 doc_deps_names = ['glib-2.0',
                   'gstreamer-@0@'.format(apiversion),
@@ -8,6 +8,7 @@ doc_deps_names = ['glib-2.0',
 
 doc_deps = []
 foreach doc_dep : doc_deps_names
+    # FIXME: use get_pkgconfig_variable() instead
     runcmd = run_command('pkg-config', '--variable=prefix', doc_dep)
     if runcmd.returncode() == 0
         tmp = '--extra-dir=' + runcmd.stdout().strip() + '/share/gtk-doc/html/'
@@ -16,18 +17,16 @@ foreach doc_dep : doc_deps_names
     endif
 endforeach
 
-if gtkdoc.found()
-  gnome.gtkdoc('gst-validate',
-    main_sgml : 'gst-validate-docs.sgml',
-    src_dir : '@0@/../../gst/validate'.format(meson.current_source_dir()),
-    scan_args : ['--deprecated-guards=GST_DISABLE_DEPRECATED',
-                '--ignore-decorators=GST_VALIDATE_API',
-                '--ignore-headers=gettext.h gst-validate-internal.h gst-validate-monitor.h gst-validate-bin-monitor.h gst-validate-element-monitor.h gst-validate-pad-monitor.h gst-validate-override.h gst-validate-override-registry.h gst-validate-utils.h gst-validate-media-info.h  gst-validate-report.h  media-descriptor.h media-descriptor-parser.h media-descriptor-writer.h gst-validate-i18n-lib.h'
-            ],
-    scanobjs_args : ['--type-init-func="gst_init(NULL,NULL)"'],
-    gobject_typesfile : types,
-    dependencies : [validate_dep],
-    content_files : ['gst-validate.xml', 'gst-validate-transcoding.xml', 'gst-validate-media-check.xml', 'gst-validate-launcher.xml', 'envvariables.xml', 'scenarios.xml'],
-    fixxref_args: doc_deps + ['--html-dir=' + get_option('prefix') + '/share/gtk-doc/html/'],
-    install : true)
-endif
+gnome.gtkdoc('gst-validate',
+  main_sgml : 'gst-validate-docs.sgml',
+  src_dir : '@0@/../../gst/validate'.format(meson.current_source_dir()),
+  scan_args : ['--deprecated-guards=GST_DISABLE_DEPRECATED',
+              '--ignore-decorators=GST_VALIDATE_API',
+              '--ignore-headers=gettext.h gst-validate-internal.h gst-validate-monitor.h gst-validate-bin-monitor.h gst-validate-element-monitor.h gst-validate-pad-monitor.h gst-validate-override.h gst-validate-override-registry.h gst-validate-utils.h gst-validate-media-info.h  gst-validate-report.h  media-descriptor.h media-descriptor-parser.h media-descriptor-writer.h gst-validate-i18n-lib.h'
+          ],
+  scanobjs_args : ['--type-init-func="gst_init(NULL,NULL)"'],
+  gobject_typesfile : types,
+  dependencies : [validate_dep],
+  content_files : ['gst-validate.xml', 'gst-validate-transcoding.xml', 'gst-validate-media-check.xml', 'gst-validate-launcher.xml', 'envvariables.xml', 'scenarios.xml'],
+  fixxref_args: doc_deps + ['--html-dir=' + get_option('prefix') + '/share/gtk-doc/html/'],
+  install : true)
index c3ea9c4..f9c574b 100644 (file)
@@ -27,10 +27,9 @@ subdir('launcher')
 subdir('tools')
 if build_machine.system() == 'windows'
   message('Disabling gtk-doc while building on Windows')
-elif not get_option('gtk_doc')
-  message('gtk-doc is disabled via options')
 else
-  if find_program('gtkdoc-scan', required : false).found()
+  gtkdoc = find_program('gtkdoc-scan', required : get_option('gtk_doc'))
+  if gtkdoc.found()
     subdir('docs')
   else
     message('Not building documentation as gtk-doc was not found')