diff --git a/librz/core/cmd_descs/meson.build b/librz/core/cmd_descs/meson.build index 1ff37d1d70..8a7e2a86f1 100644 --- a/librz/core/cmd_descs/meson.build +++ b/librz/core/cmd_descs/meson.build @@ -32,13 +32,17 @@ cmd_descs_yaml = files( cmd_descs_src_c = files('cmd_descs.c', 'cmd_descs.h') r = run_command(py3_exe, '-c', 'import yaml', check: false) -if r.returncode() == 0 +cmd_option = get_option('regenerate_cmds') +has_pyyaml = r.returncode() == 0 +if (cmd_option.auto() or cmd_option.enabled()) and has_pyyaml cmd_descs_ch = custom_target( 'cmd_descs.[ch]', output: ['cmd_descs.c', 'cmd_descs.h'], input: cmd_descs_yaml, command: [py3_exe, cmd_descs_generate_py, '--output-dir', '@OUTDIR@', '--src-output-dir', meson.current_source_dir(), '@INPUT@'] ) +elif cmd_option.enabled() and not has_pyyaml + error('PyYAML python module was not found, but it is required to regenerate cmd_descs.[ch]') else warning('PyYAML python module was not found, using cmd_descs.c/cmd_descs.h from source directory. Install PyYAML (either from your package manager or through pip) if you need to modify cmd_descs files.') cmd_descs_ch = cmd_descs_src_c diff --git a/meson_options.txt b/meson_options.txt index ed764f06ee..7e58613650 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -39,3 +39,4 @@ option('debugger', type: 'boolean', value: true) option('enable_tests', type: 'boolean', value: true, description: 'Build unit tests in test/unit') option('enable_rz_test', type: 'boolean', value: true, description: 'Build rz-test executable for regression testing') +option('regenerate_cmds', type: 'feature', value: 'auto', description: 'Regenerate the cmd_descs.[ch] files (requires PyYAML)')