[json-glib] Generate the man pages for json-glib tools in Meson



commit a5778e2cf38ea81710cd47d5284e0c6ae8356ad3
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Mar 13 12:20:02 2017 +0000

    Generate the man pages for json-glib tools in Meson
    
    A simple case of calling xsltproc with the right doctype.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773603

 doc/reference/meson.build |   32 ++++++++++++++++++++++++++++++++
 meson.build               |    1 +
 meson_options.txt         |    3 +++
 3 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index 95a7860..0aaa709 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -32,3 +32,35 @@ gnome.gtkdoc('json-glib',
                '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
              ],
              install: true)
+
+xsltproc = find_program('xsltproc', required: false)
+if get_option('enable-man') and xsltproc.found()
+  xlstproc_flags = [
+    '--nonet',
+    '--stringparam', 'man.output.quietly', '1',
+    '--stringparam', 'funcsynopsis.style', 'ansi',
+    '--stringparam', 'man.th.extra1.suppress', '1',
+    '--stringparam', 'man.authors.section.enabled', '1',
+    '--stringparam', 'man.copyright.section.enabled', '1',
+  ]
+
+  man_files = [
+    'json-glib-format',
+    'json-glib-validate',
+  ]
+
+  foreach m: man_files
+    custom_target(m + ' man page',
+                  input: '@0@.xml'.format(m),
+                  output: '@0@.1'.format(m),
+                  command: [
+                    xsltproc,
+                    xlstproc_flags,
+                    '-o', '@OUTPUT@',
+                    'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+                    '@INPUT@',
+                  ],
+                  install: true,
+                  install_dir: join_paths(json_mandir, 'man1'))
+  endforeach
+endif
diff --git a/meson.build b/meson.build
index 4ae49d3..c155e81 100644
--- a/meson.build
+++ b/meson.build
@@ -34,6 +34,7 @@ libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
 # Paths
 json_includedir = join_paths(get_option('prefix'), get_option('includedir'))
 json_datadir = join_paths(get_option('prefix'), get_option('datadir'))
+json_mandir = join_paths(get_option('prefix'), get_option('mandir'))
 
 # Dependencies
 glib_req_version = '>= 2.37.6'
diff --git a/meson_options.txt b/meson_options.txt
index 7b04911..4dc2a01 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,3 +4,6 @@ option('disable_introspection',
 option('enable-gtk-doc',
        type: 'boolean', value: false,
        description: 'Whether to generate the API reference for JSON-GLib')
+option('enable-man',
+       type: 'boolean', value: false,
+       description: 'Whether to generate the man pages for JSON-GLib tools')


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