build: build help.h with meson

cute-signatures
Rasmus Thomsen 2020-05-07 12:38:21 +02:00 committed by Timo Teräs
parent fe1de720d0
commit 718e07f78a
3 changed files with 39 additions and 27 deletions

View File

@ -1,8 +1,4 @@
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
man_files = [
man_files = files(
'apk.8.scd',
'apk-add.8.scd',
'apk-audit.8.scd',
@ -25,22 +21,28 @@ man_files = [
'apk-verify.8.scd',
'apk-version.8.scd',
'apk-world.5.scd',
]
)
foreach filename : man_files
topic = filename.split('.')[-3].split('/')[-1]
section = filename.split('.')[-2]
output = '@0@.@1@'.format(topic, section)
if scdoc_dep.found()
scdoc_prog = find_program(scdoc_dep.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
custom_target(
output,
input: filename,
capture: true,
output: output,
command: [
sh, '-c', '@0@ < @INPUT@'.format(scdoc_prog.path())
],
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
foreach filename : man_files
topic = '@0@'.format(filename).split('.')[-3].split('/')[-1]
section = '@0@'.format(filename).split('.')[-2]
output = '@0@.@1@'.format(topic, section)
custom_target(
output,
input: filename,
capture: true,
output: output,
command: [
sh, '-c', '@0@ < @INPUT@'.format(scdoc_prog.path())
],
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif

View File

@ -13,7 +13,7 @@ apk_libdir = get_option('libdir')
zlib_dep = dependency('zlib')
openssl_dep = dependency('openssl')
lua_dep = dependency('lua' + get_option('lua_version'), required: get_option('lua'))
scdoc = dependency('scdoc', version: '>=1.10', required: get_option('docs'))
scdoc_dep = dependency('scdoc', version: '>=1.10', required: get_option('docs'))
add_project_arguments('-D_GNU_SOURCE', language: 'c')
@ -23,9 +23,6 @@ if get_option('default_library') == 'static'
add_project_arguments('-DOPENSSL_NO_ENGINE', language: 'c')
endif
subdir('doc')
subdir('libfetch')
subdir('src')
if scdoc.found()
subdir('doc')
endif

View File

@ -51,8 +51,21 @@ apk_src = [
'app_stats.c',
'app_verify.c',
'app_version.c',
'help.c',
]
genhelp_script = find_program('genhelp.lua')
generated_help = custom_target(
'help.h',
capture: true,
output: 'help.h',
input: man_files,
command: [genhelp_script, '@INPUT@'],
)
apk_src += [ generated_help ]
apk_cargs = [
'-DAPK_VERSION="' + meson.project_version() + '"',
'-D_ATFILE_SOURCE',