[libgudev/bilelmoussaoui/gi-docgen: 1/6] docs: Prepare for gi-docgen migration




commit d264a4771eada0f18c10a1cfbc721409963c753a
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Sat Feb 5 12:44:55 2022 +0100

    docs: Prepare for gi-docgen migration

 docs/GUdev.toml.in | 40 ++++++++++++++++++++++++++
 docs/meson.build   | 82 ++++++++++++++++++++++++------------------------------
 docs/urlmap.js     |  5 ++++
 meson.build        |  6 ++--
 4 files changed, 84 insertions(+), 49 deletions(-)
---
diff --git a/docs/GUdev.toml.in b/docs/GUdev.toml.in
new file mode 100644
index 0000000..9e35a6d
--- /dev/null
+++ b/docs/GUdev.toml.in
@@ -0,0 +1,40 @@
+[library]
+version = "@version@"
+browse_url = "https://gitlab.gnome.org/GNOME/libgudev/";
+repository_url = "https://gitlab.gnome.org/GNOME/libgudev.git";
+website_url = "https://gitlab.gnome.org/GNOME/libgudev/";
+docs_url = "https://gnome.pages.gitlab.gnome.org/libgudev/";
+authors = "David Zeuthen, Bastien Nocera, David Herrmann"
+license = "LGPL-2.1"
+description = "GObject bindings for libudev"
+dependencies = [ "GObject-2.0", "GLib-2.0" ]
+devhelp = true
+search_index = true
+
+  [dependencies."GObject-2.0"]
+  name = "GObject"
+  description = "The base type system library"
+  docs_url = "https://docs.gtk.org/gobject/";
+
+  [dependencies."GLib-2.0"]
+  name = "GLib"
+  description = "The base type system library"
+  docs_url = "https://docs.gtk.org/glib/";
+
+
+[theme]
+name = "basic"
+show_index_summary = true
+show_class_hierarchy = true
+
+[source-location]
+base_url = "https://gitlab.gnome.org/GNOME/libgudev/-/blob/master/";
+
+[extra]
+# The same order will be used when generating the index
+content_files = [
+]
+
+content_images = [
+]
+urlmap_file = "urlmap.js"
diff --git a/docs/meson.build b/docs/meson.build
index 7d42e48..0a7fa03 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -1,54 +1,46 @@
-glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
-glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html', 'glib')
+if get_option('gtk_doc') and not get_option('introspection').allowed()
+  error('API reference requires introspection.')
+endif
 
-gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix')
-gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html', 'gobject')
+toml_conf = configuration_data()
+toml_conf.set('version', meson.project_version())
 
-libgudev_reference_ignored_h = [
-  'gudevenumtypes.h',
-]
+gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
 
-libgudev_reference_source_folders = [
-  join_paths(srcdir, 'gudev'),
+gidocgen_common_args = [
+  '--quiet',
+  '--no-namespace-dir',
 ]
 
-version_xml = configuration_data()
-version_xml.set('VERSION', version)
-
-configure_file(
-  input: 'version.xml.in',
-  output: 'version.xml',
-  configuration: version_xml,
-  install: false,
-)
+if get_option('werror')
+  gidocgen_common_args += ['--fatal-warnings']
+endif
 
-libgudev_reference_scan_args = [
-  '--ignore-headers=' + ' '.join(libgudev_reference_ignored_h),
-]
+docs_dir = datadir / 'doc'
 
-libgudev_reference_mkdb_args = [
-  '--name-space=g_udev',
-]
-
-libgudev_reference_fixxref_args = [
-  '--html-dir=@0@'.format(join_paths(gtkdocdir, 'html', package_string)),
-  '--extra-dir=@0@'.format(glib_docpath),
-  '--extra-dir=@0@'.format(gobject_docpath),
-]
+if get_option('gtk_doc')
+  source_toml = configure_file(
+    input: 'GUdev.toml.in',
+    output: 'GUdev.toml',
+    configuration: toml_conf,
+    install: true,
+    install_dir: docs_dir / package_name,
+  )
 
-gnome.gtkdoc(
-  package_string,
-  main_xml: 'gudev-docs.xml',
-  gobject_typesfile: files('gudev.types'),
-  src_dir: libgudev_reference_source_folders,
-  dependencies: libgudev_dep,
-  scan_args: libgudev_reference_scan_args,
-  mkdb_args: libgudev_reference_mkdb_args,
-  fixxref_args: libgudev_reference_fixxref_args,
-  install: true,
-  install_dir: join_paths(
-    gtkdocdir,
-    'html',
-    package_name,
+  custom_target('gudev-doc',
+    input: [ source_toml, libgudev_gir[0] ],
+    output: package_name,
+    command: [
+      gidocgen,
+      'generate',
+      gidocgen_common_args,
+      '--config=@INPUT0@',
+      '--output-dir=@OUTPUT@',
+      '--content-dir=@0@'.format(meson.current_source_dir()),
+      '@INPUT1@',
+    ],
+    build_by_default: true,
+    install: true,
+    install_dir: docs_dir,
   )
-)
\ No newline at end of file
+endif
diff --git a/docs/urlmap.js b/docs/urlmap.js
new file mode 100644
index 0000000..08f3d38
--- /dev/null
+++ b/docs/urlmap.js
@@ -0,0 +1,5 @@
+// A map between namespaces and base URLs for their online documentation
+baseURLs = [
+    [ 'GLib', 'https://docs.gtk.org/glib/' ],
+    [ 'GObject', 'https://docs.gtk.org/gobject/' ]
+]
diff --git a/meson.build b/meson.build
index eae2c80..642c0b2 100644
--- a/meson.build
+++ b/meson.build
@@ -34,7 +34,6 @@ pkgincludedir = join_paths(includedir, package_string)
 typelibdir = join_paths(libdir, 'girepository-1.0')
 pkgconfigdir = join_paths(libdir, 'pkgconfig')
 girdir = join_paths(datadir, 'gir-1.0')
-gtkdocdir = join_paths(datadir, 'gtk-doc')
 vapidir = join_paths(datadir, 'vala', 'vapi')
 
 # Dependencies
@@ -44,7 +43,6 @@ glib_req = '>= 2.38.0'
 libudev_req = '>= 199'
 introspection_req = '>= 1.31.1'
 vapigen_req = '>= 0.38.0'
-gtk_doc_req = '>= 1.18'
 
 glib_dep = dependency('glib-2.0', version: glib_req)
 gobject_dep = dependency('gobject-2.0', version: glib_req)
@@ -68,8 +66,8 @@ vapigen_dep = dependency(
   required: get_option('vapi')
 )
 
-gtk_doc_dep = dependency(
-  'gtk-doc', version: gtk_doc_req,
+gi_docgen_dep = dependency(
+  'gi-docgen',
   required: get_option('gtk_doc')
 )
 


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