diff --git a/meson.build b/meson.build index d348ad5..4aaf5c5 100644 --- a/meson.build +++ b/meson.build @@ -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')) diff --git a/meson_options.txt b/meson_options.txt index 8ea72c7..5d04e51 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/src/meson.build b/src/meson.build index 972e4b4..07beac7 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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 ]