mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 01:49:48 +00:00
[#3730] Added generate parser
This commit is contained in:
parent
60b424b8d1
commit
e46ce7668d
5
cd-and-run.sh
Executable file
5
cd-and-run.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd "$1" || exit 1
|
||||
shift
|
||||
exec "$@"
|
@ -2,8 +2,7 @@
|
||||
|
||||
set -v
|
||||
|
||||
cd @srcdir@ || exit 1
|
||||
mkdir -p @builddir@/html
|
||||
|
||||
(cat @srcdir@/Doxyfile; echo PROJECT_NUMBER=@PACKAGE_VERSION@) | doxygen - > @builddir@/html/doxygen.log 2> @builddir@/html/doxygen-error.log
|
||||
(cat Doxyfile; echo PROJECT_NUMBER=@PACKAGE_VERSION@) | doxygen - > @builddir@/html/doxygen.log 2> @builddir@/html/doxygen-error.log
|
||||
echo "$(grep -c ': warning:' @builddir@/html/doxygen-error.log)" warnings/errors detected.
|
||||
|
@ -2,13 +2,15 @@ if not doxygen_exe.found()
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
current_build_dir = meson.current_build_dir()
|
||||
current_source_dir = meson.current_source_dir()
|
||||
make_devel_conf_data = configuration_data()
|
||||
make_devel_conf_data.set('builddir', meson.current_build_dir())
|
||||
make_devel_conf_data.set('srcdir', meson.current_source_dir())
|
||||
make_devel_conf_data.set('builddir', current_build_dir)
|
||||
make_devel_conf_data.set('PACKAGE_VERSION', project_version)
|
||||
make_devel = configure_file(
|
||||
configure_file(
|
||||
input: 'make-devel.sh.in',
|
||||
output: 'make-devel.sh',
|
||||
configuration: make_devel_conf_data,
|
||||
)
|
||||
run_target('make-devel', command: [make_devel])
|
||||
make_devel = f'@current_build_dir@/make-devel.sh'
|
||||
run_target('make-devel', command: [CD_AND_RUN, current_source_dir, make_devel])
|
||||
|
26
meson.build
26
meson.build
@ -156,8 +156,8 @@ message(f'Detected system "@SYSTEM@".')
|
||||
#### Programs
|
||||
|
||||
python_exe = find_program('python3', 'python', required: false)
|
||||
flex_exe = find_program('flex', required: false)
|
||||
bison_exe = find_program('bison', required: false)
|
||||
flex_exe = find_program('flex', version: '>=2.6.4', required: false)
|
||||
bison_exe = find_program('bison', version: '>=3.3.0', required: false)
|
||||
awk_exe = find_program('gawk', 'awk', required: false)
|
||||
doxygen_exe = find_program('doxygen', required: false)
|
||||
sphinx_exe = find_program('sphinx-build', 'sphinx-build-3', required: false)
|
||||
@ -169,6 +169,20 @@ pip_compile_exe = find_program('pip-compile', required: false)
|
||||
install_exe = find_program('install', required: true)
|
||||
valgrind_exe = find_program('valgrind', required: false)
|
||||
|
||||
if python_exe.found()
|
||||
PYTHON = python_exe.full_path()
|
||||
endif
|
||||
if flex_exe.found()
|
||||
FLEX = flex_exe.full_path()
|
||||
endif
|
||||
if bison_exe.found()
|
||||
BISON = bison_exe.full_path()
|
||||
endif
|
||||
if awk_exe.found()
|
||||
AWK = awk_exe.full_path()
|
||||
endif
|
||||
CD_AND_RUN = f'@TOP_SOURCE_DIR@/cd-and-run.sh'
|
||||
|
||||
#### Dependencies
|
||||
|
||||
boost = dependency('boost', version: '>=1.66')
|
||||
@ -495,7 +509,7 @@ report_conf_data.set('LD_ID', cpp.get_linker_id())
|
||||
report_conf_data.set('LD_ARGS', ' '.join(link_args))
|
||||
if python_exe.found()
|
||||
report_conf_data.set('HAVE_PYTHON', 'yes')
|
||||
report_conf_data.set('PYTHON_PATH', python_exe.full_path())
|
||||
report_conf_data.set('PYTHON_PATH', PYTHON)
|
||||
result = run_command(
|
||||
python_exe,
|
||||
'-c',
|
||||
@ -580,12 +594,12 @@ else
|
||||
report_conf_data.set('LOG4CPLUS_VERSION', log4cplus.version())
|
||||
endif
|
||||
if flex_exe.found()
|
||||
report_conf_data.set('FLEX', flex_exe.full_path())
|
||||
report_conf_data.set('FLEX', FLEX)
|
||||
else
|
||||
report_conf_data.set('FLEX', 'unknown')
|
||||
endif
|
||||
if bison_exe.found()
|
||||
report_conf_data.set('BISON', bison_exe.full_path())
|
||||
report_conf_data.set('BISON', BISON)
|
||||
else
|
||||
report_conf_data.set('BISON', 'unknown')
|
||||
endif
|
||||
@ -670,6 +684,7 @@ config_report = custom_target(
|
||||
|
||||
LIBS_BUILT_SO_FAR = []
|
||||
TARGETS_GEN_MESSAGES = []
|
||||
TARGETS_GEN_PARSER = []
|
||||
subdir('tools')
|
||||
subdir('src')
|
||||
subdir('fuzz')
|
||||
@ -679,6 +694,7 @@ if have_premium
|
||||
endif
|
||||
|
||||
alias_target('all-targets-gen-messages', TARGETS_GEN_MESSAGES)
|
||||
alias_target('all-targets-gen-parser', TARGETS_GEN_PARSER)
|
||||
|
||||
top_docs = [
|
||||
'AUTHORS',
|
||||
|
@ -25,11 +25,43 @@ executable(
|
||||
)
|
||||
subdir('tests')
|
||||
|
||||
current_source_dir = meson.current_source_dir()
|
||||
if HAS_KEA_MSG_COMPILER
|
||||
current_source_dir = meson.current_source_dir()
|
||||
target_gen_messages = run_target(
|
||||
'src-bin-agent-ca_messages',
|
||||
command: [kea_msg_compiler, f'@current_source_dir@/ca_messages.mes'],
|
||||
)
|
||||
TARGETS_GEN_MESSAGES += [target_gen_messages]
|
||||
endif
|
||||
|
||||
if flex_exe.found() and bison_exe.found()
|
||||
target_parser = run_target(
|
||||
'src-bin-agent-parser',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
BISON,
|
||||
'-Wno-yacc',
|
||||
'--defines=agent_parser.h',
|
||||
'--report=all',
|
||||
'--report-file=agent_parser.report',
|
||||
'-o',
|
||||
'agent_parser.cc',
|
||||
'agent_parser.yy',
|
||||
],
|
||||
)
|
||||
target_lexer = run_target(
|
||||
'src-bin-agent-lexer',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
FLEX,
|
||||
'--prefix',
|
||||
'agent_',
|
||||
'-o',
|
||||
'agent_lexer.cc',
|
||||
'agent_lexer.ll',
|
||||
],
|
||||
)
|
||||
TARGETS_GEN_PARSER += [target_parser, target_lexer]
|
||||
endif
|
||||
|
@ -28,3 +28,36 @@ executable(
|
||||
link_with: [d2_lib] + LIBS_BUILT_SO_FAR,
|
||||
)
|
||||
subdir('tests')
|
||||
|
||||
if flex_exe.found() and bison_exe.found()
|
||||
current_source_dir = meson.current_source_dir()
|
||||
target_parser = run_target(
|
||||
'src-bin-d2-parser',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
BISON,
|
||||
'-Wno-yacc',
|
||||
'--defines=d2_parser.h',
|
||||
'--report=all',
|
||||
'--report-file=d2_parser.report',
|
||||
'-o',
|
||||
'd2_parser.cc',
|
||||
'd2_parser.yy',
|
||||
],
|
||||
)
|
||||
target_lexer = run_target(
|
||||
'src-bin-d2-lexer',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
FLEX,
|
||||
'--prefix',
|
||||
'd2_parser_',
|
||||
'-o',
|
||||
'd2_lexer.cc',
|
||||
'd2_lexer.ll',
|
||||
],
|
||||
)
|
||||
TARGETS_GEN_PARSER += [target_parser, target_lexer]
|
||||
endif
|
||||
|
@ -24,11 +24,43 @@ executable(
|
||||
)
|
||||
subdir('tests')
|
||||
|
||||
current_source_dir = meson.current_source_dir()
|
||||
if HAS_KEA_MSG_COMPILER
|
||||
current_source_dir = meson.current_source_dir()
|
||||
target_gen_messages = run_target(
|
||||
'src-bin-dhcp4-dhcp4_messages',
|
||||
command: [kea_msg_compiler, f'@current_source_dir@/dhcp4_messages.mes'],
|
||||
)
|
||||
TARGETS_GEN_MESSAGES += [target_gen_messages]
|
||||
endif
|
||||
|
||||
if flex_exe.found() and bison_exe.found()
|
||||
target_parser = run_target(
|
||||
'src-bin-dhcp4-parser',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
BISON,
|
||||
'-Wno-yacc',
|
||||
'--defines=dhcp4_parser.h',
|
||||
'--report=all',
|
||||
'--report-file=dhcp4_parser.report',
|
||||
'-o',
|
||||
'dhcp4_parser.cc',
|
||||
'dhcp4_parser.yy',
|
||||
],
|
||||
)
|
||||
target_lexer = run_target(
|
||||
'src-bin-dhcp4-lexer',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
FLEX,
|
||||
'--prefix',
|
||||
'parser4_',
|
||||
'-o',
|
||||
'dhcp4_lexer.cc',
|
||||
'dhcp4_lexer.ll',
|
||||
],
|
||||
)
|
||||
TARGETS_GEN_PARSER += [target_parser, target_lexer]
|
||||
endif
|
||||
|
@ -25,11 +25,43 @@ executable(
|
||||
)
|
||||
subdir('tests')
|
||||
|
||||
current_source_dir = meson.current_source_dir()
|
||||
if HAS_KEA_MSG_COMPILER
|
||||
current_source_dir = meson.current_source_dir()
|
||||
target_gen_messages = run_target(
|
||||
'src-bin-dhcp6-dhcp6_messages',
|
||||
command: [kea_msg_compiler, f'@current_source_dir@/dhcp6_messages.mes'],
|
||||
)
|
||||
TARGETS_GEN_MESSAGES += [target_gen_messages]
|
||||
endif
|
||||
|
||||
if flex_exe.found() and bison_exe.found()
|
||||
target_parser = run_target(
|
||||
'src-bin-dhcp6-parser',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
BISON,
|
||||
'-Wno-yacc',
|
||||
'--defines=dhcp6_parser.h',
|
||||
'--report=all',
|
||||
'--report-file=dhcp6_parser.report',
|
||||
'-o',
|
||||
'dhcp6_parser.cc',
|
||||
'dhcp6_parser.yy',
|
||||
],
|
||||
)
|
||||
target_lexer = run_target(
|
||||
'src-bin-dhcp6-lexer',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
FLEX,
|
||||
'--prefix',
|
||||
'parser6_',
|
||||
'-o',
|
||||
'dhcp6_lexer.cc',
|
||||
'dhcp6_lexer.ll',
|
||||
],
|
||||
)
|
||||
TARGETS_GEN_PARSER += [target_parser, target_lexer]
|
||||
endif
|
||||
|
@ -38,8 +38,8 @@ executable(
|
||||
|
||||
subdir('tests')
|
||||
|
||||
current_source_dir = meson.current_source_dir()
|
||||
if HAS_KEA_MSG_COMPILER
|
||||
current_source_dir = meson.current_source_dir()
|
||||
target_gen_messages = run_target(
|
||||
'src-bin-netconf-netconf_messages',
|
||||
command: [
|
||||
@ -49,3 +49,35 @@ if HAS_KEA_MSG_COMPILER
|
||||
)
|
||||
TARGETS_GEN_MESSAGES += [target_gen_messages]
|
||||
endif
|
||||
|
||||
if flex_exe.found() and bison_exe.found()
|
||||
target_parser = run_target(
|
||||
'src-bin-netconf-parser',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
BISON,
|
||||
'-Wno-yacc',
|
||||
'--defines=netconf_parser.h',
|
||||
'--report=all',
|
||||
'--report-file=netconf_parser.report',
|
||||
'-o',
|
||||
'netconf_parser.cc',
|
||||
'netconf_parser.yy',
|
||||
],
|
||||
)
|
||||
target_lexer = run_target(
|
||||
'src-bin-netconf-lexer',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
FLEX,
|
||||
'--prefix',
|
||||
'netconf_',
|
||||
'-o',
|
||||
'netconf_lexer.cc',
|
||||
'netconf_lexer.ll',
|
||||
],
|
||||
)
|
||||
TARGETS_GEN_PARSER += [target_parser, target_lexer]
|
||||
endif
|
||||
|
@ -3,7 +3,7 @@ if not python_exe.found()
|
||||
endif
|
||||
|
||||
kea_shell_conf_data = configuration_data()
|
||||
kea_shell_conf_data.set('PYTHON', python_exe.full_path())
|
||||
kea_shell_conf_data.set('PYTHON', PYTHON)
|
||||
kea_shell_conf_data.set('PACKAGE_VERSION', project_version)
|
||||
kea_shell_conf_data.set('EXTENDED_VERSION', project_version + ' (tarball)')
|
||||
|
||||
|
@ -3,7 +3,7 @@ if not gtest.found()
|
||||
endif
|
||||
|
||||
shell_tests_conf_data = configuration_data()
|
||||
shell_tests_conf_data.set('PYTHON', python_exe.full_path())
|
||||
shell_tests_conf_data.set('PYTHON', PYTHON)
|
||||
shell_tests_conf_data.set('abs_top_builddir', TOP_BUILD_DIR)
|
||||
shell_tests_conf_data.set('abs_top_srcdir', TOP_SOURCE_DIR)
|
||||
shell_unittest = configure_file(
|
||||
|
@ -27,11 +27,41 @@ kea_eval_headers = [
|
||||
]
|
||||
install_headers(kea_eval_headers, preserve_path: true, subdir: 'kea/eval')
|
||||
|
||||
current_source_dir = meson.current_source_dir()
|
||||
if HAS_KEA_MSG_COMPILER
|
||||
current_source_dir = meson.current_source_dir()
|
||||
target_gen_messages = run_target(
|
||||
'src-lib-eval-eval_messages',
|
||||
command: [kea_msg_compiler, f'@current_source_dir@/eval_messages.mes'],
|
||||
)
|
||||
TARGETS_GEN_MESSAGES += [target_gen_messages]
|
||||
endif
|
||||
|
||||
if flex_exe.found() and bison_exe.found()
|
||||
target_parser = run_target(
|
||||
'src-lib-eval-parser',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
BISON,
|
||||
'-Wno-yacc',
|
||||
'--defines=parser.h',
|
||||
'-o',
|
||||
'parser.cc',
|
||||
'parser.yy',
|
||||
],
|
||||
)
|
||||
target_lexer = run_target(
|
||||
'src-lib-eval-lexer',
|
||||
command: [
|
||||
CD_AND_RUN,
|
||||
current_source_dir,
|
||||
FLEX,
|
||||
'--prefix',
|
||||
'eval',
|
||||
'-o',
|
||||
'lexer.cc',
|
||||
'lexer.ll',
|
||||
],
|
||||
)
|
||||
TARGETS_GEN_PARSER += [target_parser, target_lexer]
|
||||
endif
|
||||
|
@ -4,7 +4,7 @@ endif
|
||||
|
||||
configure_file(input: 'const2hdr.py', output: 'const2hdr.py', copy: true)
|
||||
util_python_conf_data = configuration_data()
|
||||
util_python_conf_data.set('PYTHON', python_exe.full_path())
|
||||
util_python_conf_data.set('PYTHON', PYTHON)
|
||||
configure_file(
|
||||
input: 'gen_wiredata.py.in',
|
||||
output: 'gen_wiredata.py',
|
||||
|
@ -6,12 +6,12 @@ tools_conf_data.set('exec_prefix', '${prefix}')
|
||||
tools_conf_data.set('libdir', '${exec_prefix}/' + get_option('libdir'))
|
||||
tools_conf_data.set('SEP', '+')
|
||||
if bison_exe.found()
|
||||
tools_conf_data.set('YACC', bison_exe.full_path())
|
||||
tools_conf_data.set('YACC', BISON)
|
||||
else
|
||||
tools_conf_data.set('YACC', 'bison')
|
||||
endif
|
||||
if awk_exe.found()
|
||||
tools_conf_data.set('AWK', awk_exe.full_path())
|
||||
tools_conf_data.set('AWK', AWK)
|
||||
else
|
||||
tools_conf_data.set('AWK', 'awk')
|
||||
endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user