aboutsummaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-11-02 00:37:57 +0000
committerSam James <sam@gentoo.org>2022-11-02 00:38:55 +0000
commit502631b86d63c4604b0ed78ad86a054e9726e897 (patch)
tree94992bb08fffd67d9a72c50c5e4c1eeb22b5d7ca /man
parentpylint: reformat with black (diff)
downloadpax-utils-502631b86d63c4604b0ed78ad86a054e9726e897.tar.gz
pax-utils-502631b86d63c4604b0ed78ad86a054e9726e897.tar.bz2
pax-utils-502631b86d63c4604b0ed78ad86a054e9726e897.zip
meson: include generated man pages in dist tarballs
Meson doesn't have an idiomatic way of doing this (for once!) so we have to (per Eli Schwartz, thanks!) have: 1. a dist script which duplicates the build rule; 2. some meson.build if/else logic with fs.exists() to prefer the built manpage when using tarballs Sadly, still can't easily regenerate man pages if you apply a patch downstream though. We use Michael Stapelberg's example from the linked bug as inspiration. Bug: https://github.com/mesonbuild/meson/issues/2166 Reported-by: psykose <alice@ayaya.dev> Thanks-to: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'man')
-rw-r--r--man/meson.build37
1 files changed, 24 insertions, 13 deletions
diff --git a/man/meson.build b/man/meson.build
index 2e346ec..130c8ec 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -18,20 +18,31 @@ pages = [
'dumpelf.docbook', 'pspax.docbook', 'scanelf.docbook', 'scanmacho.docbook'
]
+fs = import('fs')
+
out_pages = []
+generated_man_pages_exist = true
foreach page : pages
- out_pages += page.replace('.docbook', '.1')
+ man_page_name = page.replace('.docbook', '.1')
+ out_pages += man_page_name
+ if not fs.exists(man_page_name)
+ generated_man_pages_exist = false
+ endif
endforeach
-custom_target('docbook_to_man',
- command : [
- xmlto, '-x', files('custom.xsl'), '--skip-validation',
- '-o', meson.current_build_dir(), 'man', book
- ],
- input : [
- 'pax-utils.docbook.in', 'custom.xsl', 'fragment/reftail',
- ] + pages,
- output : out_pages,
- install : true,
- install_dir : get_option('mandir') / 'man1'
-)
+if generated_man_pages_exist
+ install_man(out_pages)
+else
+ custom_target('docbook_to_man',
+ command : [
+ xmlto, '-x', files('custom.xsl'), '--skip-validation',
+ '-o', meson.current_build_dir(), 'man', book
+ ],
+ input : [
+ 'pax-utils.docbook.in', 'custom.xsl', 'fragment/reftail',
+ ] + pages,
+ output : out_pages,
+ install : true,
+ install_dir : get_option('mandir') / 'man1'
+ )
+endif