[libgit2-glib/wip/inigomartinez/meson: 5/12] meson: Improve gtkdoc documentation generation



commit 1f6c64bad010529193c7f4cabd14c729adc27014
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Fri Jan 19 12:30:17 2018 +0100

    meson: Improve gtkdoc documentation generation
    
    The gtkdoc option has been changed to follow the meson porting
    guidelines[0].
    
    A greater use of different variables is done to avoid any typo when
    rewriting the different strings that are needed for `gtkdoc`
    function parameters.
    
    When querying the glib dependency prefix, now the variable holding
    the previous dependency search is reused.
    
    The list of private headers has also been removed, and now the
    list present in meson build from the `libgit2-glib` directory is
    reused.
    
    Finally the links present in the generated documentation are fixed
    by using the `--html-dir` option.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792699
    
    [0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting

 docs/meson.build           |    1 -
 docs/reference/meson.build |   23 ++++++++++-------------
 meson.build                |    4 ++--
 meson_options.txt          |    2 +-
 4 files changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
index f2210e5..63adc7b 100644
--- a/docs/reference/meson.build
+++ b/docs/reference/meson.build
@@ -1,24 +1,20 @@
-private_headers = [
-  'config.h',
-  'ggit-convert.h',
-  'ggit-utils.h'
-]
-
 docs_conf = configuration_data()
 docs_conf.set('PACKAGE_VERSION', libgit2_glib_version)
 
-configure_file(input : 'version.xml.in',
-               output : 'version.xml',
-               configuration : docs_conf)
+name = 'version.xml'
+
+configure_file(input: name + '.in',
+               output: name,
+               configuration: docs_conf)
 
-glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
+glib_prefix = glib.get_pkgconfig_variable('prefix')
 glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
 
-gnome.gtkdoc('libgit2-glib-@0@'.format(libgit2_glib_api_version),
-             main_sgml: 'libgit2-glib-@0 -docs sgml'.format(libgit2_glib_api_version),
+gnome.gtkdoc(libgit2_glib_api_name,
+             main_sgml: libgit2_glib_api_name + '-docs.sgml',
              src_dir: join_paths(meson.source_root(), 'libgit2-glib'),
              dependencies: libgit2_glib_dep,
-             gobject_typesfile: 'libgit2-glib-@0@.types'.format(libgit2_glib_api_version),
+             gobject_typesfile: libgit2_glib_api_name + '.types',
              scan_args: [
                '--rebuild-types',
                '--ignore-headers=' + ' '.join(private_headers),
@@ -27,5 +23,6 @@ gnome.gtkdoc('libgit2-glib-@0@'.format(libgit2_glib_api_version),
                '--extra-dir=' + join_paths(glib_docpath, 'glib'),
                '--extra-dir=' + join_paths(glib_docpath, 'gobject'),
                '--extra-dir=' + join_paths(glib_docpath, 'gio'),
+               '--html-dir=' + join_paths(libgit2_glib_prefix, gnome.gtkdoc_html_dir(libgit2_glib_api_name)),
              ],
              install: true)
diff --git a/meson.build b/meson.build
index 897b669..4ba0d7e 100644
--- a/meson.build
+++ b/meson.build
@@ -163,6 +163,6 @@ subdir('libgit2-glib')
 subdir('examples')
 subdir('tests')
 
-if get_option('gtk-doc')
-  subdir('docs')
+if get_option('gtk_doc')
+  subdir('docs/reference')
 endif
diff --git a/meson_options.txt b/meson_options.txt
index 6d93e07..65f4a31 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,4 +1,4 @@
-option('gtk-doc', type: 'boolean', value: false, description: 'Enable generating the API reference (depends 
on GTK-Doc)')
+option('gtk_doc', type: 'boolean', value: false, description: 'Enable generating the API reference (depends 
on GTK-Doc)')
 option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection')
 option('debug', type: 'combo', choices: [ 'auto', 'yes', 'minimum', 'no' ], value: 'yes', description: 
'Enable debugging level')
 option('ssh', type: 'boolean', value: true, description: 'Build with libgit2 ssh support')


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