From 81208d0bef5f337e0340cfb365e8c7d8e0310607 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Fri, 1 May 2020 15:48:26 +0200 Subject: [PATCH] Rules to build manpages and script update --- meson.build | 19 ++++++++++++++++++- scripts/man.sh | 12 ++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 0e421b7b..e064258f 100644 --- a/meson.build +++ b/meson.build @@ -138,6 +138,23 @@ if dep_sdl.found() and dep_mpv.found() , install_dir: 'lib/lektor' ) endif +# Man pages +man_sh = find_program('scripts/man.sh') +man_header = run_command('realpath', 'doc/header').stdout().strip() +man_footer = run_command('realpath', 'doc/footer').stdout().strip() +man_files = [ [ 'lektord', '1' ] + ] + +foreach man: man_files + man_name = man.get(0) + man_section = man.get(1, '1') + custom_target( '@0@.@1@'.format(man_name, man_section) + , input: 'doc/@0@.@1@'.format(man_name, man_section) + , output: '@0@.@1@'.format(man_name, man_section) + , command: [ man_sh, '@INPUT@', '@OUTPUT@', man_header, man_footer ] + , install: true + , install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)) ) +endforeach + # Install -install_man('doc/lektord.1') meson.add_install_script('scripts/install.sh') diff --git a/scripts/man.sh b/scripts/man.sh index 94b311cc..50bff11f 100755 --- a/scripts/man.sh +++ b/scripts/man.sh @@ -3,12 +3,16 @@ # $0: script name # $1: input # $2: output -[ $# -ne 2 ] && exit 1 +# $3: header +# $4: footer +[ $# -ne 4 ] && exit 1 [ "$1" == "$2" ] && exit 2 # Global variables -HEADER="doc/header" -FOOTER="doc/footer" +HEADER="$3" +FOOTER="$4" +INPUT="$1" +OUTPUT="$2" # Functions function the_day() { @@ -37,5 +41,5 @@ function mk_manpage() { the_page "$2" '___PAGE___' } -mk_manpage "$1" "$2" +mk_manpage "$INPUT" "$OUTPUT" exit 0 -- GitLab