[eog: 1/2] doc: migrate to gi-docgen




commit be53446eb1b0eb9b2b084826f700e05624bacb1b
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Jan 19 14:01:27 2022 +0100

    doc: migrate to gi-docgen
    
    gi-docgen is a new tool that tries to avoid some of the issues of
    gtk-doc and is also faster.

 doc/reference/eog-docs.xml     |  83 -----
 doc/reference/eog-docs.xml.in  |  85 -----
 doc/reference/eog-sections.txt | 728 -----------------------------------------
 doc/reference/eog.toml.in      |  57 ++++
 doc/reference/meson.build      |  59 ++--
 doc/reference/urlmap.js        |  13 +
 doc/reference/version.xml.in   |   1 -
 meson.build                    |   1 +
 meson_options.txt              |   2 +-
 src/meson.build                |   2 +-
 10 files changed, 99 insertions(+), 932 deletions(-)
---
diff --git a/doc/reference/eog.toml.in b/doc/reference/eog.toml.in
new file mode 100644
index 00000000..381ffdb7
--- /dev/null
+++ b/doc/reference/eog.toml.in
@@ -0,0 +1,57 @@
+[library]
+description = "This is the Eye of GNOME, an image viewer program. It is meant to be a fast and functional 
image viewer."
+authors = "the eog authors"
+license = "@license@"
+version = "@version@"
+website_url = "https://apps.gnome.org/app/org.gnome.eog/";
+browse_url = "https://gitlab.gnome.org/GNOME/eog/";
+repository_url = "https://gitlab.gnome.org/GNOME/eog.git";
+dependencies = [ "Gdk-3.0", "GdkPixbuf-2.0", "Gio-2.0", "GLib-2.0", "GObject-2.0", "Gtk-3.0", "Peas-1.0" ]
+devhelp = true
+search_index = true
+
+  [dependencies."Gdk-3.0"]
+  name = "Gdk"
+  description = "The GTK windowing system abstraction"
+  docs_url = "https://docs.gtk.org/gdk3/";
+
+  [dependencies."GdkPixbuf-2.0"]
+  name = "gdk-pixbuf"
+  description = "Image loading library"
+  docs_url = "https://docs.gtk.org/gdk-pixbuf/";
+
+  [dependencies."Gio-2.0"]
+  name = "Gio"
+  description = "GObject interfaces and objects"
+  docs_url = "https://docs.gtk.org/gio/";
+
+  [dependencies."GLib-2.0"]
+  name = "GLib"
+  description = "The base type system library"
+  docs_url = "https://docs.gtk.org/glib/";
+
+  [dependencies."GObject-2.0"]
+  name = "GObject"
+  description = "The base type system library"
+  docs_url = "https://docs.gtk.org/gobject/";
+
+  [dependencies."Gtk-3.0"]
+  name = "Gtk+ 3"
+  description = "The GUI toolkit"
+  docs_url = "https://docs.gtk.org/gtk3/";
+
+  [dependencies."Peas-1.0"]
+  name = "Libpeas"
+  description = "A GObject based plugin engine"
+  docs_url = "https://developer-old.gnome.org/libpeas/stable/";
+
+[theme]
+name = "basic"
+show_index_summary = true
+show_class_hierarchy = true
+
+[source-location]
+base_url = "https://gitlab.gnome.org/GNOME/eog/-/blob/master/";
+
+[extra]
+urlmap_file = "urlmap.js"
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index 6b3b1dca..40077b4f 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -1,39 +1,32 @@
-private_headers = [
-  'eog-application-service.h',
-  'eog-close-confirmation-dialog.h',
-  'eog-enum-types.h',
-  'eog-image-private.h',
-  'eog-image-jpeg.h',
-  'eog-marshal.h',
-  'eog-metadata-details.h',
-  'eog-metadata-reader.h',
-  'eog-metadata-reader-jpg.h',
-  'eog-metadata-reader-png.h',
-  'eog-metadata-sidebar.h',
-  'eog-module.h',
-  'eog-plugin-engine.h',
-  'eog-preferences-dialog.h',
-  'eog-print-image-setup.h',
-  'eog-print-preview.h',
-]
+toml_conf = {
+  'license': ','.join(meson.project_license()),
+  'version': eog_version,
+}
 
-if not enable_libexif
-  private_headers += 'eog-exif-util.h'
-endif
-
-version_xml = configure_file(
-  input: 'version.xml.in',
+toml = configure_file(
+  input: f'@eog_name  toml in',
   output: '@BASENAME@',
-  configuration: {'VERSION': eog_version},
+  configuration: toml_conf,
 )
 
-gnome.gtkdoc(
-  eog_name,
-  main_xml: f'@eog_name -docs xml',
-  src_dir: src_inc,
-  ignore_headers: private_headers,
-  dependencies: libeog_dep,
-  scan_args: '--rebuild-types',
-  content_files: version_xml,
+custom_target(
+  f'@eog_name@-doc',
+  input: [
+    toml,
+    eog_gir,
+  ],
+  output: eog_name,
+  command: [
+    find_program('gi-docgen'),
+    'generate',
+    '--quiet',
+    '--no-namespace-dir',
+    '--config=@INPUT0@',
+    '--output-dir=@OUTPUT@',
+    '--content-dir=@0@'.format(meson.current_source_dir()),
+    '@INPUT1@',
+  ],
+  build_by_default: true,
   install: true,
+  install_dir: gnome.gtkdoc_html_dir(''),
 )
diff --git a/doc/reference/urlmap.js b/doc/reference/urlmap.js
new file mode 100644
index 00000000..687bd184
--- /dev/null
+++ b/doc/reference/urlmap.js
@@ -0,0 +1,13 @@
+// SPDX-FileCopyrightText: 2022 Iñigo Martinez <inigomartinez gmail com>
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+// A map between namespaces and base URLs for their online documentation
+baseURLs = [
+    [ 'Gdk', 'https://docs.gtk.org/gdk3/' ],
+    [ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
+    [ 'Gio', 'https://docs.gtk.org/gio/' ],
+    [ 'GLib', 'https://docs.gtk.org/glib/' ],
+    [ 'GObject', 'https://docs.gtk.org/gobject/' ],
+    [ 'Gtk', 'https://docs.gtk.org/gtk3/' ],
+    [ 'Libpeas', 'https://developer-old.gnome.org/libpeas/stable/' ],
+]
diff --git a/meson.build b/meson.build
index a483eb8b..baa5c1e8 100644
--- a/meson.build
+++ b/meson.build
@@ -234,6 +234,7 @@ subdir('plugins')
 subdir('help')
 
 if get_option('gtk_doc')
+  assert(enable_introspection, 'documentation generation support requested but introspection is disabled. 
Please use -Dgtk_doc=false.')
   subdir('doc/reference')
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index 80b73c4b..2773bdf0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,7 +3,7 @@ option('cms', type: 'boolean', value: true, description: 'enable colour manageme
 option('xmp', type: 'boolean', value: true, description: 'enable special XMP support')
 option('libjpeg', type: 'boolean', value: true, description: 'enable special JPEG support')
 option('librsvg', type: 'boolean', value: true, description: 'enable RSVG support')
-option('gtk_doc', type: 'boolean', value: false, description: 'use gtk-doc to build documentation')
+option('gtk_doc', type: 'boolean', value: false, description: 'build documentation')
 option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection (depends on 
GObject)')
 option('installed_tests', type: 'boolean', value: false, description: 'enable installed unit tests')
 option('libportal', type: 'boolean', value: true, description: 'Enable xdg-desktop-portal support')
diff --git a/src/meson.build b/src/meson.build
index 8afe93b2..43e559d3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -209,7 +209,7 @@ eog = executable(
 )
 
 if enable_introspection
-  gnome.generate_gir(
+  eog_gir = gnome.generate_gir(
     libeog,
     sources: sources + headers,
     nsversion: eog_api_version,


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