[gdk-pixbuf/ebassi/gi-docgen: 3/6] Port gdk-pixbuf to gi-docgen




commit 0894c2ed6241663f95f515bdb741730b15d764e1
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Mar 20 19:17:15 2021 +0000

    Port gdk-pixbuf to gi-docgen
    
    Follow in the steps of Pango and GTK.

 docs/gdk-pixbuf-from-drawables.xml |  26 -----
 docs/gdk-pixbuf-rendering.xml      |  26 -----
 docs/gdk-pixbuf.toml.in            | 127 ++++++++++++++++++++
 docs/gdk-pixbuf.xml                | 229 -------------------------------------
 docs/meson.build                   |  96 ++++++----------
 docs/urlmap.js                     |  13 +++
 docs/version.xml.in                |   1 -
 meson.build                        |   2 +-
 subprojects/gi-docgen.wrap         |   6 +
 9 files changed, 184 insertions(+), 342 deletions(-)
---
diff --git a/docs/gdk-pixbuf.toml.in b/docs/gdk-pixbuf.toml.in
new file mode 100644
index 000000000..658c1cf0e
--- /dev/null
+++ b/docs/gdk-pixbuf.toml.in
@@ -0,0 +1,127 @@
+# SPDX-FileCopyrightText: 2021 GNOME Foundation
+#
+# SPDX-License-Identifier: CC0-1.0
+
+[library]
+name = "gdk-pixbuf"
+version = "@VERSION@"
+browse_url = "https://gitlab.gnome.org/GNOME/gdk-pixbuf/";
+repository_url = "https://gitlab.gnome.org/GNOME/gdk-pixbuf.git";
+website_url = "https://www.gtk.org";
+authors = "GTK Development Team"
+logo_url = "https://www.gtk.org/";
+license = "GPL-2.1-or-later"
+description = "Image loading library"
+dependencies = [ "gobject", "gio" ]
+devhelp = true
+search_index = true
+
+  [dependencies.gobject]
+  name = "GObject"
+  description = "The base type system library"
+  docs_url = "https://developer.gnome.org/gobject/stable";
+
+  [dependencies.gio]
+  name = "GIO"
+  description = "GObject Interfaces and Objects"
+  docs_url = "https://developer.gnome.org/gio/stable";
+
+[theme]
+name = "basic"
+show_index_summary = true
+
+[source-location]
+base_url = "https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/blob/master/";
+
+[extra]
+urlmap_file = "urlmap.js"
+content_images = [
+  'apple-red-1a.png',
+  'apple-red-2c.png',
+  'composite.png',
+  'gnome-gmush-1.png',
+]
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_0_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_2_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_4_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_6_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_8_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_10_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_12_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_14_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_16_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_18_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_20_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_22_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_24_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_26_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_28_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_30_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_32_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_34_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_36_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_38_FOR"
+hidden = true
+
+[[object]]
+name = "PIXBUF_DEPRECATED_IN_2_40_FOR"
+hidden = true
diff --git a/docs/meson.build b/docs/meson.build
index c7c8fe721..d40ba61c0 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -1,69 +1,47 @@
-version_xml = configuration_data()
-version_xml.set('GDK_PIXBUF_VERSION', meson.project_version())
-configure_file(input: 'version.xml.in',
-               output: 'version.xml',
-               configuration: version_xml)
+gidocgen_dep = dependency('gi-docgen',
+  version: '>= 2021.1',
+  fallback: ['gi-docgen', 'dummy_dep'],
+  required: get_option('gtk_doc'),
+)
 
-if gobject_dep.type_name() == 'pkgconfig'
-  glib_prefix = gobject_dep.get_pkgconfig_variable('prefix')
-else
-  glib_prefix = get_option('prefix')
-endif
-glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
-docpath = join_paths(gdk_pixbuf_datadir, 'gtk-doc', 'html')
 
-private_headers = [
-  'pixops',
-  'gdk-pixbuf.h',
-  'gdk-pixbuf-alias.h',
-  'gdk-pixbuf-autocleanups.h',
-  'gdk-pixbuf-buffer-queue-private.h',
-  'gdk-pixbuf-marshal.h',
-  'gdk-pixbuf-private.h',
-  'gdk-pixbuf-scaled-anim.h',
-  'io-ani-animation.h',
-  'io-gdip-animation.h',
-  'io-gdip-native.h',
-  'io-gdip-propertytags.h',
-  'io-gdip-utils.h',
-  'io-gif-animation.h',
-  'xpm-color-table.h',
-  'test-images.h',
-  'lzw.h',
+toml_conf = configuration_data()
+toml_conf.set('VERSION', meson.project_version())
+toml = configure_file(input: 'gdk-pixbuf.toml.in', output: 'gdk-pixbuf.toml', configuration: toml_conf)
+
+gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
+
+docs_dir = gdk_pixbuf_datadir / 'doc/gdk-pixbuf/reference'
+
+expand_content_md_files = [
 ]
 
+build_docs = get_option('gtk_doc')
 if get_option('docs')
-  warning('The "docs" build option is deprecated; please use "gtk_doc=true"')
+  warning('The docs option is deprecated; use -Dgtk_doc=true')
+  build_docs = true
 endif
 
-if get_option('gtk_doc') or get_option('docs')
-  gnome.gtkdoc('gdk-pixbuf',
-               main_xml: 'gdk-pixbuf.xml',
-               src_dir: [ gdk_pixbuf_inc ],
-               dependencies: gdkpixbuf_dep,
-               gobject_typesfile: 'gdk-pixbuf.types',
-               scan_args: [
-                 '--rebuild-types',
-                 '--deprecated-guards="GDK_PIXBUF_ENABLE_BROKEN|GDK_PIXBUF_DISABLE_DEPRECATED"',
-                 '--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')),
-               ],
-               html_assets: [
-                 'composite.png',
-               ],
-               content_files: [
-                 'gdk-pixbuf-from-drawables.xml',
-                 'gdk-pixbuf-rendering.xml',
-                 'gdk-pixbuf.xml',
-                 'gdk-pixbuf-csource.xml',
-                 'gdk-pixbuf-query-loaders.xml',
-               ],
-               install: true)
+if build_docs
+  custom_target('gdk-pixbuf-doc',
+    input: [ toml, gdkpixbuf_gir[0] ],
+    output: 'gdk-pixbuf',
+    command: [
+      gidocgen,
+      'generate',
+      '--quiet',
+      '--add-include-path=@0@'.format(meson.current_build_dir() / '../gdk-pixbuf'),
+      '--config=@INPUT0@',
+      '--output-dir=@OUTPUT@',
+      '--no-namespace-dir',
+      '--content-dir=@0@'.format(meson.current_source_dir()),
+      '@INPUT1@',
+    ],
+    depend_files: [ expand_content_md_files ],
+    build_by_default: true,
+    install: true,
+    install_dir: docs_dir,
+  )
 endif
 
 xsltproc = find_program('xsltproc', required: false)
diff --git a/docs/urlmap.js b/docs/urlmap.js
new file mode 100644
index 000000000..eaf2de988
--- /dev/null
+++ b/docs/urlmap.js
@@ -0,0 +1,13 @@
+// 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 = [
+    [ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
+    [ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
+    [ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
+    [ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
+    [ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
+    [ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
+    [ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
+]
diff --git a/meson.build b/meson.build
index f43d2334e..4725e9498 100644
--- a/meson.build
+++ b/meson.build
@@ -94,7 +94,7 @@ if cc.has_function('lrint', dependencies: mathlib_dep)
 endif
 
 intl_dep = cc.find_library('intl', required: false)
-if cc.has_function('bind_textdomain_codeset', prefix: '#include <libintl.h>', dependency: intl_dep)
+if cc.has_function('bind_textdomain_codeset', prefix: '#include <libintl.h>', dependencies: intl_dep)
   gdk_pixbuf_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', 1)
 endif
 
diff --git a/subprojects/gi-docgen.wrap b/subprojects/gi-docgen.wrap
new file mode 100644
index 000000000..e9c78c1e7
--- /dev/null
+++ b/subprojects/gi-docgen.wrap
@@ -0,0 +1,6 @@
+[wrap-git]
+directory=gi-docgen
+url=https://gitlab.gnome.org/ebassi/gi-docgen.git
+push-url=ssh://git gitlab gnome org:ebassi/gi-docgen.git
+revision=main
+depth=1


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