From b26dbffcf3babb6113b17934466500a9a116d9ec Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Sat, 1 May 2021 15:01:39 +0200 Subject: [PATCH] doc: fix external xref Pass external documentation paths to gtkdoc-fixxref so links outside the project will be properly resolved. This works if (and only if) the external documentation is properly installed in the host system, most notably cairo and GTK reference manuals. --- docs/adg/meson.build | 64 +++++++++++++++++++++++++++++++-------------------- docs/cpml/meson.build | 47 ++++++++++++++++++++----------------- meson.build | 30 ++++++++++++++---------- meson_options.txt | 3 +++ 4 files changed, 86 insertions(+), 58 deletions(-) rewrite docs/adg/meson.build (76%) rewrite docs/cpml/meson.build (61%) diff --git a/docs/adg/meson.build b/docs/adg/meson.build dissimilarity index 76% index de8ffbcd..a3ef2cef 100644 --- a/docs/adg/meson.build +++ b/docs/adg/meson.build @@ -1,25 +1,39 @@ -bookinfo_xml = configure_file( - input: 'bookinfo.xml.in', - output: '@BASENAME@', - configuration: data -) - -gnome.gtkdoc('adg', - namespace: 'adg', - src_dir: adg_directories, - ignore_headers: adg_internal_names + [ 'adg-marshal.h' ], - dependencies: adg_dep, - main_xml: 'adg-docs.xml', - content_files: bookinfo_xml, - scan_args: [ - '--rebuild-types', - '--rebuild-sections', - ], - mkdb_args: [ - '--default-includes=adg.h', - ], - fixxref_args: [ - '--extra-dir=' + meson.current_build_dir() + '../adg/html', - ], - install_dir: 'adg-' + metadata['api'] -) +bookinfo_xml = configure_file( + input: 'bookinfo.xml.in', + output: '@BASENAME@', + configuration: data +) + +adg_fixxref_args = cpml_fixxref_args + [ + '--extra-dir=../cpml', +] +if gtk_dep.found() + adg_fixxref_args += [ + '--extra-dir=' + join_paths( + gtk_dep.get_variable(pkgconfig: 'prefix'), + 'share', 'gtk-doc', 'html', + use_gtk2 ? 'gtk2' : 'gtk3' + ) + ] +endif +if pangocairo_dep.found() + adg_fixxref_args += [ + '--extra-dir=' + join_paths( + pangocairo_dep.get_variable(pkgconfig: 'prefix'), + 'share', 'gtk-doc', 'html', 'pango' + ) + ] +endif + +gnome.gtkdoc('adg', + namespace: 'adg', + src_dir: adg_directories, + ignore_headers: adg_internal_names + [ 'adg-marshal.h', 'adg-cairo-fallback.h' ], + dependencies: adg_dep, + main_xml: 'adg-docs.xml', + content_files: bookinfo_xml, + scan_args: [ '--rebuild-types', '--rebuild-sections' ], + mkdb_args: [ '--default-includes=adg.h' ], + fixxref_args: adg_fixxref_args, + install_dir: 'adg-' + metadata['api'] +) diff --git a/docs/cpml/meson.build b/docs/cpml/meson.build dissimilarity index 61% index b7c1e82b..858a9be6 100644 --- a/docs/cpml/meson.build +++ b/docs/cpml/meson.build @@ -1,21 +1,26 @@ -bookinfo_xml = configure_file( - input: 'bookinfo.xml.in', - output: '@BASENAME@', - configuration: data -) - -gnome.gtkdoc('cpml', - namespace: 'cpml', - src_dir: cpml_directories, - ignore_headers: cpml_internal_names, - dependencies: cpml_dep, - main_xml: 'cpml-docs.xml', - content_files: bookinfo_xml, - scan_args: [ - '--rebuild-sections', - ], - mkdb_args: [ - '--default-includes=cpml.h', - ], - install_dir: 'cpml-' + metadata['api'] -) +bookinfo_xml = configure_file( + input: 'bookinfo.xml.in', + output: '@BASENAME@', + configuration: data +) + +cpml_fixxref_args = [ + '--html-dir=' + gtkdocdir, + '--extra-dir=' + join_paths( + cairo_dep.get_variable(pkgconfig: 'prefix'), + 'share', 'gtk-doc', 'html', 'cairo' + ), +] + +gnome.gtkdoc('cpml', + namespace: 'cpml', + src_dir: cpml_directories, + ignore_headers: cpml_internal_names, + dependencies: cpml_dep, + main_xml: 'cpml-docs.xml', + content_files: bookinfo_xml, + scan_args: [ '--rebuild-sections' ], + mkdb_args: [ '--default-includes=cpml.h' ], + fixxref_args: cpml_fixxref_args, + install_dir: 'cpml-' + metadata['api'] +) diff --git a/meson.build b/meson.build index bd5d91b1..173f3968 100644 --- a/meson.build +++ b/meson.build @@ -28,16 +28,16 @@ adg_revision = 1 adg_age = 1 -cc = meson.get_compiler('c') -gnome = import('gnome') -i18n = import('i18n') -pkgconfig = import('pkgconfig') -pkgdir = meson.project_name() + '-' + metadata['api'] -prefix = get_option('prefix') -datadir = join_paths(prefix, get_option('datadir')) -pkgdatadir = join_paths(datadir, pkgdir) -localedir = join_paths(prefix, get_option('localedir')) -includedir = join_paths(prefix, get_option('includedir'), pkgdir) +cc = meson.get_compiler('c') +gnome = import('gnome') +i18n = import('i18n') +pkgconfig = import('pkgconfig') +pkgdir = meson.project_name() + '-' + metadata['api'] +prefix = get_option('prefix') +datadir = join_paths(prefix, get_option('datadir')) +pkgdatadir = join_paths(datadir, pkgdir) +localedir = join_paths(prefix, get_option('localedir')) +includedir = join_paths(prefix, get_option('includedir'), pkgdir) m_dep = cc.find_library('m', required: false) @@ -94,6 +94,11 @@ endif gtkdoc_dep = dependency('gtk-doc', required: get_option('gtk-doc'), version: '>=1.12') +gtkdocdir = get_option('gtkdocdir') +if gtkdocdir == '' + gtkdocdir = join_paths(get_option('prefix'), get_option('datadir'), 'gtk-doc', 'html') +endif + # First stable release introspection_dep = dependency('gobject-introspection-1.0', version: '>=1.0.0', required: get_option('introspection')) @@ -128,10 +133,11 @@ summary({ 'yes (@0@ @1@)'.format(gtk_dep.name(), gtk_dep.version()) : 'no', 'Install glade catalogs': - catalogdir == '' ? 'no' : 'yes (@0@)'.format(catalogdir), + catalogdir == '' ? 'no' : 'yes, install into @0@'.format(catalogdir), 'Build API reference': gtkdoc_dep.found() ? - 'yes (@0@ @1@)'.format(gtkdoc_dep.name(), gtkdoc_dep.version()) : + 'yes (@0@ @1@), install into @2@'. + format(gtkdoc_dep.name(), gtkdoc_dep.version(), gtkdocdir) : 'no', 'GObject instrospection': introspection_dep.found() ? diff --git a/meson_options.txt b/meson_options.txt index d2913d6d..d16d08e3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -11,6 +11,9 @@ option('catalogdir', type: 'string', value: 'check', option('gtk-doc', type: 'feature', description: 'Build API reference with gtk-doc') +option('gtkdocdir', type: 'string', value: '', + description: 'Where to install gtk-doc html') + option('introspection', type: 'feature', description: 'Enable introspection for this build') -- 2.11.4.GIT