xeme/xeme

Setup documentation via gi-docgen

6 months ago, Gary Kramlich
5d56028c5da1
Parents d851775930cf
Children f1473c583272
Setup documentation via gi-docgen
--- a/meson.build Fri Dec 01 00:07:32 2023 -0600
+++ b/meson.build Fri Dec 01 00:18:15 2023 -0600
@@ -4,6 +4,26 @@
meson_version : '>=1.0.0',
version : '0.1.0')
+parts = meson.project_version().split('-')
+if parts.length() > 1
+ extra = parts[1]
+else
+ extra = ''
+endif
+
+parts = parts[0].split('.')
+XEME_MAJOR_VERSION = parts[0]
+XEME_MINOR_VERSION = parts[1]
+XEME_MICRO_VERSION = parts[2]
+XEME_LIB_VERSION = f'@XEME_MAJOR_VERSION@.@XEME_MINOR_VERSION@.@XEME_MICRO_VERSION@'
+
+version_config = configuration_data()
+version_config.set('XEME_MAJOR_VERSION', XEME_MAJOR_VERSION)
+version_config.set('XEME_MINOR_VERSION', XEME_MINOR_VERSION)
+version_config.set('XEME_MICRO_VERSION', XEME_MICRO_VERSION)
+version_config.set('XEME_EXTRA_VERSION', extra)
+version_config.set('XEME_VERSION', meson.project_version())
+
gnome = import('gnome')
glib_dep = dependency('glib-2.0', version : '>=2.76.0')
gio_dep = dependency('gio-2.0')
@@ -22,3 +42,15 @@
run_target('turtles',
command : ['ninja', '-C', '@BUILD_ROOT@', 'all', 'test'])
endif
+
+summary({
+ 'prefix': get_option('prefix'),
+ 'bindir': get_option('bindir'),
+ 'libdir': get_option('libdir'),
+ 'datadir': get_option('datadir'),
+}, section : 'Directories')
+
+summary({
+ 'introspection': get_option('introspection'),
+ 'documentation': get_option('doc'),
+}, section : 'Options')
--- a/meson_options.txt Fri Dec 01 00:07:32 2023 -0600
+++ b/meson_options.txt Fri Dec 01 00:18:15 2023 -0600
@@ -1,3 +1,9 @@
+option(
+ 'doc',
+ type : 'boolean', value : true, yield : true,
+ description : 'build documentation with gi-docgen'
+)
+
option(
'introspection',
type : 'boolean', value : true, yield : true,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/subprojects/gi-docgen.wrap Fri Dec 01 00:18:15 2023 -0600
@@ -0,0 +1,5 @@
+[wrap-file]
+directory = gi-docgen-2023.1
+source_url = https://download.gnome.org/sources/gi-docgen/2023/gi-docgen-2023.1.tar.xz
+source_filename = gi-docgen-2023.1.tar.xz
+source_hash = a9a687c1b7c4a4139a214bd451e01ca86131a3161f68aa3e07325b06002bbfb6
--- a/xeme/meson.build Fri Dec 01 00:07:32 2023 -0600
+++ b/xeme/meson.build Fri Dec 01 00:18:15 2023 -0600
@@ -81,4 +81,5 @@
###############################################################################
# Sub Directories
###############################################################################
+subdir('reference')
subdir('tests')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xeme/reference/meson.build Fri Dec 01 00:18:15 2023 -0600
@@ -0,0 +1,44 @@
+if not get_option('doc')
+ subdir_done()
+endif
+
+if not get_option('introspection')
+ error('Documentation requires GObject Introspection.')
+endif
+
+gidocgen_dep = dependency(
+ 'gi-docgen', version: '>= 2023.1',
+ fallback: ['gi-docgen', 'dummy_dep'],
+)
+
+gidocgen = find_program('gi-docgen', required : get_option('doc'))
+docs_dir = get_option('prefix') / get_option('datadir') / 'doc'
+
+xeme_doc_content_files = []
+
+xeme_gidocgen_toml = configure_file(
+ input : 'xeme.toml.in',
+ output : 'xeme.toml',
+ configuration : version_config,
+ install : true,
+ install_dir : docs_dir / 'xeme')
+
+xeme_doc = custom_target('xeme-doc',
+ input : [ xeme_gidocgen_toml, xeme_gir[0] ],
+ output : 'xeme',
+ command : [
+ gidocgen,
+ 'generate',
+ '--quiet',
+ '--fatal-warnings',
+ '--config=@INPUT0@',
+ '--output-dir=@OUTPUT@',
+ '--no-namespace-dir',
+ '--content-dir=@0@'.format(meson.current_source_dir()),
+ '@INPUT1@'
+ ],
+ depend_files : [ xeme_doc_content_files ],
+ build_by_default : true,
+ install : true,
+ install_dir : docs_dir,
+)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xeme/reference/urlmap.js Fri Dec 01 00:18:15 2023 -0600
@@ -0,0 +1,8 @@
+// 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/' ],
+]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xeme/reference/xeme.toml.in Fri Dec 01 00:18:15 2023 -0600
@@ -0,0 +1,36 @@
+[library]
+version = "@XEME_VERSION@"
+browse_url = "https://keep.imfreedom.org/xeme/xeme/"
+repository_url = "https://keep.imfreedom.org/xeme/xeme/"
+website_url = "https://keep.imfreedom.org/xeme/xeme/"
+authors = "Xeme Developers"
+logo_url = ""
+license = "LGPL-2.1-or-later"
+description = "Xeme High Level XMPP Parsing Library"
+dependencies = [ "GLib-2.0", "GObject-2.0" ]
+devhelp = true
+search_index = true
+
+ [dependencies."GLib-2.0"]
+ name = "GLib"
+ description = "General-purpose, portable utility 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/"
+
+[theme]
+name = "basic"
+show_index_summary = true
+show_class_hierarchy = true
+
+[source-location]
+base_url = "https://keep.imfreedom.org/xeme/xeme/file/default/"
+
+[extra]
+# The same order will be used when generating the index
+content_files = []
+content_images = []
+urlmap_file = "urlmap.js"
--- a/xeme/xemeinputstream.h Fri Dec 01 00:07:32 2023 -0600
+++ b/xeme/xemeinputstream.h Fri Dec 01 00:18:15 2023 -0600
@@ -44,8 +44,6 @@
*
* Creates a new input stream.
*
- * > Note: this is typically only necessary for [class@Client].
- *
* Returns: (transfer full): The new instance.
*
* Since: 0.1.0
--- a/xeme/xemeoutputstream.h Fri Dec 01 00:07:32 2023 -0600
+++ b/xeme/xemeoutputstream.h Fri Dec 01 00:18:15 2023 -0600
@@ -37,8 +37,6 @@
* @cancellable: (nullable): A [class@Gio.Cancellable] for the stream.
* Creates a new output stream.
*
- * > Note: this is typically only necessary for [class@Client].
- *
* Returns: (transfer full): The new instance.
*
* Since: 0.1.0