devel-docs, meson: g-ir-doc option to generate introspected API docs.

Similar to the --enable-g-ir-doc option I just added on autotools. Also
separate this option from gtk-doc as it is unrelated (not everything
under devel-docs is related to gtk-doc!).
This commit is contained in:
Jehan 2021-01-29 16:51:47 +01:00
parent 4b39217181
commit eae3d47e32
4 changed files with 127 additions and 121 deletions

View file

@ -1,110 +1,110 @@
if gir_doc_tool.found() and yelp_build.found() # XXX meson does not allow building into subdir:
# https://github.com/mesonbuild/meson/issues/2320
# Otherwise I could use '-o', '@OUTDIR@' into following commands if
# the `output` was subdir-able.
gir_docs_dir = custom_target('g-ir-docs-dir',
depends: [ libgimp_gir, libgimpui_gir ],
input: [ ],
output: [ 'html-dirs' ],
command: [
'mkdir', '-p',
'@OUTDIR@' + '/pages/Python/GimpUi-' + gimp_api_version,
'@OUTDIR@' + '/pages/Python/Gimp-' + gimp_api_version,
'@OUTDIR@' + '/html/Python/GimpUi-' + gimp_api_version,
'@OUTDIR@' + '/html/Python/Gimp-' + gimp_api_version
],
build_by_default: true)
# XXX meson does not allow building into subdir: # XXX `output` is bogus. g-ir-doc-tool produces a lot of output,
# https://github.com/mesonbuild/meson/issues/2320 # basically one page per public symbol, which is more than 1000 so
# Otherwise I could use '-o', '@OUTDIR@' into following commands if # it's not usable. Since custom_target() requires an 'output', I could
# the `output` was subdir-able. # just set one output such as 'index.page` as a trick, but since we
gir_docs_dir = custom_target('g-ir-docs-dir', # have another issue on subdir anyway (cf. above), I use some bogus
depends: [ libgimp_gir, libgimpui_gir ], # file instead. The fact the bogus file is not even created does not
input: [ ], # even seem to be a problem for meson.
output: [ 'html-dirs' ], # Moreover I realized that the targets listed by ninja are only the
command: [ # output files (not the target name), so I basically ends up using
'mkdir', '-p', # this field to create understandable names).
'@OUTDIR@' + '/html/Python/GimpUi-' + gimp_api_version, gir_docs_python = custom_target('g-ir-Gimp-python-pages',
'@OUTDIR@' + '/html/Python/Gimp-' + gimp_api_version depends: [ gir_docs_dir, libgimp_gir ],
], input: [ libgimp_gir[0] ],
build_by_default: false) output: [ 'Gimp-python-pages' ],
command: [
gir_doc_tool,
'-I', prefix / 'share/gir-1.0/',
'-I', meson.build_root() / 'libgimp',
'--language=Python',
'-o', '@OUTDIR@' + '/pages/Python/Gimp-' + gimp_api_version,
'@INPUT@'
],
build_by_default: true)
# XXX `output` is bogus. g-ir-doc-tool produces a lot of output, ## Gimp Module ##
# basically one page per public symbol, which is more than 1000 so
# it's not usable. Since custom_target() requires an 'output', I could
# just set one output such as 'index.page` as a trick, but since we
# have another issue on subdir anyway (cf. above), I use some bogus
# file instead. The fact the bogus file is not even created does not
# even seem to be a problem for meson.
# Moreover I realized that the targets listed by ninja are only the
# output files (not the target name), so I basically ends up using
# this field to create understandable names).
gir_docs_python = custom_target('g-ir-Gimp-python-pages',
depends: [ gir_docs_dir, libgimp_gir ],
input: [ libgimp_gir[0] ],
output: [ 'Gimp-python-pages' ],
command: [
gir_doc_tool,
'-I', prefix / 'share/gir-1.0/',
'-I', meson.build_root() / 'libgimp',
'--language=Python',
'-o', '@OUTDIR@' + '/html/Python/Gimp-' + gimp_api_version,
'@INPUT@'
],
build_by_default: false)
## Gimp Module ## gir_cache_python = custom_target('g-ir-Gimp-python-cache',
input: [ gir_docs_python ],
output: [ 'Gimp-python-cache' ],
command: [
yelp_build, 'cache',
'-o', '@OUTDIR@' + '/pages/Python/Gimp-' + gimp_api_version + '/index.cache',
'@OUTDIR@' + '/pages/Python/Gimp-' + gimp_api_version,
],
build_by_default: true)
gir_cache_python = custom_target('g-ir-Gimp-python-cache', gir_html_python = custom_target('g-ir-Gimp-python-html',
input: [ gir_docs_python ], input: [ gir_cache_python ],
output: [ 'Gimp-python-cache' ], output: [ 'Gimp-python-html' ],
command: [ # TODO: `output` needs to be complete for installation to work. So
yelp_build, 'cache', # we need to figure out how to install the generated files (listing
'-o', '@OUTDIR@' + '/html/Python/Gimp-' + gimp_api_version + '/index.cache', # all of them is a crazy idea, but maybe we can generate the
'@OUTDIR@' + '/html/Python/Gimp-' + gimp_api_version, # expected list somehow? Maybe even using the .def file which is
], # already an exhaustive listing would be a good idea?
build_by_default: false) # Also where should we install exactly?
#install_dir: prefix / gimpdatadir / 'g-ir-docs/html/Python/Gimp',
#install: true,
command: [
'yelp-build', 'html',
'-o', '@OUTDIR@' + '/html/Python/Gimp-' + gimp_api_version,
'@OUTDIR@' + '/pages/Python/Gimp-' + gimp_api_version,
],
build_by_default: true)
gir_html_python = custom_target('g-ir-Gimp-python-html', ## GimpUi module ##
input: [ gir_cache_python ],
output: [ 'Gimp-python-html' ],
# TODO: `output` needs to be complete for installation to work. So
# we need to figure out how to install the generated files (listing
# all of them is a crazy idea, but maybe we can generate the
# expected list somehow? Maybe even using the .def file which is
# already an exhaustive listing would be a good idea?
# Also where should we install exactly?
#install_dir: prefix / gimpdatadir / 'g-ir-docs/html/Python/Gimp',
#install: true,
command: [
'yelp-build', 'html',
'-o', '@OUTDIR@' + '/html/Python/Gimp-' + gimp_api_version,
'@OUTDIR@' + '/html/Python/Gimp-' + gimp_api_version,
])
## GimpUi module ## gir_docs_python = custom_target('g-ir-GimpUi-python-pages',
depends: [ gir_docs_dir, libgimpui_gir ],
input: [ libgimpui_gir[0] ],
output: [ 'GimpUi-python-pages' ],
command: [
gir_doc_tool,
'-I', prefix / 'share/gir-1.0/',
'-I', meson.build_root() / 'libgimp',
'--language=Python',
'-o', '@OUTDIR@' + '/pages/Python/GimpUi-' + gimp_api_version,
'@INPUT@'
],
build_by_default: true)
gir_docs_python = custom_target('g-ir-GimpUi-python-pages', gir_cache_python = custom_target('g-ir-GimpUi-python-cache',
depends: [ gir_docs_dir, libgimpui_gir ], input: [ gir_docs_python ],
input: [ libgimpui_gir[0] ], output: [ 'GimpUi-python-cache' ],
output: [ 'GimpUi-python-pages' ], command: [
command: [ yelp_build, 'cache',
gir_doc_tool, '-o', '@OUTDIR@' + '/pages/Python/GimpUi-' + gimp_api_version + '/index.cache',
'-I', prefix / 'share/gir-1.0/', '@OUTDIR@' + '/pages/Python/GimpUi-' + gimp_api_version,
'-I', meson.build_root() / 'libgimp', ],
'--language=Python', build_by_default: true)
'-o', '@OUTDIR@' + '/html/Python/GimpUi-' + gimp_api_version,
'@INPUT@'
],
build_by_default: false)
gir_cache_python = custom_target('g-ir-GimpUi-python-cache', gir_html_python = custom_target('g-ir-GimpUi-python-html',
input: [ gir_docs_python ], input: [ gir_cache_python ],
output: [ 'GimpUi-python-cache' ], output: [ 'GimpUi-python-html' ],
command: [ #install_dir: prefix / gimpdatadir / 'g-ir-docs/html/Python/GimpUi',
yelp_build, 'cache', #install: true,
'-o', '@OUTDIR@' + '/html/Python/GimpUi-' + gimp_api_version + '/index.cache', command: [
'@OUTDIR@' + '/html/Python/GimpUi-' + gimp_api_version, 'yelp-build', 'html',
], '-o', '@OUTDIR@' + '/html/Python/GimpUi-' + gimp_api_version,
build_by_default: false) '@OUTDIR@' + '/pages/Python/GimpUi-' + gimp_api_version,
],
build_by_default: true)
gir_html_python = custom_target('g-ir-GimpUi-python-html', ## TODO: a unit test using yelp-check would be useful.
input: [ gir_cache_python ],
output: [ 'GimpUi-python-html' ],
#install_dir: prefix / gimpdatadir / 'g-ir-docs/html/Python/GimpUi',
#install: true,
command: [
'yelp-build', 'html',
'-o', '@OUTDIR@' + '/html/Python/GimpUi-' + gimp_api_version,
'@OUTDIR@' + '/html/Python/GimpUi-' + gimp_api_version,
])
## TODO: a unit test using yelp-check would be useful.
endif

View file

@ -17,17 +17,22 @@ mkdb_args_common = [
] ]
if get_option('gtk-doc-app') if get_option('gtk-doc')
subdir('app') if get_option('gtk-doc-app')
subdir('app')
endif
subdir('libgimp')
subdir('libgimpbase')
subdir('libgimpcolor')
subdir('libgimpconfig')
subdir('libgimpmath')
subdir('libgimpmodule')
subdir('libgimpthumb')
subdir('libgimpwidgets')
subdir('tools')
endif endif
subdir('libgimp') if get_option('g-ir-doc')
subdir('libgimpbase') subdir('g-ir-docs')
subdir('libgimpcolor') endif
subdir('libgimpconfig')
subdir('libgimpmath')
subdir('libgimpmodule')
subdir('libgimpthumb')
subdir('libgimpwidgets')
subdir('tools')
subdir('g-ir-docs')

View file

@ -1012,10 +1012,10 @@ desktop_validate = find_program('desktop-file-validate', required: false)
appstream_util = find_program('appstream-util', required: get_option('appdata-test')) appstream_util = find_program('appstream-util', required: get_option('appdata-test'))
# Check for doc generation tools # Check for doc generation tools
have_gtk_doc = get_option('gtk-doc') if get_option('g-ir-doc')
gir_doc_tool = find_program('g-ir-doc-tool', required: true)
gir_doc_tool = find_program('g-ir-doc-tool', required: false) yelp_build = find_program('yelp-build', required: true)
yelp_build = find_program('yelp-build', required: false) endif
# Check for vector icons # Check for vector icons
have_vector_icons = get_option('vec-icons') have_vector_icons = get_option('vec-icons')
@ -1657,10 +1657,7 @@ subdir('app-tools')
# Docs # Docs
subdir('docs') subdir('docs')
if have_gtk_doc subdir('devel-docs')
subdir('devel-docs')
endif
pkgconfig.generate(libgimp, pkgconfig.generate(libgimp,
@ -1803,6 +1800,9 @@ final_message = [
''' Use xvfb-run @0@'''.format(xvfb_run.found()), ''' Use xvfb-run @0@'''.format(xvfb_run.found()),
''' Test appdata @0@'''.format(appstream_util.found()), ''' Test appdata @0@'''.format(appstream_util.found()),
'', '',
'''Documentation:''',
''' GObject Introspection: @0@'''.format(get_option('g-ir-doc')),
'',
'''Bug report URL: @0@'''.format(bug_report_url), '''Bug report URL: @0@'''.format(bug_report_url),
] ]

View file

@ -51,6 +51,7 @@ option('headless-tests', type: 'feature', value: 'auto', description: 'Use xv
option('gtk-doc', type: 'boolean', value: true, description: 'Build developer documentation') option('gtk-doc', type: 'boolean', value: true, description: 'Build developer documentation')
option('gtk-doc-app', type: 'boolean', value: false, description: 'Build developer documentation for app') option('gtk-doc-app', type: 'boolean', value: false, description: 'Build developer documentation for app')
option('g-ir-doc', type: 'boolean', value: false, description: 'Build developer documentation for introspected API')
option('linux-input', type: 'feature', value: 'auto', description: 'Linux input event controller module') option('linux-input', type: 'feature', value: 'auto', description: 'Linux input event controller module')
option('vec-icons', type: 'boolean', value: true, description: 'Use vector icons rather than raster ones') option('vec-icons', type: 'boolean', value: true, description: 'Use vector icons rather than raster ones')