[gtk+] meson: Generate man pages for the installed tools



commit db2c80d9dbac0b985ed79a895284d129731d16df
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri May 5 11:34:05 2017 +0100

    meson: Generate man pages for the installed tools

 docs/reference/gtk/meson.build |   47 ++++++++++++++++++++++++++++++++++++++++
 meson_options.txt              |    2 +
 2 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/meson.build b/docs/reference/gtk/meson.build
index c762cef..4371f01 100644
--- a/docs/reference/gtk/meson.build
+++ b/docs/reference/gtk/meson.build
@@ -45,3 +45,50 @@ gnome.gtkdoc('gtk4',
              ],
              html_assets: images,
              install: true)
+
+xsltproc = find_program('xsltproc', required: false)
+if get_option('enable-man-pages') and not xsltproc.found()
+  error('No xsltproc found, but man pages were explicitly enabled')
+endif
+
+if get_option('enable-man-pages') 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', '0',
+    '--stringparam', 'man.copyright.section.enabled', '0',
+  ]
+
+  man_files = [
+    [ 'gtk4-broadwayd', '1', ],
+    [ 'gtk4-builder-tool', '1', ],
+    [ 'gtk4-demo', '1', ],
+    [ 'gtk4-demo-application', '1', ],
+    [ 'gtk4-encode-symbolic-svg', '1', ],
+    [ 'gtk4-icon-browser', '1', ],
+    [ 'gtk4-launch', '1', ],
+    [ 'gtk4-query-immodules', '1', ],
+    [ 'gtk4-query-settings', '1', ],
+    [ 'gtk4-update-icon-cache', '1', ],
+    [ 'gtk4-widget-factory', '1', ],
+  ]
+
+  foreach man: man_files
+    man_name = man.get(0)
+    man_section = man.get(1, '1')
+    custom_target('@0@.@1@'.format(man_name, man_section),
+                  input: '@0@.xml'.format(man_name),
+                  output: '@0@.@1@'.format(man_name, man_section),
+                  command: [
+                    xsltproc,
+                    xlstproc_flags,
+                    '-o', '@OUTPUT@',
+                    'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+                    '@INPUT@',
+                  ],
+                  install: true,
+                  install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)))
+  endforeach
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 55ea538..518cecf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -30,3 +30,5 @@ option('with-included-immodules', type: 'string', value : '',
   description : 'Build the specified input methods into gtk (comma-separated list or "all" or "none")')
 option('enable-documentation', type: 'boolean', value: 'false',
   description : 'Build API reference and tools documentation')
+option('enable-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]