Skip to content

Commit 8e07835

Browse files
committed
[#3730] Add other meson targets
- add-changelog-entry - coverage (.lcovrc) - cppcheck, cppcheck-report - doc (renamed from docs) - grammar - mes-doc - uml - update-python-dependencies - valgrind (add_test_setup instead of custom target)
1 parent ac5c781 commit 8e07835

15 files changed

+202
-99
lines changed

.lcovrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore_errors = gcov,inconsistent,mismatch,source

configure.ac

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,10 +1393,6 @@ AC_ARG_ENABLE(logger-checks,
13931393
AM_CONDITIONAL(ENABLE_LOGGER_CHECKS, test x$enable_logger_checks != xno)
13941394
AM_COND_IF([ENABLE_LOGGER_CHECKS], [AC_DEFINE([ENABLE_LOGGER_CHECKS], [1], [Check logger messages?])])
13951395

1396-
# Check for asciidoc
1397-
AC_PATH_PROG(ASCIIDOC, asciidoc, no)
1398-
AM_CONDITIONAL(HAVE_ASCIIDOC, test "x$ASCIIDOC" != "xno")
1399-
14001396
# Check for plantuml
14011397
AC_PATH_PROG(PLANTUML, plantuml, no)
14021398
AM_CONDITIONAL(HAVE_PLANTUML, test "x$PLANTUML" != "xno")

doc/devel/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ configure_file(
1313
configuration: make_devel_conf_data,
1414
)
1515
make_devel = f'@current_build_dir@/make-devel.sh'
16-
run_target('make-devel', command: [CD_AND_RUN, current_source_dir, make_devel])
16+
MAKE_DEVEL = run_target('make-devel', command: [CD_AND_RUN, current_source_dir, make_devel])

doc/make-grammar.sh.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
# Expressions don't expand in single quotes, use double quotes for that. [SC2016]
4+
# shellcheck disable=SC2016
5+
6+
set -euv
7+
8+
cd @TOP_SOURCE_DIR@
9+
10+
mkdir -p doc/sphinx/grammar
11+
12+
./tools/extract_bnf.sh src/bin/dhcp4/dhcp4_parser \
13+
--markdown ':ref:`dhcp4`' > doc/sphinx/grammar/grammar-dhcp4-parser.rst
14+
./tools/extract_bnf.sh src/bin/dhcp6/dhcp6_parser \
15+
--markdown ':ref:`dhcp6`' > doc/sphinx/grammar/grammar-dhcp6-parser.rst
16+
./tools/extract_bnf.sh src/bin/d2/d2_parser \
17+
--markdown ':ref:`dhcp-ddns-server`' > doc/sphinx/grammar/grammar-d2-parser.rst
18+
./tools/extract_bnf.sh src/bin/agent/agent_parser \
19+
--markdown ':ref:`kea-ctrl-agent`' > doc/sphinx/grammar/grammar-ca-parser.rst
20+
./tools/extract_bnf.sh src/bin/netconf/netconf_parser \
21+
--markdown ':ref:`netconf`' > doc/sphinx/grammar/grammar-netconf-parser.rst

doc/meson.build

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,11 @@ examples = [
7878
'examples/netconf/comments.json',
7979
'examples/netconf/simple-dhcp4.json',
8080
'examples/netconf/simple-dhcp6.json',
81-
8281
'examples/template-power-user-home/info.md',
8382
'examples/template-power-user-home/kea-ca-1.conf',
8483
'examples/template-power-user-home/kea-ca-2.conf',
8584
'examples/template-power-user-home/kea-dhcp4-1.conf',
8685
'examples/template-power-user-home/kea-dhcp4-2.conf',
87-
8886
'examples/template-ha-mt-tls/info.md',
8987
'examples/template-ha-mt-tls/kea-ca-1.conf',
9088
'examples/template-ha-mt-tls/kea-ca-2.conf',
@@ -93,4 +91,9 @@ examples = [
9391
]
9492
install_data(examples, preserve_path: true, install_dir: 'share/doc/kea')
9593

96-
# grammar target
94+
make_grammar = configure_file(
95+
input: 'make-grammar.sh.in',
96+
output: 'make-grammar.sh',
97+
configuration: {'TOP_SOURCE_DIR': TOP_SOURCE_DIR},
98+
)
99+
MAKE_GRAMMAR = run_target('make-grammar', command: [make_grammar])

doc/sphinx/make-mes-doc.sh.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
set -euv
4+
5+
cd @TOP_SOURCE_DIR@
6+
7+
# api-files.txt
8+
find src/share/api -type f -name '[a-z]*.json' | sort -V > "@srcdir@/api-files.txt"
9+
10+
# mes-files.txt
11+
find . -type f -name '*.mes' | sort -V | sed 's#^./##g' > "@srcdir@/mes-files.txt"
12+
13+
# debug-messages.rst
14+
@PYTHON@ ./tools/check-messages.py --generate-debug-messages-page
15+
16+
# kea-messages.rst
17+
cd @srcdir@
18+
@PYTHON@ ./mes2doc.py -o kea-messages.rst

doc/sphinx/make-uml.sh.in

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
set -euv
4+
5+
cd @srcdir@
6+
7+
if test "@HAVE_PLANTUML@" != "no" ; then
8+
# uml-to-png
9+
# shellcheck disable=SC2043
10+
for uml in @umls@; do @PLANTUML@ -tpng "$uml"; done
11+
# uml-to-svg
12+
# shellcheck disable=SC2043
13+
for uml in @umls@; do @PLANTUML@ -tsvg "$uml"; done
14+
# format-svgs
15+
if test "@HAVE_XMLLINT" != "no" ; then
16+
# shellcheck disable=SC2043
17+
for svg in @svgs@; do xmllint --format "$svg" > tmp; mv tmp "$svg"; done
18+
else
19+
printf 'WARNING: xmllint not found. SVGs not formatted.\n'
20+
fi
21+
# uml-to-txt
22+
# shellcheck disable=SC2043
23+
for uml in @tumls@; do @PLANTUML@ -ttxt "$uml"; done
24+
# shellcheck disable=SC2043
25+
for txt in @txts@; do sed 's/ *$//g' "$txt" > tmp; mv tmp "$txt"; done
26+
fi
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
set -euv
4+
5+
cd @srcdir@
6+
7+
if test "@HAVE_PIP_COMPILE@" != "no" ; then
8+
rm -f ./src/requirements.txt
9+
pip-compile -r ./src/requirements.in
10+
fi

doc/sphinx/meson.build

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,36 @@ mandir = get_option('mandir')
120120
mandir8 = f'@PREFIX@/@mandir@/man8/'
121121
make_conf_data.set('mandir8', mandir8)
122122

123+
MAKE_DOC = disabler()
123124
if sphinx_exe.found()
124125
make_doc = configure_file(
125126
input: 'make-doc.sh.in',
126127
output: 'make-doc.sh',
127128
configuration: make_conf_data,
128129
)
129-
run_target('make-doc', command: [make_doc])
130+
MAKE_DOC = run_target('make-doc', command: [make_doc])
130131
endif
131-
regen_doc = configure_file(
132-
input: 'regen-doc.sh.in',
133-
output: 'regen-doc.sh',
134-
configuration: make_conf_data,
135-
)
136132
make_install = configure_file(
137133
input: 'make-install.sh.in',
138134
output: 'make-install.sh',
139135
configuration: make_conf_data,
140136
)
141-
run_target('regen-doc', command: [regen_doc])
137+
make_mes_doc = configure_file(
138+
input: 'make-mes-doc.sh.in',
139+
output: 'make-mes-doc.sh',
140+
configuration: make_conf_data,
141+
)
142+
make_uml = configure_file(
143+
input: 'make-uml.sh.in',
144+
output: 'make-uml.sh',
145+
configuration: make_conf_data,
146+
)
147+
make_update_python_dependencies = configure_file(
148+
input: 'make-update-python-dependencies.sh.in',
149+
output: 'make-update-python-dependencies.sh',
150+
configuration: make_conf_data,
151+
)
142152
meson.add_install_script(make_install)
153+
MAKE_MES_DOC = run_target('make-mes-doc', command: [make_mes_doc])
154+
MAKE_UML = run_target('make-uml', command: [make_uml])
155+
MAKE_UPDATE_PYTHON_DEPENDENCIES = run_target('make-update-python-dependencies', command: [make_update_python_dependencies])

doc/sphinx/regen-doc.sh.in

Lines changed: 0 additions & 48 deletions
This file was deleted.

meson.build

Lines changed: 92 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ awk_exe = find_program('gawk', 'awk', required: false)
162162
doxygen_exe = find_program('doxygen', required: false)
163163
sphinx_exe = find_program('sphinx-build', 'sphinx-build-3', required: false)
164164
pdflatex_exe = find_program('pdflatex', required: false)
165-
asciidoc_exe = find_program('asciidoc', required: false)
166165
plantuml_exe = find_program('plantuml', required: false)
167166
xmllint_exe = find_program('xmllint', required: false)
168167
pip_compile_exe = find_program('pip-compile', required: false)
@@ -436,26 +435,6 @@ else
436435
conf_data.set('PREMIUM_EXTENDED_VERSION', '"no"')
437436
endif
438437

439-
#### Configuration Files
440-
441-
# TODO: Change to config.h.in when autotools are removed.
442-
configure_file(
443-
input: 'meson-config.h.in',
444-
output: 'config.h',
445-
configuration: conf_data,
446-
install: true,
447-
install_dir: 'include/kea',
448-
)
449-
450-
# TODO: Change to kea_version.h.in when autotools are removed.
451-
configure_file(
452-
input: 'meson-kea_version.h.in',
453-
output: 'kea_version.h',
454-
configuration: conf_data,
455-
install: true,
456-
install_dir: 'include/kea',
457-
)
458-
459438
#### Default Includes
460439

461440
INCLUDES = [
@@ -669,18 +648,94 @@ else
669648
report_conf_data.set('GTEST_LIBDIR', 'unknown')
670649
endif
671650

651+
#### Configuration Files
652+
672653
config_report_sh = configure_file(
673654
input: 'config-report.sh.in',
674655
output: 'config-report.sh',
675656
configuration: report_conf_data,
676657
)
677-
config_report = custom_target(
678-
'config.report',
658+
659+
# TODO: Change to config.h.in when autotools are removed.
660+
configure_file(
661+
input: 'meson-config.h.in',
662+
output: 'config.h',
663+
configuration: conf_data,
664+
install: true,
665+
install_dir: 'include/kea',
666+
)
667+
668+
# TODO: Change to kea_version.h.in when autotools are removed.
669+
configure_file(
670+
input: 'meson-kea_version.h.in',
671+
output: 'kea_version.h',
672+
configuration: conf_data,
673+
install: true,
674+
install_dir: 'include/kea',
675+
)
676+
677+
#### Custom Targets
678+
679+
run_target(
680+
'add-changelog-entry',
681+
command: ['changelog_unreleased/.add-entry.sh'],
682+
)
683+
684+
CONFIG_REPORT = custom_target(
679685
output: 'config.report',
680-
depend_files: config_report_sh,
686+
depend_files: [config_report_sh],
681687
command: [f'@TOP_BUILD_DIR@/config-report.sh'],
682688
)
683689

690+
run_target(
691+
'cppcheck',
692+
command: [
693+
'cppcheck',
694+
'-I.',
695+
'-I./src/lib',
696+
'-I./src/bin',
697+
'--error-exitcode=1',
698+
'--inline-suppr',
699+
'--quiet',
700+
'--max-configs=256',
701+
f'--suppressions-list=@TOP_SOURCE_DIR@/src/cppcheck-suppress.lst',
702+
'--template={file}:{line}: check_fail: {message} ({severity},{id})',
703+
'--xml',
704+
'--xml-version=2',
705+
'.',
706+
'>',
707+
'cppcheck-result.xml',
708+
'2>&1',
709+
],
710+
)
711+
712+
run_target(
713+
'cppcheck-report',
714+
command: [
715+
'cppcheck-htmlreport',
716+
'--file',
717+
'./cppcheck-result.xml',
718+
'--report-dir',
719+
'./report',
720+
'--title',
721+
'"cppcheck report"',
722+
],
723+
)
724+
725+
add_test_setup(
726+
'valgrind',
727+
exe_wrapper: [
728+
valgrind_exe,
729+
'--child-silent-after-fork=yes',
730+
'--fullpath-after=',
731+
'--leak-check=full',
732+
'--num-callers=64',
733+
'--quiet',
734+
'--show-leak-kinds=all',
735+
'--suppressions=src/valgrind.supp',
736+
],
737+
)
738+
684739
#### Build Starts Here
685740

686741
LIBS_BUILT_SO_FAR = []
@@ -694,18 +749,26 @@ if have_premium
694749
subdir('premium')
695750
endif
696751

697-
alias_target('messages', TARGETS_GEN_MESSAGES)
698-
alias_target('parser', TARGETS_GEN_PARSER)
699-
700752
top_docs = [
701753
'AUTHORS',
754+
'CONTRIBUTING.md',
702755
'COPYING',
703756
'ChangeLog',
704757
'README',
705-
'CONTRIBUTING.md',
706758
'SECURITY.md',
707-
'platforms.rst',
708759
'code_of_conduct.md',
760+
'platforms.rst',
709761
]
710762
install_data(top_docs, install_dir: 'share/doc/kea')
711763
install_emptydir('var/run/kea')
764+
765+
#### More Custom Targets
766+
767+
alias_target('doc', MAKE_DOC)
768+
alias_target('devel', MAKE_DEVEL)
769+
alias_target('grammar', MAKE_GRAMMAR)
770+
alias_target('messages', TARGETS_GEN_MESSAGES)
771+
alias_target('mes-doc', MAKE_MES_DOC)
772+
alias_target('parser', TARGETS_GEN_PARSER)
773+
alias_target('uml', MAKE_UML)
774+
alias_target('update-python-dependencies', MAKE_UPDATE_PYTHON_DEPENDENCIES)

src/bin/netconf/netconf_messages.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// File created from ../../../src/bin/netconf/netconf_messages.mes
1+
// File created from src/bin/netconf/netconf_messages.mes
22

33
#include <cstddef>
44
#include <log/message_types.h>

src/bin/netconf/netconf_messages.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// File created from ../../../src/bin/netconf/netconf_messages.mes
1+
// File created from src/bin/netconf/netconf_messages.mes
22

33
#ifndef NETCONF_MESSAGES_H
44
#define NETCONF_MESSAGES_H

0 commit comments

Comments
 (0)