[amtk/wip/swilmet/meson: 3/5] meson: gtk-doc




commit 96490515d32292da633ac6eb9e39be711dbe1600
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Sep 8 05:25:03 2020 +0200

    meson: gtk-doc

 docs/reference/{amtk-docs.xml.in => amtk-docs.xml} |  4 +--
 .../{amtk-intro.xml.in => amtk-intro.xml}          | 10 +++----
 .../{amtk-5.0-sections.txt => amtk-sections.txt}   |  0
 docs/reference/meson.build                         | 35 ++++++++++++++++++++++
 docs/reference/xml/gtkdocentities.ent.in           |  2 ++
 docs/reference/xml/meson.build                     | 11 +++++++
 meson.build                                        |  8 ++---
 meson_options.txt                                  |  5 ++++
 8 files changed, 64 insertions(+), 11 deletions(-)
---
diff --git a/docs/reference/amtk-docs.xml.in b/docs/reference/amtk-docs.xml
similarity index 94%
rename from docs/reference/amtk-docs.xml.in
rename to docs/reference/amtk-docs.xml
index 74362de..faf7493 100644
--- a/docs/reference/amtk-docs.xml.in
+++ b/docs/reference/amtk-docs.xml
@@ -8,8 +8,8 @@
 ]>
 <book id="index">
   <bookinfo>
-    <title>Amtk @AMTK_API_VERSION@ Reference Manual</title>
-    <releaseinfo>for Amtk &package_version;</releaseinfo>
+    <title>Amtk &package_api_version; Reference Manual</title>
+    <releaseinfo>for &package_string;</releaseinfo>
   </bookinfo>
 
   <xi:include href="amtk-intro.xml"/>
diff --git a/docs/reference/amtk-intro.xml.in b/docs/reference/amtk-intro.xml
similarity index 95%
rename from docs/reference/amtk-intro.xml.in
rename to docs/reference/amtk-intro.xml
index f9cf912..04c6629 100644
--- a/docs/reference/amtk-intro.xml.in
+++ b/docs/reference/amtk-intro.xml
@@ -149,22 +149,22 @@
 <refsect1>
   <title>GTK dependency</title>
   <para>
-    Amtk&nbsp;@AMTK_API_VERSION@ depends on GTK&nbsp;3.
+    Amtk&nbsp;&package_api_version; depends on GTK&nbsp;3.
   </para>
 </refsect1>
 
 <refsect1>
   <title>pkg-config name</title>
   <para>
-    For Amtk&nbsp;@AMTK_API_VERSION@, the pkg-config name is:
-    <code>amtk-@AMTK_API_VERSION@</code>
+    For Amtk&nbsp;&package_api_version;, the pkg-config name is:
+    <code>amtk-&package_api_version;</code>
   </para>
   <para>
-    To compile a program that uses Amtk&nbsp;@AMTK_API_VERSION@, you can for
+    To compile a program that uses Amtk&nbsp;&package_api_version;, you can for
     example use the following command:
   </para>
   <para>
-    <code>$ gcc hello.c `pkg-config --cflags --libs amtk-@AMTK_API_VERSION@` -o hello</code>
+    <code>$ gcc hello.c `pkg-config --cflags --libs amtk-&package_api_version;` -o hello</code>
   </para>
 </refsect1>
 </refentry>
diff --git a/docs/reference/amtk-5.0-sections.txt b/docs/reference/amtk-sections.txt
similarity index 100%
rename from docs/reference/amtk-5.0-sections.txt
rename to docs/reference/amtk-sections.txt
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..1db1efb
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,35 @@
+subdir('xml')
+
+configure_file(
+  input: 'amtk-sections.txt',
+  output: 'amtk-@0 -sections txt'.format(AMTK_API_VERSION),
+  copy: true
+)
+
+gtkdoc_module_name = 'amtk-@0@'.format(AMTK_API_VERSION)
+html_dir = get_option('prefix') / GNOME.gtkdoc_html_dir(gtkdoc_module_name)
+
+glib_docpath = dependency('glib-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/glib'
+gobject_docpath = dependency('gobject-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gobject'
+gio_docpath = dependency('gio-2.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gio'
+gtk_docpath = dependency('gtk+-3.0').get_pkgconfig_variable('prefix') / 'share/gtk-doc/html/gtk3'
+
+GNOME.gtkdoc(
+  gtkdoc_module_name,
+  main_xml: 'amtk-docs.xml',
+  src_dir: include_directories('../../amtk/'),
+  dependencies: AMTK_LIB_DEP,
+  scan_args: ['--rebuild-types'],
+  gobject_typesfile: 'amtk-@0@.types'.format(AMTK_API_VERSION),
+  fixxref_args: [
+    '--html-dir=@0@'.format(html_dir),
+    '--extra-dir=@0@'.format(glib_docpath),
+    '--extra-dir=@0@'.format(gobject_docpath),
+    '--extra-dir=@0@'.format(gio_docpath),
+    '--extra-dir=@0@'.format(gtk_docpath)
+  ],
+  content_files: [
+    'amtk-intro.xml',
+  ],
+  install: true
+)
diff --git a/docs/reference/xml/gtkdocentities.ent.in b/docs/reference/xml/gtkdocentities.ent.in
new file mode 100644
index 0000000..f4aca11
--- /dev/null
+++ b/docs/reference/xml/gtkdocentities.ent.in
@@ -0,0 +1,2 @@
+<!ENTITY package_string "@PACKAGE_STRING@">
+<!ENTITY package_api_version "@PACKAGE_API_VERSION@">
diff --git a/docs/reference/xml/meson.build b/docs/reference/xml/meson.build
new file mode 100644
index 0000000..a320f4a
--- /dev/null
+++ b/docs/reference/xml/meson.build
@@ -0,0 +1,11 @@
+gtkdocentities_conf_data = configuration_data()
+gtkdocentities_conf_data.set('PACKAGE_STRING', 'Amtk @0@'.format(meson.project_version()))
+gtkdocentities_conf_data.set('PACKAGE_API_VERSION', AMTK_API_VERSION)
+
+gtkdocentities_filename = 'gtkdocentities.ent'
+
+configure_file(
+  input: gtkdocentities_filename + '.in',
+  output: gtkdocentities_filename,
+  configuration: gtkdocentities_conf_data
+)
diff --git a/meson.build b/meson.build
index 011d2b4..fe41367 100644
--- a/meson.build
+++ b/meson.build
@@ -138,10 +138,10 @@ subdir('amtk')
 subdir('tests')
 subdir('testsuite')
 
-#if get_option('gtk_doc')
-#  subdir('docs/reference')
-#endif
+if get_option('gtk_doc')
+  subdir('docs/reference')
+endif
 
 summary('API version', AMTK_API_VERSION)
 summary('Prefix', get_option('prefix'))
-#summary('API documentation', get_option('gtk_doc'))
+summary('API documentation', get_option('gtk_doc'))
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..cad97dd
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,5 @@
+option(
+  'gtk_doc',
+  type: 'boolean', value: false,
+  description: 'Build API reference (requires gtk-doc)'
+)


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