build: allow building without help in meson

cute-signatures
Rasmus Thomsen 2020-05-19 10:11:49 +02:00 committed by Timo Teräs
parent 718e07f78a
commit f6795011ca
3 changed files with 19 additions and 8 deletions

View File

@ -12,6 +12,7 @@ apk_libdir = get_option('libdir')
zlib_dep = dependency('zlib')
openssl_dep = dependency('openssl')
lua_bin = find_program('lua' + get_option('lua_version'), required: get_option('help'))
lua_dep = dependency('lua' + get_option('lua_version'), required: get_option('lua'))
scdoc_dep = dependency('scdoc', version: '>=1.10', required: get_option('docs'))

View File

@ -1,3 +1,4 @@
option('docs', description: 'Build manpages with scdoc', type: 'feature', value: 'auto')
option('help', description: 'Build help into apk binaries, needs lua and lua-zlib', type: 'feature', value: 'auto')
option('lua', description: 'Build luaapk (lua bindings)', type: 'feature', value: 'auto')
option('lua_version', description: 'Lua version to build against', type: 'string', value: '5.3')

View File

@ -54,15 +54,24 @@ apk_src = [
'help.c',
]
genhelp_script = find_program('genhelp.lua')
if lua_bin.found()
genhelp_script = find_program('genhelp.lua')
generated_help = custom_target(
'help.h',
capture: true,
output: 'help.h',
input: man_files,
command: [genhelp_script, '@INPUT@'],
)
generated_help = custom_target(
'help.h',
capture: true,
output: 'help.h',
input: man_files,
command: [genhelp_script, '@INPUT@'],
)
else
generated_help = custom_target(
'help.h',
capture: true,
output: 'help.h',
command: ['echo', '#define NO_HELP'],
)
endif
apk_src += [ generated_help ]