[retro-gtk/build-doc: 7/8] Allow building and installing the reference manual



commit 7f52c9358e0fe64bd691eecca334cb722662d5bb
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Apr 12 21:24:33 2020 +0200

    Allow building and installing the reference manual
    
    This adds the build-doc and install-doc build options to build and
    install the GTK-Doc reference manual.

 doc/meson.build               | 43 +++++++++++++++++++++++
 doc/retro-gtk-doc.xml         | 79 +++++++++++++++++++++++++++++++++++++++++++
 doc/xml/gtkdocentities.ent.in |  9 +++++
 doc/xml/meson.build           | 12 +++++++
 meson.build                   | 17 ++++++----
 meson_options.txt             |  4 +++
 6 files changed, 158 insertions(+), 6 deletions(-)
---
diff --git a/doc/meson.build b/doc/meson.build
new file mode 100644
index 0000000..a31f67b
--- /dev/null
+++ b/doc/meson.build
@@ -0,0 +1,43 @@
+subdir('xml')
+
+glib_docpath = glib.get_pkgconfig_variable('prefix') / 'share' / 'gtk-doc' / 'html'
+gtk_docpath = gtk.get_pkgconfig_variable('prefix') / 'share' / 'gtk-doc' / 'html'
+docpath = get_option('datadir') / 'gtk-doc' / 'html'
+
+private_headers = [
+]
+
+content_files = [
+]
+
+gnome.gtkdoc(
+  'retro-gtk',
+  main_xml: 'retro-gtk-doc.xml',
+  src_dir: [
+    meson.source_root() / 'retro-gtk',
+    meson.build_root()  / 'retro-gtk',
+    meson.source_root() / 'shared',
+    meson.build_root()  / 'shared',
+  ],
+  dependencies: retro_gtk_dep,
+  gobject_typesfile: 'retro-gtk.types',
+  scan_args: [
+    '--rebuild-types',
+    '--ignore-headers=' + ' '.join(private_headers),
+  ],
+  mkdb_args: [
+    '--default-includes=retro-gtk/retro-gtk.h',
+  ],
+  fixxref_args: [
+    '--html-dir=@0@'.format(docpath),
+    '--extra-dir=@0@'.format(glib_docpath / 'glib'),
+    '--extra-dir=@0@'.format(glib_docpath / 'gobject'),
+    '--extra-dir=@0@'.format(glib_docpath / 'gio'),
+    '--extra-dir=@0@'.format(glib_docpath / 'gi'),
+    '--extra-dir=@0@'.format(gtk_docpath / 'gtk3'),
+    '--extra-dir=@0@'.format(gtk_docpath / 'gdk-pixbuf'),
+  ],
+  install_dir: 'retro-gtk',
+  content_files: content_files,
+  install: get_option('install-doc'),
+)
diff --git a/doc/retro-gtk-doc.xml b/doc/retro-gtk-doc.xml
new file mode 100644
index 0000000..79a666d
--- /dev/null
+++ b/doc/retro-gtk-doc.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd";
+[
+  <!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
+  <!ENTITY % gtkdocentities SYSTEM "xml/gtkdocentities.ent">
+  %gtkdocentities;
+]>
+<book id="index">
+  <bookinfo>
+    <title>&package_name; Reference Manual</title>
+    <releaseinfo>
+      <para>This document is the API reference for &package_name; &package_version;.</para>
+      <para>
+        <ulink type="http" url="&package_url;">RetroGTK</ulink> is a
+        <ulink type="http" url="https://www.libretro.com/";>Libretro</ulink>
+        frontend as a library.
+      </para>
+      <para>
+        If you find any issues in this API reference, please report it using
+        <ulink type="http" url="&package_bugreport;">the bugtracker</ulink>.
+      </para>
+    </releaseinfo>
+
+    <copyright>
+      <year>2014-2020</year>
+      <holder>Adrien Plazas</holder>
+    </copyright>
+  </bookinfo>
+
+  <chapter id="core-api">
+    <title>Widgets and Objects</title>
+    <xi:include href="xml/retro-controller-codes.xml"/>
+    <xi:include href="xml/retro-controller-iterator.xml"/>
+    <xi:include href="xml/retro-controller-type.xml"/>
+    <xi:include href="xml/retro-controller.xml"/>
+    <xi:include href="xml/retro-core-descriptor.xml"/>
+    <xi:include href="xml/retro-core-view.xml"/>
+    <xi:include href="xml/retro-core.xml"/>
+    <xi:include href="xml/retro-input.xml"/>
+    <xi:include href="xml/retro-key-joypad-mapping.xml"/>
+    <xi:include href="xml/retro-log.xml"/>
+    <xi:include href="xml/retro-memory-type.xml"/>
+    <xi:include href="xml/retro-module-iterator.xml"/>
+    <xi:include href="xml/retro-module-query.xml"/>
+    <xi:include href="xml/retro-option-iterator.xml"/>
+    <xi:include href="xml/retro-option.xml"/>
+    <xi:include href="xml/retro-pixbuf.xml"/>
+    <xi:include href="xml/retro-pixdata.xml"/>
+    <xi:include href="xml/retro-rumble-effect.xml"/>
+    <xi:include href="xml/retro-video-filter.xml"/>
+  </chapter>
+
+  <chapter id="helpers">
+    <title>Helpers</title>
+    <xi:include href="xml/retro-gtk-version.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>
+
+  <index id="annotations-glossary">
+  <title>Annotations glossary</title>
+  <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+  </index>
+
+</book>
diff --git a/doc/xml/gtkdocentities.ent.in b/doc/xml/gtkdocentities.ent.in
new file mode 100644
index 0000000..45d322c
--- /dev/null
+++ b/doc/xml/gtkdocentities.ent.in
@@ -0,0 +1,9 @@
+<!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@">
+<!ENTITY package_ver_str "@PACKAGE_API_NAME@">
diff --git a/doc/xml/meson.build b/doc/xml/meson.build
new file mode 100644
index 0000000..78bc2bc
--- /dev/null
+++ b/doc/xml/meson.build
@@ -0,0 +1,12 @@
+ent_conf = configuration_data()
+ent_conf.set('PACKAGE', 'retro-gtk')
+ent_conf.set('PACKAGE_BUGREPORT', 'https://gitlab.gnome.org/GNOME/retro-gtk/issues')
+ent_conf.set('PACKAGE_NAME', 'retro-gtk')
+ent_conf.set('PACKAGE_STRING', 'retro-gtk')
+ent_conf.set('PACKAGE_TARNAME', 'retro-gtk-' + retro_gtk_version)
+ent_conf.set('PACKAGE_URL', 'https://gitlab.gnome.org/GNOME/retro-gtk')
+ent_conf.set('PACKAGE_VERSION', retro_gtk_version)
+ent_conf.set('PACKAGE_API_VERSION', retro_gtk_api_version)
+ent_conf.set('PACKAGE_API_NAME', retro_gtk_module)
+configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
+
diff --git a/meson.build b/meson.build
index 58db859..aafcd78 100644
--- a/meson.build
+++ b/meson.build
@@ -50,6 +50,9 @@ subdir('retro-gtk')
 if get_option('build-tests')
   subdir('tests')
 endif
+if get_option('build-doc')
+  subdir('doc')
+endif
 if get_option('demos')
   subdir('demos')
 endif
@@ -59,13 +62,15 @@ summary = [
   '------',
   'retro-gtk @0@ (@1@)'.format(retro_gtk_version, retro_gtk_api_version),
   '',
-  '     Introspection: @0@'.format(get_option('introspection')),
-  '       Build tests: @0@'.format(get_option('build-tests')),
-  '     Install tests: @0@'.format(get_option('install-tests')),
-  '             Demos: @0@'.format(get_option('demos')),
+  '           Introspection: @0@'.format(get_option('introspection')),
+  '             Build tests: @0@'.format(get_option('build-tests')),
+  '           Install tests: @0@'.format(get_option('install-tests')),
+  '     Build documentation: @0@'.format(get_option('build-doc')),
+  '   Install documentation: @0@'.format(get_option('install-doc')),
+  '                   Demos: @0@'.format(get_option('demos')),
   'Directories:',
-  '            prefix: @0@'.format(retro_gtk_prefix),
-  '           datadir: @0@'.format(retro_gtk_datadir),
+  '                  prefix: @0@'.format(retro_gtk_prefix),
+  '                 datadir: @0@'.format(retro_gtk_datadir),
   '------',
   ''
 ]
diff --git a/meson_options.txt b/meson_options.txt
index de6899b..c6fbfbb 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -13,4 +13,8 @@ option('build-tests', type: 'boolean', value: 'true',
   description : 'Build tests')
 option('install-tests', type: 'boolean', value: 'false',
   description : 'Install tests')
+option('build-doc', type: 'boolean', value: 'false',
+  description : 'Build API reference documentation')
+option('install-doc', type: 'boolean', value: 'false',
+  description : 'Install API reference documentation')
 


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