| 1 |
# SPDX-FileCopyrightText: 2026 Dr. Tobias Quathamer <[email protected]> |
| 2 |
# |
| 3 |
# SPDX-License-Identifier: GPL-3.0-or-later |
| 4 |
|
| 5 |
fs = import('fs') |
| 6 |
|
| 7 |
# Create English manpage |
| 8 |
custom_target( |
| 9 |
'build-manpage', |
| 10 |
input: 'isoquery.adoc', |
| 11 |
output: 'isoquery.1', |
| 12 |
command: [asciidoctor, '-b', 'manpage', '@INPUT@', '-o', '@OUTPUT@'], |
| 13 |
install: true, |
| 14 |
install_dir: get_option('mandir') / 'man1', |
| 15 |
) |
| 16 |
|
| 17 |
# Create asciidoc files for all translations. |
| 18 |
# Note that translations below the threshold of 80 % |
| 19 |
# do not get an output, so those need to be disabled |
| 20 |
# here. Otherwise, the build fails. |
| 21 |
langs = [ |
| 22 |
'de', |
| 23 |
'es', |
| 24 |
'et', |
| 25 |
'fr', |
| 26 |
'it', |
| 27 |
'nb', |
| 28 |
'pt', |
| 29 |
'ro', |
| 30 |
'sv', |
| 31 |
'ta', |
| 32 |
'tr', |
| 33 |
] |
| 34 |
|
| 35 |
|
| 36 |
# Get the relative path to the source directory. |
| 37 |
# This is needed for po4a, because it does not |
| 38 |
# accept an absolute path. |
| 39 |
rel_path_to_source = fs.relative_to( |
| 40 |
meson.current_source_dir(), |
| 41 |
fs.parent(meson.current_build_dir()), |
| 42 |
) |
| 43 |
|
| 44 |
foreach lang : langs |
| 45 |
conf_data = configuration_data() |
| 46 |
conf_data.set('sourcedir', rel_path_to_source) |
| 47 |
conf_data.set('builddir', meson.current_build_dir()) |
| 48 |
conf_data.set('lang', lang) |
| 49 |
cfg = configure_file( |
| 50 |
input: 'po4a.cfg.in', |
| 51 |
output: 'po4a-@[email protected]'.format(lang), |
| 52 |
configuration: conf_data, |
| 53 |
) |
| 54 |
|
| 55 |
translated_adoc = custom_target( |
| 56 |
'build-asciidoc-@0@'.format(lang), |
| 57 |
input: ['isoquery.adoc', cfg, lang + '.po'], |
| 58 |
output: 'isoquery.@[email protected]'.format(lang), |
| 59 |
command: [po4a, '--no-update', cfg], |
| 60 |
) |
| 61 |
|
| 62 |
custom_target( |
| 63 |
'build-manpage-@0@'.format(lang), |
| 64 |
input: translated_adoc, |
| 65 |
output: 'isoquery.1', |
| 66 |
build_subdir: 'man-@0@'.format(lang), |
| 67 |
command: [asciidoctor, '-b', 'manpage', '@INPUT@', '-o', '@OUTPUT@'], |
| 68 |
install: true, |
| 69 |
install_dir: get_option('mandir') / lang / 'man1', |
| 70 |
) |
| 71 |
endforeach |