[gtk-vnc] build-sys: build API docs with gi-docgen



commit f088f6b8b6c571d8b5cf4944a03fce285ae2edaa
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Tue Sep 6 16:51:35 2022 +0400

    build-sys: build API docs with gi-docgen
    
    gtk-doc is being phased out, as unmaintained.
    
    Despite some current limitations or annoyances, gi-docgen is what
    Glib/Gtk+ is using these days, so follow along.
    
    I didn't include gvncpulse, it should be trivial to add if necessary...
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 docs/gtk-vnc/gtk-vnc.toml.in | 40 ++++++++++++++++++++++++++++++++++++++++
 docs/gtk-vnc/meson.build     | 29 +++++++++++++++++++++++++++++
 docs/gtk-vnc/urlmap.js       | 11 +++++++++++
 docs/gvnc/gvnc.toml.in       | 35 +++++++++++++++++++++++++++++++++++
 docs/gvnc/meson.build        | 29 +++++++++++++++++++++++++++++
 docs/gvnc/urlmap.js          | 11 +++++++++++
 docs/meson.build             | 17 +++++++++++++++++
 meson.build                  |  1 +
 meson_options.txt            |  1 +
 9 files changed, 174 insertions(+)
---
diff --git a/docs/gtk-vnc/gtk-vnc.toml.in b/docs/gtk-vnc/gtk-vnc.toml.in
new file mode 100644
index 0000000..5212b03
--- /dev/null
+++ b/docs/gtk-vnc/gtk-vnc.toml.in
@@ -0,0 +1,40 @@
+[library]
+version = "@version@"
+browse_url = "https://gitlab.gnome.org/GNOME/gtk-vnc/";
+repository_url = "https://gitlab.gnome.org/GNOME/gtk-vnc.git";
+website_url = "https://wiki.gnome.org/Projects/gtk-vnc";
+#docs_url = "https://docs.gtk.org/gtk4/";
+authors = "GTK-VNC Development Team"
+#logo_url = "gtk-logo.svg"
+license = "LGPL-2.1-or-later"
+description = "A VNC client viewer widget for GTK"
+devhelp = true
+search_index = true
+
+related = ["GObject-2.0", "Gio-2.0", "Gtk-3.0"]
+
+  [related."Gtk-3.0"]
+  name = "Gtk+ 3.0"
+  description = "The Gtk+ toolkit"
+  docs_url = "https://docs.gtk.org/gtk3/";
+
+  [related."GObject-2.0"]
+  name = "GObject"
+  description = "The base type system library"
+  docs_url = "https://docs.gtk.org/gobject/";
+
+  [related."Gio-2.0"]
+  name = "GIO"
+  description = "GObject Interfaces and Objects, Networking, IPC, and I/O"
+  docs_url = "https://docs.gtk.org/gio/";
+
+[theme]
+name = "basic"
+show_index_summary = true
+show_class_hierarchy = true
+
+[source-location]
+base_url = "https://gitlab.gnome.org/GNOME/gtk-vnc/-/blob/master/";
+
+[extra]
+urlmap_file = "urlmap.js"
diff --git a/docs/gtk-vnc/meson.build b/docs/gtk-vnc/meson.build
new file mode 100644
index 0000000..6445165
--- /dev/null
+++ b/docs/gtk-vnc/meson.build
@@ -0,0 +1,29 @@
+toml = configure_file(
+  input: 'gtk-vnc.toml.in',
+  output: 'gtk-vnc.toml',
+  configuration: toml_conf,
+  install: true,
+  install_dir: docs_dir,
+)
+
+custom_target('gtk-vnc-doc',
+  input: [ toml, gtk_vnc_gir[0] ],
+  output: 'gtk-vnc',
+  command: [
+    gidocgen,
+    'generate',
+    '--quiet',
+    '--no-namespace-dir',
+    '--add-include-path=@0@'.format(meson.project_build_root() / 'src'),
+    '--config=@INPUT0@',
+    '--output-dir=@OUTPUT@',
+    '--content-dir=@0@'.format(meson.current_build_dir()),
+    '--content-dir=@0@'.format(meson.current_source_dir()),
+    '@INPUT1@',
+  ],
+  depends: [],
+  depend_files: [],
+  build_by_default: true,
+  install: true,
+  install_dir: docs_dir,
+)
diff --git a/docs/gtk-vnc/urlmap.js b/docs/gtk-vnc/urlmap.js
new file mode 100644
index 0000000..9cbaaf2
--- /dev/null
+++ b/docs/gtk-vnc/urlmap.js
@@ -0,0 +1,11 @@
+// SPDX-FileCopyrightText: 2021 GNOME Foundation
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+// A map between namespaces and base URLs for their online documentation
+baseURLs = [
+    [ 'GLib', 'https://docs.gtk.org/glib/' ],
+    [ 'GObject', 'https://docs.gtk.org/gobject/' ],
+    [ 'Gio', 'https://docs.gtk.org/gio/' ],
+    [ 'Gdk', 'https://docs.gtk.org/gdk3/' ],
+    [ 'Gtk', 'https://docs.gtk.org/gtk3/' ],
+]
diff --git a/docs/gvnc/gvnc.toml.in b/docs/gvnc/gvnc.toml.in
new file mode 100644
index 0000000..fd6eb67
--- /dev/null
+++ b/docs/gvnc/gvnc.toml.in
@@ -0,0 +1,35 @@
+[library]
+version = "@version@"
+browse_url = "https://gitlab.gnome.org/GNOME/gtk-vnc/";
+repository_url = "https://gitlab.gnome.org/GNOME/gtk-vnc.git";
+website_url = "https://wiki.gnome.org/Projects/gtk-vnc";
+#docs_url = "https://docs.gtk.org/gtk4/";
+authors = "GTK-VNC Development Team"
+#logo_url = "gtk-logo.svg"
+license = "LGPL-2.1-or-later"
+description = "A VNC client viewer widget for GTK"
+devhelp = true
+search_index = true
+
+related = ["GObject-2.0", "Gio-2.0"]
+
+  [related."GObject-2.0"]
+  name = "GObject"
+  description = "The base type system library"
+  docs_url = "https://docs.gtk.org/gobject/";
+
+  [related."Gio-2.0"]
+  name = "GIO"
+  description = "GObject Interfaces and Objects, Networking, IPC, and I/O"
+  docs_url = "https://docs.gtk.org/gio/";
+
+[theme]
+name = "basic"
+show_index_summary = true
+show_class_hierarchy = true
+
+[source-location]
+base_url = "https://gitlab.gnome.org/GNOME/gtk-vnc/-/blob/master/";
+
+[extra]
+urlmap_file = "urlmap.js"
diff --git a/docs/gvnc/meson.build b/docs/gvnc/meson.build
new file mode 100644
index 0000000..61675ae
--- /dev/null
+++ b/docs/gvnc/meson.build
@@ -0,0 +1,29 @@
+toml = configure_file(
+  input: 'gvnc.toml.in',
+  output: 'gvnc.toml',
+  configuration: toml_conf,
+  install: true,
+  install_dir: docs_dir,
+)
+
+custom_target('gvnc-doc',
+  input: [ toml, gvnc_gir[0] ],
+  output: 'gvnc',
+  command: [
+    gidocgen,
+    'generate',
+    '--quiet',
+    '--no-namespace-dir',
+    '--add-include-path=@0@'.format(meson.project_build_root() / 'src'),
+    '--config=@INPUT0@',
+    '--output-dir=@OUTPUT@',
+    '--content-dir=@0@'.format(meson.current_build_dir()),
+    '--content-dir=@0@'.format(meson.current_source_dir()),
+    '@INPUT1@',
+  ],
+  depends: [],
+  depend_files: [],
+  build_by_default: true,
+  install: true,
+  install_dir: docs_dir,
+)
diff --git a/docs/gvnc/urlmap.js b/docs/gvnc/urlmap.js
new file mode 100644
index 0000000..9cbaaf2
--- /dev/null
+++ b/docs/gvnc/urlmap.js
@@ -0,0 +1,11 @@
+// SPDX-FileCopyrightText: 2021 GNOME Foundation
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+// A map between namespaces and base URLs for their online documentation
+baseURLs = [
+    [ 'GLib', 'https://docs.gtk.org/glib/' ],
+    [ 'GObject', 'https://docs.gtk.org/gobject/' ],
+    [ 'Gio', 'https://docs.gtk.org/gio/' ],
+    [ 'Gdk', 'https://docs.gtk.org/gdk3/' ],
+    [ 'Gtk', 'https://docs.gtk.org/gtk3/' ],
+]
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..4c19dbe
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,17 @@
+toml_conf = configuration_data()
+toml_conf.set('version', meson.project_version())
+
+gidocgen = find_program('gi-docgen', required: get_option('gi-docs'))
+if not gidocgen.found()
+  subdir_done()
+endif
+
+
+if not with_gir
+  error('API reference requires introspection.')
+endif
+
+docs_dir = gtk_vnc_datadir / 'doc'
+
+subdir('gvnc')
+subdir('gtk-vnc')
diff --git a/meson.build b/meson.build
index 925f241..40373ab 100644
--- a/meson.build
+++ b/meson.build
@@ -333,6 +333,7 @@ subdir('src')
 subdir('tools')
 subdir('examples')
 subdir('po')
+subdir('docs')
 
 pkgdata = configuration_data()
 pkgdata.set('prefix', gtk_vnc_prefix)
diff --git a/meson_options.txt b/meson_options.txt
index 6dd4c45..318479b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,3 +4,4 @@ option('sasl', type: 'feature', value: 'auto', description: 'Build with SASL sup
 option('with-coroutine', type: 'string', value: 'auto', description: 'Build with coroutine backend: [auto, 
ucontext, gthread]')
 option('with-tls-priority', type: 'string', value: 'NORMAL', description: 'Set default TLS priority string')
 option('with-vala', type: 'feature', value: 'auto', description: 'Enable Vala bindings')
+option('gi-docs', type: 'feature', value: 'auto', description: 'Build API reference')


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