[template-glib] build: enable gtk-doc based documentation



commit 33479445cf9008884c5e130b8b6ecfb0910fdcda
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jun 2 17:56:35 2017 -0700

    build: enable gtk-doc based documentation
    
    It isn't really good, but we should at least start generating it and
    iterate from there.

 doc/meson.build               |   54 +++++++++++++++++++++++++++++++++++++++++
 doc/template-glib-docs.sgml   |   28 ++++-----------------
 doc/xml/gtkdocentities.ent.in |    8 ++++++
 doc/xml/meson.build           |   11 ++++++++
 meson.build                   |    1 +
 meson_options.txt             |    3 ++
 src/meson.build               |    8 +++---
 7 files changed, 86 insertions(+), 27 deletions(-)
---
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..6ccf7d6
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,54 @@
+subdir('xml')
+
+private_headers = [
+  'config.h',
+
+  'tmpl-enums.h',
+  'tmpl-branch-node.h',
+  'tmpl-condition-node.h',
+  'tmpl-debug.h',
+  'tmpl-expr-node.h',
+  'tmpl-expr-parser-private.h',
+  'tmpl-expr-parser.h',
+  'tmpl-expr-private.h',
+  'tmpl-expr-scanner.h',
+  'tmpl-gi-private.h',
+  'tmpl-glib.h',
+  'tmpl-iter-node.h',
+  'tmpl-iterator.h',
+  'tmpl-lexer.h',
+  'tmpl-node.h',
+  'tmpl-parser.h',
+  'tmpl-text-node.h',
+  'tmpl-token-input-stream.h',
+  'tmpl-token.h',
+  'tmpl-util-private.h',
+]
+
+glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
+glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
+
+gnome.gtkdoc('template-glib',
+           main_xml: 'template-glib-docs.sgml',
+            src_dir: [
+              join_paths(meson.source_root(), 'src'),
+              join_paths(meson.build_root(), 'src'),
+            ],
+
+       dependencies: libtemplate_glib_dep,
+  gobject_typesfile: 'template-glib.types',
+          scan_args: [
+            '--rebuild-types',
+            '--ignore-decorators=_TMPL_EXTERN',
+            '--ignore-headers=' + ' '.join(private_headers),
+          ],
+
+       fixxref_args: [
+         '--html-dir=@0@'.format(docpath),
+         '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
+         '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
+         '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
+       ],
+            install: true)
+
diff --git a/doc/template-glib-docs.sgml b/doc/template-glib-docs.sgml
index 6399b47..ddaca61 100644
--- a/doc/template-glib-docs.sgml
+++ b/doc/template-glib-docs.sgml
@@ -17,46 +17,28 @@
   </bookinfo>
 
   <chapter>
-    <title>[Insert title here]</title>
-        <xi:include href="xml/tmpl-branch-node.xml"/>
-    <xi:include href="xml/tmpl-condition-node.xml"/>
-    <xi:include href="xml/tmpl-debug.xml"/>
-    <xi:include href="xml/tmpl-enums.xml"/>
+    <title>Template-GLib API Reference</title>
     <xi:include href="xml/tmpl-error.xml"/>
-    <xi:include href="xml/tmpl-expr.xml"/>
-    <xi:include href="xml/tmpl-expr-node.xml"/>
-    <xi:include href="xml/tmpl-expr-parser.xml"/>
-    <xi:include href="xml/tmpl-expr-parser-private.xml"/>
-    <xi:include href="xml/tmpl-expr-private.xml"/>
-    <xi:include href="xml/tmpl-expr-scanner.xml"/>
-    <xi:include href="xml/tmpl-expr-types.xml"/>
-    <xi:include href="xml/tmpl-gi-private.xml"/>
-    <xi:include href="xml/tmpl-iter-node.xml"/>
-    <xi:include href="xml/tmpl-iterator.xml"/>
-    <xi:include href="xml/tmpl-lexer.xml"/>
-    <xi:include href="xml/tmpl-node.xml"/>
-    <xi:include href="xml/tmpl-parser.xml"/>
     <xi:include href="xml/tmpl-scope.xml"/>
     <xi:include href="xml/tmpl-symbol.xml"/>
     <xi:include href="xml/tmpl-template.xml"/>
     <xi:include href="xml/tmpl-template-locator.xml"/>
-    <xi:include href="xml/tmpl-text-node.xml"/>
-    <xi:include href="xml/tmpl-token.xml"/>
-    <xi:include href="xml/tmpl-token-input-stream.xml"/>
-    <xi:include href="xml/tmpl-util-private.xml"/>
-
   </chapter>
+
   <chapter id="object-tree">
     <title>Object Hierarchy</title>
     <xi:include href="xml/tree_index.sgml"/>
   </chapter>
+
   <index id="api-index-full">
     <title>API Index</title>
     <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
   </index>
+
   <index id="deprecated-api-index" role="deprecated">
     <title>Index of deprecated API</title>
     <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
   </index>
+
   <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
 </book>
diff --git a/doc/xml/gtkdocentities.ent.in b/doc/xml/gtkdocentities.ent.in
new file mode 100644
index 0000000..f12c9ff
--- /dev/null
+++ b/doc/xml/gtkdocentities.ent.in
@@ -0,0 +1,8 @@
+<!ENTITY package "@PACKAGE@">
+<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
+<!ENTITY package_name "@PACKAGE_NAME@">
+<!ENTITY package_string "@PACKAGE_STRING@">
+<!ENTITY package_tarname "@PACKAGE_TARNAME@">
+<!ENTITY package_url "@PACKAGE_URL@">
+<!ENTITY package_version "@PACKAGE_VERSION@">
+<!ENTITY package_api_version "@PACKAGE_API_VERSION@">
diff --git a/doc/xml/meson.build b/doc/xml/meson.build
new file mode 100644
index 0000000..0ab9a0a
--- /dev/null
+++ b/doc/xml/meson.build
@@ -0,0 +1,11 @@
+ent_conf = configuration_data()
+ent_conf.set('PACKAGE', 'Template-GLib')
+ent_conf.set('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=template-glib')
+ent_conf.set('PACKAGE_NAME', 'Template-GLib')
+ent_conf.set('PACKAGE_STRING', 'template-glib')
+ent_conf.set('PACKAGE_TARNAME', 'template-glib-' + meson.project_version())
+ent_conf.set('PACKAGE_URL', 'http://wiki.gnome.org/Apps/Builder')
+ent_conf.set('PACKAGE_VERSION', meson.project_version())
+ent_conf.set('PACKAGE_API_VERSION', apiversion)
+configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
+
diff --git a/meson.build b/meson.build
index 7feffd3..2a0ae44 100644
--- a/meson.build
+++ b/meson.build
@@ -91,3 +91,4 @@ gnome = import('gnome')
 
 subdir('src')
 subdir('tests')
+subdir('doc')
diff --git a/meson_options.txt b/meson_options.txt
index 3837aff..d98cbf4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,4 +7,7 @@ option('enable_profiling', type: 'boolean', value: false)
 option('with_introspection', type: 'boolean', value: true)
 option('with_vapi', type: 'boolean', value: true)
 
+option('enable-gtk-doc',
+       type: 'boolean', value: false,
+       description: 'Whether to generate the API reference for Template-GLib')
 
diff --git a/src/meson.build b/src/meson.build
index bc3b679..1e0afd2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -85,15 +85,15 @@ tmpl_expr_parser = custom_target('tmpl-expr-parser',
 # this fails with meson which wants to output to specific directories
 # and just to avoid any regressions we don't want to modify the autotools files
 tmpl_expr_scanner_flex = custom_target('tmpl-expr-scanner-flex',
-  input: 'tmpl-expr-scanner.l',
-  output: 'tmpl-expr-meson-scanner.l',
+    input: 'tmpl-expr-scanner.l',
+   output: 'tmpl-expr-meson-scanner.l',
   capture: true,
   command: [sed, '-e', 's/^%option header-file.*$//',
                  '-e', 's/^%option outfile.*$//', '@INPUT@']
 )
 tmpl_expr_scanner = custom_target('tmpl-expr-scanner',
-  input: tmpl_expr_scanner_flex,
-  output: 'tmpl-expr-scanner.c',
+    input: tmpl_expr_scanner_flex,
+   output: 'tmpl-expr-scanner.c',
   command: [flex, '-o', '@OUTPUT@', '@INPUT@']
 )
 


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