From 4b7a2df0b783da795fc865ac785dd243e8b3b0b4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 15 Apr 2021 15:18:03 +1000 Subject: [PATCH] man: replace the custom man array with a filename-based section extraction Use the file names as-is in meson.build (which makes it possible to grep for them easily) and use the various string methods to extract the section from the file name and compile the intermediate xml file. --- man/meson.build | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/man/meson.build b/man/meson.build index cfd3cad7d..97bcec52b 100644 --- a/man/meson.build +++ b/man/meson.build @@ -8,33 +8,32 @@ manpage_conf.set('top_srcdir', meson.source_root()) manpage_conf.set('top_builddir', meson.build_root()) manpages = [ - [ 'pipewire', '1' ], - [ 'pipewire.conf', '5' ], - [ 'pw-cat', '1' ], - [ 'pw-cli', '1' ], - [ 'pw-dot', '1' ], - [ 'pw-profiler', '1' ], - [ 'pw-metadata', '1' ], - [ 'pw-mididump', '1' ], - [ 'pw-mon', '1' ] + 'pipewire.1.xml.in', + 'pipewire.conf.5.xml.in', + 'pw-cat.1.xml.in', + 'pw-cli.1.xml.in', + 'pw-dot.1.xml.in', + 'pw-metadata.1.xml.in', + 'pw-mididump.1.xml.in', + 'pw-mon.1.xml.in', + 'pw-profiler.1.xml.in', ] if not get_option('pipewire-jack').disabled() - manpages += [[ 'pw-jack', '1' ]] + manpages += 'pw-jack.1.xml.in' endif foreach m : manpages - file = m.get(0) + '.' + m.get(1) - infile = file + '.xml.in' - outfile = file + '.xml' - xml = configure_file(input : infile, - output : outfile, + file = m.split('.xml.in').get(0) + xml = configure_file(input : m, + output : file + '.xml', configuration : manpage_conf) + section = file.split('.').get(-1) custom_target(file + '.target', output : file, input : xml, command : [xmltoman, '@INPUT@'], capture : true, install : true, - install_dir : get_option('mandir') / 'man' + m.get(1)) + install_dir : get_option('mandir') / 'man' + section) endforeach