mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 09:57:41 +00:00
[#3731] Add Meson build options
This commit is contained in:
parent
8fb0025d2e
commit
d13b62c4f6
@ -1,4 +1,4 @@
|
|||||||
if not gtest.found()
|
if FUZZ_OPT != 'enabled'
|
||||||
subdir_done()
|
subdir_done()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ cpp_flags = [
|
|||||||
f'-DKEA_LFC_SOURCES="@KEA_LFC@"',
|
f'-DKEA_LFC_SOURCES="@KEA_LFC@"',
|
||||||
f'-DKEA_LFC_INSTALLATION="@PREFIX@/sbin/kea-lfc"',
|
f'-DKEA_LFC_INSTALLATION="@PREFIX@/sbin/kea-lfc"',
|
||||||
]
|
]
|
||||||
if FUZZING_IN_CI
|
if FUZZ_OPT == 'clusterfuzzlite'
|
||||||
cpp_flags = ['-fsanitize=fuzzer', '-gdwarf-4']
|
cpp_flags = ['-fsanitize=fuzzer', '-gdwarf-4']
|
||||||
else
|
else
|
||||||
fuzz_sources += ['main.cc']
|
fuzz_sources += ['main.cc']
|
||||||
|
199
meson.build
199
meson.build
@ -1,5 +1,6 @@
|
|||||||
# Require meson >= 0.64.0 for preserve_path arg in install_data.
|
# Require meson >= 0.64.0 for preserve_path arg in install_data.
|
||||||
project('kea', 'cpp', version: '2.7.7-git', meson_version: '>=0.64.0')
|
# Require meson >= 1.1.0 for meson.options file.
|
||||||
|
project('kea', 'cpp', version: '2.7.7-git', meson_version: '>=1.1.0')
|
||||||
|
|
||||||
cpp = meson.get_compiler('cpp')
|
cpp = meson.get_compiler('cpp')
|
||||||
PROJECT_VERSION = meson.project_version()
|
PROJECT_VERSION = meson.project_version()
|
||||||
@ -25,9 +26,6 @@ TEST_CA_DIR = f'@TOP_SOURCE_DIR@/src/lib/asiolink/testutils/ca'
|
|||||||
DATABASE_SCRIPTS_DIR = f'@TOP_BUILD_DIR@/src/share/database/scripts'
|
DATABASE_SCRIPTS_DIR = f'@TOP_BUILD_DIR@/src/share/database/scripts'
|
||||||
LEGAL_LOG_DIR = f'@PREFIX@/@RUN_STATE_DIR@/lib/kea'
|
LEGAL_LOG_DIR = f'@PREFIX@/@RUN_STATE_DIR@/lib/kea'
|
||||||
|
|
||||||
# TODO: Control it via a build option.
|
|
||||||
FUZZING_IN_CI = false
|
|
||||||
|
|
||||||
#### Configuration Data
|
#### Configuration Data
|
||||||
|
|
||||||
conf_data = configuration_data(
|
conf_data = configuration_data(
|
||||||
@ -36,7 +34,6 @@ conf_data = configuration_data(
|
|||||||
# 'ENABLE_DEBUG': false,
|
# 'ENABLE_DEBUG': false,
|
||||||
# 'ENABLE_LOGGER_CHECKS': false,
|
# 'ENABLE_LOGGER_CHECKS': false,
|
||||||
'EXTENDED_VERSION': '"tarball"',
|
'EXTENDED_VERSION': '"tarball"',
|
||||||
'FUZZING': true,
|
|
||||||
# 'HAS_UNDEFINED_PTHREAD_BEHAVIOR': false,
|
# 'HAS_UNDEFINED_PTHREAD_BEHAVIOR': false,
|
||||||
# 'HAVE_AFL': false,
|
# 'HAVE_AFL': false,
|
||||||
# 'HAVE_BOOST_ASIO_COROUTINE_HPP': false,
|
# 'HAVE_BOOST_ASIO_COROUTINE_HPP': false,
|
||||||
@ -143,7 +140,7 @@ elif SYSTEM == 'darwin'
|
|||||||
conf_data.set('OS_OSX', true)
|
conf_data.set('OS_OSX', true)
|
||||||
OS_TYPE = 'BSD'
|
OS_TYPE = 'BSD'
|
||||||
else
|
else
|
||||||
error(f'Build failed: Unsupported system "@SYSTEM@".')
|
error(f'Unsupported system "@SYSTEM@".')
|
||||||
endif
|
endif
|
||||||
message(f'Detected system "@SYSTEM@".')
|
message(f'Detected system "@SYSTEM@".')
|
||||||
|
|
||||||
@ -188,20 +185,6 @@ foreach dep : ['botan-2', 'botan']
|
|||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
openssl = dependency('openssl', required: false)
|
openssl = dependency('openssl', required: false)
|
||||||
if openssl.found()
|
|
||||||
crypto = openssl
|
|
||||||
conf_data.set('WITH_OPENSSL', true)
|
|
||||||
message('Using OpenSSL.')
|
|
||||||
elif botan.found()
|
|
||||||
crypto = botan
|
|
||||||
conf_data.set('WITH_BOTAN', true)
|
|
||||||
message('Using Botan.')
|
|
||||||
message('Checking Botan Boost support.')
|
|
||||||
cpp.has_header('botan/asio_stream.h', dependencies: [botan], required: true)
|
|
||||||
endif
|
|
||||||
if not crypto.found()
|
|
||||||
error('Build failed: Could not find neither botan nor openssl libraries.')
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Kerberos
|
# Kerberos
|
||||||
krb5 = disabler()
|
krb5 = disabler()
|
||||||
@ -253,9 +236,6 @@ foreach mysql_config_file : ['mariadb_config', 'mysql_config']
|
|||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
if mysql.found()
|
|
||||||
conf_data.set('HAVE_MYSQL', true)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# PostgreSQL
|
# PostgreSQL
|
||||||
postgresql = dependency('libpq', required: false)
|
postgresql = dependency('libpq', required: false)
|
||||||
@ -278,9 +258,6 @@ if pg_config.found()
|
|||||||
)
|
)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if postgresql.found()
|
|
||||||
conf_data.set('HAVE_PGSQL', true)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# NETCONF
|
# NETCONF
|
||||||
netconf_deps = {}
|
netconf_deps = {}
|
||||||
@ -334,6 +311,153 @@ foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
|
|||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
#### Build Options
|
||||||
|
|
||||||
|
all_opt = get_option('all')
|
||||||
|
crypto_opt = get_option('crypto')
|
||||||
|
gtest_opt = get_option('gtest')
|
||||||
|
krb5_opt = get_option('krb5')
|
||||||
|
mysql_opt = get_option('mysql')
|
||||||
|
netconf_opt = get_option('netconf')
|
||||||
|
postgresql_opt = get_option('postgresql')
|
||||||
|
|
||||||
|
# docs_opt = get_option('docs')
|
||||||
|
# parser_opt = get_option('parser')
|
||||||
|
|
||||||
|
FUZZ_OPT = get_option('fuzz')
|
||||||
|
PERFDHCP_OPT = get_option('perfdhcp')
|
||||||
|
SHELL_OPT = get_option('shell')
|
||||||
|
if SHELL_OPT == 'enabled' and not PYTHON.found()
|
||||||
|
error('kea-shell requires python. Python not found.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if crypto_opt == 'auto'
|
||||||
|
if openssl.found()
|
||||||
|
crypto = openssl
|
||||||
|
elif botan.found()
|
||||||
|
crypto = botan
|
||||||
|
endif
|
||||||
|
elif crypto_opt == 'botan'
|
||||||
|
if botan.found()
|
||||||
|
crypto = botan
|
||||||
|
endif
|
||||||
|
elif crypto_opt == 'openssl'
|
||||||
|
if openssl.found()
|
||||||
|
crypto = openssl
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if crypto.name() == botan.name()
|
||||||
|
message('Checking Botan Boost support.')
|
||||||
|
cpp.has_header('botan/asio_stream.h', dependencies: [botan], required: true)
|
||||||
|
conf_data.set('WITH_BOTAN', true)
|
||||||
|
message('Using Botan.')
|
||||||
|
elif crypto.name() == openssl.name()
|
||||||
|
conf_data.set('WITH_OPENSSL', true)
|
||||||
|
message('Using OpenSSL.')
|
||||||
|
else
|
||||||
|
error('Dependency not found: neither Botan nor OpenSSL.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if all_opt.enabled()
|
||||||
|
if gtest_opt == 'disabled'
|
||||||
|
gtest = disabler()
|
||||||
|
elif not gtest.found()
|
||||||
|
error('Dependency not found: GTest.')
|
||||||
|
endif
|
||||||
|
if krb5_opt == 'disabled'
|
||||||
|
krb5 = disabler()
|
||||||
|
elif not krb5.found()
|
||||||
|
error('Dependency not found: Kerberos 5 with GSSAPI.')
|
||||||
|
endif
|
||||||
|
if mysql_opt == 'disabled'
|
||||||
|
mysql = disabler()
|
||||||
|
elif not mysql.found()
|
||||||
|
error('Dependency not found: MySQL.')
|
||||||
|
endif
|
||||||
|
if netconf_opt == 'disabled'
|
||||||
|
NETCONF_DEPS_FOUND = false
|
||||||
|
elif not NETCONF_DEPS_FOUND
|
||||||
|
error('Dependency not found: NETCONF.')
|
||||||
|
endif
|
||||||
|
if postgresql_opt == 'disabled'
|
||||||
|
postgresql = disabler()
|
||||||
|
elif not postgresql.found()
|
||||||
|
error('Dependency not found: PostgreSQL.')
|
||||||
|
endif
|
||||||
|
if FUZZ_OPT != 'disabled'
|
||||||
|
FUZZ_OPT = 'enabled'
|
||||||
|
endif
|
||||||
|
if PERFDHCP_OPT != 'disabled'
|
||||||
|
PERFDHCP_OPT = 'enabled'
|
||||||
|
endif
|
||||||
|
if SHELL_OPT != 'disabled'
|
||||||
|
SHELL_OPT = 'enabled'
|
||||||
|
endif
|
||||||
|
elif all_opt.disabled()
|
||||||
|
if gtest_opt != 'enabled'
|
||||||
|
gtest = disabler()
|
||||||
|
endif
|
||||||
|
if krb5_opt != 'enabled'
|
||||||
|
krb5 = disabler()
|
||||||
|
endif
|
||||||
|
if mysql_opt != 'enabled'
|
||||||
|
mysql = disabler()
|
||||||
|
endif
|
||||||
|
if netconf_opt != 'enabled'
|
||||||
|
NETCONF_DEPS_FOUND = false
|
||||||
|
endif
|
||||||
|
if postgresql_opt != 'enabled'
|
||||||
|
postgresql = disabler()
|
||||||
|
endif
|
||||||
|
if FUZZ_OPT != 'enabled'
|
||||||
|
FUZZ_OPT = 'disabled'
|
||||||
|
endif
|
||||||
|
if PERFDHCP_OPT != 'enabled'
|
||||||
|
PERFDHCP_OPT = 'disabled'
|
||||||
|
endif
|
||||||
|
if SHELL_OPT != 'enabled'
|
||||||
|
SHELL_OPT = 'disabled'
|
||||||
|
endif
|
||||||
|
elif all_opt.auto()
|
||||||
|
if gtest_opt == 'enabled' and not gtest.found()
|
||||||
|
error('Dependency not found: GTest.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if krb5_opt == 'enabled' and not krb5.found()
|
||||||
|
error('Dependency not found: Kerberos 5 with GSSAPI.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if mysql_opt == 'enabled' and not mysql.found()
|
||||||
|
error('Dependency not found: MySQL.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if netconf_opt == 'enabled' and not NETCONF_DEPS_FOUND
|
||||||
|
error('Dependency not found: NETCONF.')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if postgresql_opt == 'enabled' and not postgresql.found()
|
||||||
|
error('Dependency not found: PostgreSQL.')
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
error('Unknown value for -Dall')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if FUZZ_OPT == 'enabled'
|
||||||
|
if not gtest.found()
|
||||||
|
error('Fuzzing requires gtest. Gtest not found.')
|
||||||
|
endif
|
||||||
|
conf_data.set('FUZZING', true)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if mysql.found()
|
||||||
|
conf_data.set('HAVE_MYSQL', true)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if postgresql.found()
|
||||||
|
conf_data.set('HAVE_PGSQL', true)
|
||||||
|
endif
|
||||||
|
|
||||||
#### Compiler Checks
|
#### Compiler Checks
|
||||||
|
|
||||||
result = cpp.run(
|
result = cpp.run(
|
||||||
@ -379,7 +503,6 @@ result = cpp.run(
|
|||||||
)
|
)
|
||||||
conf_data.set('LOG4CPLUS_INITIALIZER_H', result.returncode() == 0)
|
conf_data.set('LOG4CPLUS_INITIALIZER_H', result.returncode() == 0)
|
||||||
|
|
||||||
|
|
||||||
if mysql.found()
|
if mysql.found()
|
||||||
result = cpp.run(
|
result = cpp.run(
|
||||||
fs.read('compiler-checks/mysql-my-bool.cc'),
|
fs.read('compiler-checks/mysql-my-bool.cc'),
|
||||||
@ -437,6 +560,7 @@ INCLUDES = [
|
|||||||
#### Build report
|
#### Build report
|
||||||
|
|
||||||
report_conf_data = configuration_data()
|
report_conf_data = configuration_data()
|
||||||
|
report_conf_data.merge_from(conf_data)
|
||||||
report_conf_data.set('TOP_BUILD_DIR', TOP_BUILD_DIR)
|
report_conf_data.set('TOP_BUILD_DIR', TOP_BUILD_DIR)
|
||||||
report_conf_data.set('PACKAGE_NAME', 'kea')
|
report_conf_data.set('PACKAGE_NAME', 'kea')
|
||||||
report_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION)
|
report_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION)
|
||||||
@ -450,11 +574,7 @@ if have_premium
|
|||||||
else
|
else
|
||||||
report_conf_data.set('PREMIUM', 'no')
|
report_conf_data.set('PREMIUM', 'no')
|
||||||
endif
|
endif
|
||||||
if meson.version().version_compare('>=1.1.0')
|
report_conf_data.set('BUILD_OPTIONS', meson.build_options())
|
||||||
report_conf_data.set('BUILD_OPTIONS', meson.build_options())
|
|
||||||
else
|
|
||||||
report_conf_data.set('BUILD_OPTIONS', 'unknown')
|
|
||||||
endif
|
|
||||||
report_conf_data.set('MESON_VERSION', meson.version())
|
report_conf_data.set('MESON_VERSION', meson.version())
|
||||||
report_conf_data.set('CXX', ' '.join(cpp.cmd_array()))
|
report_conf_data.set('CXX', ' '.join(cpp.cmd_array()))
|
||||||
report_conf_data.set('CXX_ID', cpp.get_id())
|
report_conf_data.set('CXX_ID', cpp.get_id())
|
||||||
@ -574,7 +694,6 @@ else
|
|||||||
report_conf_data.set('BISON', 'unknown')
|
report_conf_data.set('BISON', 'unknown')
|
||||||
endif
|
endif
|
||||||
if mysql.found()
|
if mysql.found()
|
||||||
report_conf_data.set('HAVE_MYSQL', 'yes')
|
|
||||||
if not mysql_config.found()
|
if not mysql_config.found()
|
||||||
report_conf_data.set('MYSQL_VERSION', mysql.version())
|
report_conf_data.set('MYSQL_VERSION', mysql.version())
|
||||||
report_conf_data.set(
|
report_conf_data.set(
|
||||||
@ -746,8 +865,18 @@ endif
|
|||||||
|
|
||||||
#### More Custom Targets
|
#### More Custom Targets
|
||||||
|
|
||||||
alias_target('messages', TARGETS_GEN_MESSAGES)
|
if TARGETS_GEN_MESSAGES.length() > 0
|
||||||
alias_target('parser', TARGETS_GEN_PARSER)
|
alias_target('messages', TARGETS_GEN_MESSAGES)
|
||||||
|
else
|
||||||
|
error(
|
||||||
|
'No messages to generate. This is probably an error in the ' + 'meson.build files.',
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
if TARGETS_GEN_PARSER.length() > 0
|
||||||
|
alias_target('parser', TARGETS_GEN_PARSER)
|
||||||
|
else
|
||||||
|
run_target('parser', command: 'echo Parser generation is disabled.'.split())
|
||||||
|
endif
|
||||||
|
|
||||||
#### Installation
|
#### Installation
|
||||||
|
|
||||||
|
2
meson.format
Normal file
2
meson.format
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
simplify_string_literals: false
|
||||||
|
sort_files: true
|
26
meson.options
Normal file
26
meson.options
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# all
|
||||||
|
option(
|
||||||
|
'all',
|
||||||
|
type: 'feature',
|
||||||
|
value: 'disabled',
|
||||||
|
description: 'Requires that all C++ dependencies be enabled: crypto (either botan or openssl), krb5 with gssapi, mysql, netconf, postgresql. Also enables generation of docs and parser which requires bison, flex, and sphinx. Also enables all parts of code: debug, fuzzing, logger-checks, perfdhcp, shell. Overrides the other options.',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Dependency-related options
|
||||||
|
option('crypto', type: 'combo', choices: ['auto', 'botan', 'openssl'], value: 'auto', description: 'Backend for cryptographical operations. Mandatory.')
|
||||||
|
option('krb5', type: 'combo', choices: ['', 'auto', 'enabled', 'disabled'], value: '', description: 'Support for GSS-TSIG. Requires krb5 with gssapi.')
|
||||||
|
option('gtest', type: 'combo', choices: ['', 'auto', 'enabled', 'disabled'], value: '', description: 'Support for unit tests with GTest.')
|
||||||
|
option('mysql', type: 'combo', choices: ['', 'auto', 'enabled', 'disabled'], value: '', description: 'Support for MySQL backends.')
|
||||||
|
option('netconf', type: 'combo', choices: ['', 'auto', 'enabled', 'disabled'], value: '', description: 'Support for kea-netconf.')
|
||||||
|
option('postgresql', type: 'combo', choices: ['', 'auto', 'enabled', 'disabled'], value: '', description: 'Support for PostgreSQL backends.')
|
||||||
|
|
||||||
|
# Used for development.
|
||||||
|
# option('docs', type: 'feature', choices: ['', 'auto', 'enabled', 'disabled'], value: '', description: 'Support for doc generation.')
|
||||||
|
# option('parser', type: 'feature', choices: ['', 'auto', 'enabled', 'disabled'], value: '', description: 'Support for parser generation.')
|
||||||
|
|
||||||
|
# Options for enabling various parts of code.
|
||||||
|
# debug?
|
||||||
|
# logger-checks?
|
||||||
|
option('fuzz', type: 'combo', choices: ['', 'auto', 'clusterfuzzlite', 'disabled', 'enabled'], value: '', description: 'Support for fuzz testing.')
|
||||||
|
option('perfdhcp', type: 'combo', choices: ['', 'auto', 'disabled', 'enabled'], value: '', description: 'Builds perfdhcp.')
|
||||||
|
option('shell', type: 'combo', choices: ['', 'auto', 'disabled', 'enabled'], value: '', description: 'Builds kea-shell.')
|
@ -1,3 +1,7 @@
|
|||||||
|
if PERFDHCP_OPT != 'enabled'
|
||||||
|
subdir_done()
|
||||||
|
endif
|
||||||
|
|
||||||
perfdhcp_lib = static_library(
|
perfdhcp_lib = static_library(
|
||||||
'perfdhcp',
|
'perfdhcp',
|
||||||
'avalanche_scen.cc',
|
'avalanche_scen.cc',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
if not PYTHON.found()
|
if SHELL_OPT != 'enabled'
|
||||||
subdir_done()
|
subdir_done()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user