[vte] docs: Port to gi-docgen



commit 0f7a2ff5b87a40b28f3c340a40ed9ff7ecad459b
Author: Christian Persch <chpe src gnome org>
Date:   Tue May 3 21:57:58 2022 +0200

    docs: Port to gi-docgen
    
    This greatly simplifies building the documentation for both vte/gtk3 and
    vte/gtk4.

 Makefile.meson                     |   4 +-
 doc/reference/Makefile.docs        | 520 -------------------------------------
 doc/reference/gtk3/meson.build     |  55 ----
 doc/reference/gtk4/meson.build     |  55 ----
 doc/reference/licence.md           |  27 ++
 doc/reference/meson.build          |  87 ++++++-
 doc/reference/vte-docs.xml         | 182 -------------
 doc/reference/vte-overrides.txt.in |   0
 doc/reference/vte-sections.txt.in  | 281 --------------------
 doc/reference/vte.types.in         |  17 --
 meson.build                        |   4 -
 11 files changed, 106 insertions(+), 1126 deletions(-)
---
diff --git a/Makefile.meson b/Makefile.meson
index 8bd7b6bb..1fde79cd 100644
--- a/Makefile.meson
+++ b/Makefile.meson
@@ -37,10 +37,10 @@ gtk4:
        $(NINJA) src/app/vte-$(vte_api_version)-gtk4
 
 doc-gtk3:
-       $(NINJA) doc/reference/gtk3/meson.stamp
+       $(NINJA) doc/reference/vte-$(vte_api_version)
 
 doc-gtk4:
-       $(NINJA) doc/reference/gtk4/meson.stamp
+       $(NINJA) doc/reference/vte-$(vte_api_version)-gtk4
 
 check:
        MESON_TESTTHREADS=$(NTHREADS) $(NINJA) test
diff --git a/doc/reference/licence.md b/doc/reference/licence.md
new file mode 100644
index 00000000..6c0b1d9b
--- /dev/null
+++ b/doc/reference/licence.md
@@ -0,0 +1,27 @@
+# Copyright © 2022 Christian Persch
+#
+# This library is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library.  If not, see <https://www.gnu.org/licenses/>.
+
+This documentation is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This documentation is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this documentation.  If not, see <https://www.gnu.org/licenses/>.
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index 793bed5d..3d98c7ae 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -1,4 +1,4 @@
-# Copyright © 2021 Christian Persch
+# Copyright © 2021, 2022 Christian Persch
 #
 # This library is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Lesser General Public License as published
@@ -13,18 +13,85 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with this library.  If not, see <https://www.gnu.org/licenses/>.
 
-# It turned out to be impossible to build gtk3 and gtk4 versions of the
-# docs from the same source using meson's gnome.gtkdoc(). Instead, build
-# using make with a gtk-doc.make-derived Makefile.
+assert(get_option('gir'), 'Introspection must be enabled to build docs')
 
-make = find_program('gmake', 'make')
+gidocgen = find_program('gi-docgen', required: true)
 
-cairo_dep = dependency('cairo')
+doc_conf = configuration_data()
+doc_conf.set('version', meson.project_version())
+
+doc_sources = [
+  'licence.md',
+]
+
+docdir = vte_datadir / 'doc'
 
 if get_option('gtk3')
-  subdir('gtk3')
-endif
+
+  libvte_gtk3_docs_toml = configure_file(
+    configuration: doc_conf,
+    input: 'vte-gtk3.toml.in',
+    install: true,
+    install_dir: docdir,
+    output: vte_gtk3_api_name + '.toml',
+  )
+
+  libvte_gtk3_docs = custom_target(
+    vte_gtk3_api_name,
+    command: [
+      gidocgen,
+      'generate',
+      '--config', '@INPUT0@',
+      '--content-dir', meson.current_source_dir(),
+      '--fatal-warnings',
+      '--no-namespace-dir',
+      '--output-dir', '@OUTPUT@',
+      '--quiet',
+      '@INPUT1@',
+    ],
+    depend_files: [doc_sources,],
+    input: [
+      libvte_gtk3_docs_toml,
+      libvte_gtk3_gir[0],
+    ],
+    install: true,
+    install_dir: docdir,
+    output: vte_gtk3_api_name,
+  )
+
+endif # gtk3
 
 if get_option('gtk4')
-  subdir('gtk4')
-endif
+
+  libvte_gtk4_docs_toml = configure_file(
+    configuration: doc_conf,
+    input: 'vte-gtk4.toml.in',
+    install: true,
+    install_dir: docdir,
+    output: vte_gtk4_api_name + '.toml',
+  )
+
+  libvte_gtk4_docs = custom_target(
+    vte_gtk4_api_name,
+    command: [
+      gidocgen,
+      'generate',
+      '--config', '@INPUT0@',
+      '--content-dir', meson.current_source_dir(),
+      '--fatal-warnings',
+      '--no-namespace-dir',
+      '--output-dir', '@OUTPUT@',
+      '--quiet',
+      '@INPUT1@',
+    ],
+    depend_files: [doc_sources,],
+    input: [
+      libvte_gtk4_docs_toml,
+      libvte_gtk4_gir[0],
+    ],
+    install: true,
+    install_dir: docdir,
+    output: vte_gtk4_api_name,
+  )
+
+endif # gtk4
diff --git a/meson.build b/meson.build
index 2d35be83..5738b262 100644
--- a/meson.build
+++ b/meson.build
@@ -633,10 +633,6 @@ subdir('bindings')
 subdir('po')
 
 if get_option('docs')
-  assert(meson.version().version_compare('>= 0.55.0'),
-    'meson >= 0.55 is required to build docs'
-  )
-
   subdir('doc/reference')
 endif
 


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