meson: Copy seatd's scdoc handling

This fixes cross-compiling, and avoids unnecessary search for a shell.
master
Kenny Levinsen 2021-04-30 20:02:02 +02:00
parent 3d7979a148
commit 7be432057f
1 changed files with 5 additions and 8 deletions

View File

@ -3,7 +3,7 @@ project(
'c', 'c',
version: '0.2.0', version: '0.2.0',
license: 'MIT', license: 'MIT',
meson_version: '>=0.53.0', meson_version: '>=0.56.0',
default_options: [ default_options: [
'c_std=c11', 'c_std=c11',
'warning_level=3', 'warning_level=3',
@ -56,16 +56,13 @@ executable(
install: true, install: true,
) )
scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7') scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7', native: true)
if scdoc.found() if scdoc.found()
sh = find_program('sh') scdoc_prog = find_program(scdoc.get_variable(pkgconfig: 'scdoc'), native: true)
man_pages = ['wlsunset.1.scd']
mandir = get_option('mandir') mandir = get_option('mandir')
foreach src : man_pages foreach src : ['wlsunset.1.scd']
topic = src.split('.')[0] topic = src.split('.')[0]
section = src.split('.')[1] section = src.split('.')[1]
output = '@0@.@1@'.format(topic, section) output = '@0@.@1@'.format(topic, section)
@ -75,7 +72,7 @@ if scdoc.found()
input: src, input: src,
output: output, output: output,
command: [ command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.get_pkgconfig_variable('scdoc'), output) 'sh', '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.full_path(), output)
], ],
install: true, install: true,
install_dir: '@0@/man@1@'.format(mandir, section) install_dir: '@0@/man@1@'.format(mandir, section)