Hi, Daniel pinged me off-list about that we do not have a way to generate images for docs by using the meson build system, attached fixes that.
In addition to that, I think we might want to update README for ditaa since its URL is pointing to the wrong version. I created another thread for this [1]. [1] https://postgr.es/m/CAN55FZ2O-23xERF2NYcvv9DM_1c9T16y6mi3vyP%3DO1iuXS0ASA%40mail.gmail.com -- Regards, Nazir Bilal Yavuz Microsoft
From 9999c1dca65526e17ad1ac2f99bb1e0a33b9c1ce Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz <[email protected]> Date: Mon, 22 Dec 2025 14:10:54 +0300 Subject: [PATCH v1] meson: Generate images for docs by using meson There was no way to generate images for docs by using meson build system. So, add a way to do that by adding a `images` target to the meson build. Images can be generated by using `meson compile images` command now. Reported-by: Daniel Gustafsson <[email protected]> --- doc/src/sgml/images/meson.build | 61 +++++++++++++++++++++++++++++++++ doc/src/sgml/meson.build | 2 ++ meson.build | 2 ++ 3 files changed, 65 insertions(+) create mode 100644 doc/src/sgml/images/meson.build diff --git a/doc/src/sgml/images/meson.build b/doc/src/sgml/images/meson.build new file mode 100644 index 00000000000..8e601e877a5 --- /dev/null +++ b/doc/src/sgml/images/meson.build @@ -0,0 +1,61 @@ +# doc/src/sgml/images/meson.build +# +# see README in this directory about image handling + +if not xsltproc_bin.found() or not dot.found() or not ditaa.found() + subdir_done() +endif + +image_targets = [] + +fixup_svg_xsl = files('fixup-svg.xsl') + +all_files = [ + 'genetic-algorithm.gv', + 'gin.gv', + 'pagelayout.txt', + 'temporal-entities.txt', + 'temporal-references.txt', +] + +foreach file : all_files + + str_split = file.split('.') + actual_file_name = str_split[0] + extension = str_split[1] + cur_file = files(file) + tmp_name = '@[email protected]'.format(file) + output_name = '@[email protected]'.format(actual_file_name) + + command = [] + if extension == 'gv' + command = [dot, '-T', 'svg', '-o', '@OUTPUT@', '@INPUT@'] + elif extension == 'txt' + command = [ditaa, '-E', '-S', '--svg', '@INPUT@', '@OUTPUT@'] + else + error('Unknown extension: ".@0@" while generating images'.format(extension)) + endif + + svg_tmp = custom_target(tmp_name, + input: cur_file, + output: tmp_name, + command: command, + ) + + current_svg = custom_target(output_name, + input: svg_tmp, + output: output_name, + command: [xsltproc_bin, + '--nonet', + # Use --novalid to avoid loading SVG DTD if a file specifies it, since + # it might not be available locally, and we don't need it. + '--novalid', + '-o', '@OUTPUT@', + fixup_svg_xsl, + '@INPUT@'] + ) + + image_targets += current_svg +endforeach + +alias_target('images', image_targets) diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build index 6ae192eac68..6852ac7e57c 100644 --- a/doc/src/sgml/meson.build +++ b/doc/src/sgml/meson.build @@ -1,5 +1,7 @@ # Copyright (c) 2022-2025, PostgreSQL Global Development Group +subdir('images') + docs = [] installdocs = [] alldocs = [] diff --git a/meson.build b/meson.build index d7c5193d4ce..34b748c8f35 100644 --- a/meson.build +++ b/meson.build @@ -351,6 +351,8 @@ cp = find_program('cp', required: false, native: true) xmllint_bin = find_program(get_option('XMLLINT'), native: true, required: false) xsltproc_bin = find_program(get_option('XSLTPROC'), native: true, required: false) nm = find_program('nm', required: false, native: true) +ditaa = find_program('ditaa', native: true, required: false) +dot = find_program('dot', native: true, required: false) bison_flags = [] if bison.found() -- 2.47.3
