--- /dev/null
+#!/bin/sh
+
+cd "$1" || exit 1
+shift
+exec "$@"
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.
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])
#### 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)
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')
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',
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
LIBS_BUILT_SO_FAR = []
TARGETS_GEN_MESSAGES = []
+TARGETS_GEN_PARSER = []
subdir('tools')
subdir('src')
subdir('fuzz')
endif
alias_target('all-targets-gen-messages', TARGETS_GEN_MESSAGES)
+alias_target('all-targets-gen-parser', TARGETS_GEN_PARSER)
top_docs = [
'AUTHORS',
)
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
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
)
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
)
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
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: [
)
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
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)')
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(
]
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
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',
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