2025-03-15 22:37:04 +01:00
|
|
|
# Copyright (C) 2025 Internet Systems Consortium, Inc. ("ISC")
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
#
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
#
|
|
|
|
# See the COPYING file distributed with this work for additional
|
|
|
|
# information regarding copyright ownership.
|
|
|
|
|
2025-02-11 15:47:46 +02:00
|
|
|
# Require meson >= 0.64.0 for preserve_path arg in install_data.
|
2025-03-03 17:01:09 +02:00
|
|
|
# Require meson >= 1.1.0 for meson.options file.
|
2025-03-17 13:50:22 +01:00
|
|
|
# bug_report is not yet supported by meson,its value will be
|
|
|
|
# 'kea-dev@lists.isc.org'
|
2025-03-15 22:37:04 +01:00
|
|
|
|
|
|
|
project(
|
|
|
|
'kea',
|
|
|
|
'cpp',
|
2025-03-26 14:33:39 +00:00
|
|
|
version: '2.7.8-git',
|
2025-03-15 22:37:04 +01:00
|
|
|
meson_version: '>=1.1.0',
|
|
|
|
license: 'MPL-2.0',
|
|
|
|
license_files: ['COPYING'],
|
2025-03-22 09:40:33 +01:00
|
|
|
default_options: [
|
|
|
|
'b_asneeded=true',
|
|
|
|
'b_pch=false',
|
|
|
|
'b_pie=true',
|
|
|
|
'warning_level=2',
|
|
|
|
],
|
2025-03-15 22:37:04 +01:00
|
|
|
)
|
2024-12-19 13:27:16 +02:00
|
|
|
|
|
|
|
cpp = meson.get_compiler('cpp')
|
2025-02-28 11:00:03 +02:00
|
|
|
PROJECT_VERSION = meson.project_version()
|
2025-01-29 13:23:29 +02:00
|
|
|
|
|
|
|
#### Imports
|
2024-12-19 13:27:16 +02:00
|
|
|
|
|
|
|
fs = import('fs')
|
2025-03-13 07:54:06 +02:00
|
|
|
python_module = import('python')
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
#### Variables
|
|
|
|
|
|
|
|
TOP_BUILD_DIR = meson.current_build_dir()
|
|
|
|
TOP_SOURCE_DIR = meson.current_source_dir()
|
2025-03-13 09:53:12 +02:00
|
|
|
|
2025-03-18 15:20:06 +01:00
|
|
|
BINDIR = get_option('bindir')
|
2025-03-13 09:53:12 +02:00
|
|
|
DATADIR = get_option('datadir')
|
2025-03-19 09:33:50 +01:00
|
|
|
INCLUDEDIR = get_option('includedir')
|
2025-03-13 09:53:12 +02:00
|
|
|
LIBDIR = get_option('libdir')
|
2025-03-13 11:14:07 +02:00
|
|
|
LOCALSTATEDIR = get_option('localstatedir')
|
2025-03-15 10:55:41 +01:00
|
|
|
MANDIR = get_option('mandir')
|
2025-02-05 01:10:44 +01:00
|
|
|
PREFIX = get_option('prefix')
|
2025-03-15 10:55:41 +01:00
|
|
|
SBINDIR = get_option('sbindir')
|
2025-02-10 12:51:53 +02:00
|
|
|
SYSCONFDIR = get_option('sysconfdir')
|
|
|
|
|
2025-03-18 10:38:40 +02:00
|
|
|
DATABASE_SCRIPTS_DIR = TOP_BUILD_DIR / 'src/share/database/scripts'
|
2025-03-19 15:46:31 +02:00
|
|
|
HOOKS_PATH = LIBDIR / 'kea/hooks'
|
|
|
|
DEFAULT_HOOKS_PATH = PREFIX / HOOKS_PATH
|
2025-03-20 10:38:02 +02:00
|
|
|
KEA_ADMIN_BUILT = TOP_BUILD_DIR / 'src/bin/admin/kea-admin'
|
2025-03-18 15:30:24 +02:00
|
|
|
KEA_ADMIN_INSTALLED = PREFIX / SBINDIR / 'kea-admin'
|
|
|
|
KEA_LFC_BUILT = TOP_BUILD_DIR / 'src/bin/lfc/kea-lfc'
|
|
|
|
KEA_LFC_INSTALLED = PREFIX / SBINDIR / 'kea-lfc'
|
2025-03-26 08:33:22 +02:00
|
|
|
SHAREDSTATEDIR_INSTALLED = PREFIX / LOCALSTATEDIR / 'lib/kea'
|
2025-03-19 09:37:25 +02:00
|
|
|
RUNSTATEDIR = LOCALSTATEDIR / 'run/kea'
|
|
|
|
RUNSTATEDIR_INSTALLED = PREFIX / RUNSTATEDIR
|
2025-03-18 15:30:24 +02:00
|
|
|
TEST_CA_DIR = TOP_SOURCE_DIR / 'src/lib/asiolink/testutils/ca'
|
2025-01-29 13:23:29 +02:00
|
|
|
|
2025-03-10 01:17:38 +01:00
|
|
|
#### Build Options
|
|
|
|
|
|
|
|
crypto_opt = get_option('crypto')
|
|
|
|
krb5_opt = get_option('krb5')
|
|
|
|
mysql_opt = get_option('mysql')
|
|
|
|
netconf_opt = get_option('netconf')
|
|
|
|
postgresql_opt = get_option('postgresql')
|
|
|
|
|
|
|
|
FUZZ_OPT = get_option('fuzz')
|
2025-03-10 14:08:51 +02:00
|
|
|
TESTS_OPT = get_option('tests')
|
2025-03-10 01:17:38 +01:00
|
|
|
|
2025-03-17 11:28:13 +02:00
|
|
|
#### Programs
|
2025-03-17 00:32:17 +01:00
|
|
|
|
2025-03-17 11:28:13 +02:00
|
|
|
# External programs used only in this file.
|
|
|
|
cppcheck = find_program('cppcheck', required: false)
|
|
|
|
cppcheck_htmlreport = find_program('cppcheck-htmlreport', required: false)
|
|
|
|
git = find_program('git', required: false)
|
|
|
|
valgrind = find_program('valgrind', required: false)
|
2025-03-17 00:32:17 +01:00
|
|
|
|
2025-03-17 11:28:13 +02:00
|
|
|
AWK = find_program('gawk', 'awk', required: false)
|
|
|
|
BISON = find_program('bison', version: '>=3.3.0', required: false)
|
|
|
|
DOXYGEN = find_program('doxygen', required: false)
|
|
|
|
FLEX = find_program('flex', version: '>=2.6.4', required: false)
|
|
|
|
INSTALL = find_program('install', required: true)
|
|
|
|
PDFLATEX = find_program('pdflatex', required: false)
|
|
|
|
PIP_COMPILE = find_program('pip-compile', required: false)
|
|
|
|
PLANTUML = find_program('plantuml', required: false)
|
|
|
|
PYTHON = find_program('python3', 'python', required: true)
|
|
|
|
SPHINX = find_program('sphinx-build', 'sphinx-build-3', required: false)
|
|
|
|
XMLLINT = find_program('xmllint', required: false)
|
2025-03-17 00:32:17 +01:00
|
|
|
|
2025-03-18 10:57:46 +02:00
|
|
|
CD_AND_RUN = find_program(TOP_SOURCE_DIR / 'scripts/cd-and-run.sh')
|
|
|
|
ENV = find_program(TOP_SOURCE_DIR / 'scripts/env.sh')
|
|
|
|
GRABBER = find_program(TOP_SOURCE_DIR / 'scripts/grabber.py')
|
2025-03-17 11:28:13 +02:00
|
|
|
KEA_MSG_COMPILER = disabler()
|
2025-03-17 00:32:17 +01:00
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
#### Configuration Data
|
|
|
|
|
2025-03-17 11:28:13 +02:00
|
|
|
# 'HAVE_BOTAN_ASIO_STREAM_H': false,
|
|
|
|
# 'HAVE_PGSQL_SSL': false,
|
|
|
|
# 'USE_STATIC_LINK': false,
|
2025-01-29 13:23:29 +02:00
|
|
|
conf_data = configuration_data(
|
|
|
|
{
|
2025-03-17 11:28:13 +02:00
|
|
|
'PACKAGE': 'kea',
|
2025-02-08 04:04:58 +01:00
|
|
|
'PACKAGE_NAME': 'kea',
|
2025-02-28 11:00:03 +02:00
|
|
|
'PACKAGE_VERSION': PROJECT_VERSION,
|
|
|
|
'VERSION': f'"@PROJECT_VERSION@"',
|
2025-01-29 13:23:29 +02:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2025-02-17 11:02:58 +02:00
|
|
|
#### System-specific Variables
|
|
|
|
|
|
|
|
SYSTEM = build_machine.system()
|
|
|
|
if SYSTEM == 'linux'
|
|
|
|
conf_data.set('OS_LINUX', true)
|
|
|
|
OS_TYPE = 'Linux'
|
|
|
|
elif SYSTEM == 'freebsd'
|
|
|
|
conf_data.set('OS_BSD', true)
|
|
|
|
conf_data.set('OS_FREEBSD', true)
|
|
|
|
OS_TYPE = 'BSD'
|
|
|
|
elif SYSTEM == 'netbsd'
|
|
|
|
conf_data.set('OS_BSD', true)
|
|
|
|
conf_data.set('OS_NETBSD', true)
|
|
|
|
OS_TYPE = 'BSD'
|
|
|
|
elif SYSTEM == 'openbsd'
|
|
|
|
conf_data.set('OS_BSD', true)
|
|
|
|
conf_data.set('OS_OPENBSD', true)
|
|
|
|
OS_TYPE = 'BSD'
|
|
|
|
elif SYSTEM == 'sun'
|
|
|
|
conf_data.set('OS_SOLARIS', true)
|
|
|
|
OS_TYPE = 'Solaris'
|
|
|
|
elif SYSTEM == 'darwin'
|
|
|
|
conf_data.set('OS_BSD', true)
|
|
|
|
conf_data.set('OS_OSX', true)
|
|
|
|
OS_TYPE = 'BSD'
|
|
|
|
else
|
2025-03-03 17:01:09 +02:00
|
|
|
error(f'Unsupported system "@SYSTEM@".')
|
2025-02-17 11:02:58 +02:00
|
|
|
endif
|
|
|
|
message(f'Detected system "@SYSTEM@".')
|
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
#### Dependencies
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-03-14 14:09:08 +02:00
|
|
|
boost_dep = dependency('boost', version: '>=1.66', modules: ['system'])
|
2025-03-13 14:44:28 +02:00
|
|
|
dl_dep = dependency('dl')
|
2025-03-10 14:08:51 +02:00
|
|
|
threads_dep = dependency('threads')
|
2025-03-13 14:44:28 +02:00
|
|
|
add_project_dependencies(boost_dep, dl_dep, threads_dep, language: ['cpp'])
|
2025-02-10 23:04:49 +01:00
|
|
|
|
2025-03-11 02:11:27 +01:00
|
|
|
# check boost headers
|
|
|
|
boost_headers = [
|
|
|
|
'boost/asio.hpp',
|
|
|
|
'boost/asio/coroutine.hpp',
|
2025-03-15 00:30:58 +01:00
|
|
|
'boost/asio/io_context.hpp',
|
2025-03-11 02:11:27 +01:00
|
|
|
'boost/asio/ip/address.hpp',
|
|
|
|
'boost/asio/signal_set.hpp',
|
|
|
|
'boost/circular_buffer.hpp',
|
|
|
|
'boost/date_time/posix_time/posix_time_types.hpp',
|
|
|
|
'boost/foreach.hpp',
|
|
|
|
'boost/functional/hash.hpp',
|
|
|
|
'boost/integer/common_factor.hpp',
|
|
|
|
'boost/interprocess/sync/interprocess_upgradable_mutex.hpp',
|
2025-03-23 09:57:13 +01:00
|
|
|
'boost/multiprecision/cpp_int.hpp',
|
2025-03-11 02:11:27 +01:00
|
|
|
'boost/shared_ptr.hpp',
|
|
|
|
'boost/system/error_code.hpp',
|
|
|
|
]
|
|
|
|
foreach hdr : boost_headers
|
2025-03-11 12:04:13 +01:00
|
|
|
cpp.has_header(hdr, dependencies: [boost_dep], required: true)
|
2025-03-11 02:11:27 +01:00
|
|
|
endforeach
|
|
|
|
|
2025-03-06 12:05:44 +02:00
|
|
|
# Logging
|
2025-03-10 14:08:51 +02:00
|
|
|
# TODO: remove fallback when support for Ubuntu 20.04 gets removed.
|
|
|
|
LOG4CPLUS_DEP = dependency('log4cplus', fallback: ['log4cplus', 'log4cplus'])
|
2025-01-29 13:23:29 +02:00
|
|
|
|
|
|
|
# Cryptography
|
2025-03-10 14:08:51 +02:00
|
|
|
CRYPTO_DEP = disabler()
|
2025-01-29 13:23:29 +02:00
|
|
|
botan = disabler()
|
2025-01-31 19:13:55 +01:00
|
|
|
foreach dep : ['botan-2', 'botan']
|
2025-01-29 13:23:29 +02:00
|
|
|
botan = dependency(dep, required: false)
|
|
|
|
if botan.found()
|
|
|
|
break
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
openssl = dependency('openssl', required: false)
|
|
|
|
|
|
|
|
# Kerberos
|
2025-03-10 14:08:51 +02:00
|
|
|
KRB5_DEP = dependency(
|
|
|
|
'krb5-gssapi',
|
|
|
|
fallback: ['krb5', 'krb5'],
|
|
|
|
required: krb5_opt,
|
|
|
|
)
|
2025-03-11 02:11:27 +01:00
|
|
|
if KRB5_DEP.found()
|
|
|
|
cpp.has_header('gssapi/gssapi.h', dependencies: [KRB5_DEP], required: true)
|
|
|
|
cpp.has_header(
|
|
|
|
'gssapi/gssapi_krb5.h',
|
|
|
|
dependencies: [KRB5_DEP],
|
|
|
|
required: true,
|
|
|
|
)
|
|
|
|
endif
|
2025-01-29 13:23:29 +02:00
|
|
|
|
|
|
|
# MySQL
|
2025-03-10 14:08:51 +02:00
|
|
|
MYSQL_DEP = dependency(
|
|
|
|
'mariadb',
|
|
|
|
fallback: ['mysql', 'mysql'],
|
|
|
|
required: mysql_opt,
|
|
|
|
)
|
2025-01-29 13:23:29 +02:00
|
|
|
|
|
|
|
# PostgreSQL
|
2025-03-10 14:08:51 +02:00
|
|
|
POSTGRESQL_DEP = dependency(
|
|
|
|
'libpq',
|
|
|
|
fallback: ['postgresql', 'postgresql'],
|
|
|
|
required: postgresql_opt,
|
|
|
|
)
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
# NETCONF
|
2025-03-10 14:08:51 +02:00
|
|
|
NETCONF_DEP = dependency(
|
2025-03-13 14:28:17 +02:00
|
|
|
'yang+yang-cpp+sysrepo+sysrepo-cpp',
|
2025-03-10 14:08:51 +02:00
|
|
|
fallback: ['netconf', 'netconf'],
|
|
|
|
required: netconf_opt,
|
|
|
|
)
|
2025-03-11 02:11:27 +01:00
|
|
|
if netconf_opt.enabled() and NETCONF_DEP.get_variable(
|
|
|
|
'libyang_prefix',
|
|
|
|
default_value: 'unknown',
|
|
|
|
) == 'unknown'
|
2025-03-10 14:08:51 +02:00
|
|
|
error('Dependency not found: NETCONF.')
|
|
|
|
endif
|
2025-02-10 12:11:15 +02:00
|
|
|
|
2025-03-10 14:08:51 +02:00
|
|
|
GTEST_DEP = dependency(
|
|
|
|
'gtest',
|
|
|
|
required: TESTS_OPT.enabled() or FUZZ_OPT.enabled(),
|
|
|
|
)
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-03-10 01:17:38 +01:00
|
|
|
# Crypto
|
2025-03-07 09:10:23 +01:00
|
|
|
if crypto_opt == 'botan'
|
2025-03-03 17:01:09 +02:00
|
|
|
if botan.found()
|
2025-03-10 14:08:51 +02:00
|
|
|
CRYPTO_DEP = botan
|
2025-03-26 09:09:25 +01:00
|
|
|
else
|
|
|
|
error('botan required but not found')
|
2025-03-03 17:01:09 +02:00
|
|
|
endif
|
|
|
|
elif crypto_opt == 'openssl'
|
|
|
|
if openssl.found()
|
2025-03-10 14:08:51 +02:00
|
|
|
CRYPTO_DEP = openssl
|
2025-03-26 09:09:25 +01:00
|
|
|
else
|
|
|
|
error('openssl required but not found')
|
2025-03-03 17:01:09 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2025-03-10 14:08:51 +02:00
|
|
|
if CRYPTO_DEP.name() == botan.name()
|
2025-03-03 17:01:09 +02:00
|
|
|
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.')
|
2025-03-10 14:08:51 +02:00
|
|
|
elif CRYPTO_DEP.name() == openssl.name()
|
2025-03-03 17:01:09 +02:00
|
|
|
conf_data.set('WITH_OPENSSL', true)
|
2025-03-11 12:04:13 +01:00
|
|
|
cpp.has_header(
|
|
|
|
'boost/asio/ssl.hpp',
|
|
|
|
dependencies: [boost_dep],
|
|
|
|
required: true,
|
|
|
|
)
|
2025-03-03 17:01:09 +02:00
|
|
|
message('Using OpenSSL.')
|
|
|
|
else
|
|
|
|
error('Dependency not found: neither Botan nor OpenSSL.')
|
|
|
|
endif
|
|
|
|
|
2025-03-13 07:54:06 +02:00
|
|
|
# Kea shell
|
|
|
|
PKGPYTHONDIR = 'unknown'
|
|
|
|
py_installation = python_module.find_installation('python3', required: false)
|
|
|
|
if py_installation.found()
|
|
|
|
PKGPYTHONDIR = py_installation.get_install_dir(pure: true) / 'kea'
|
|
|
|
else
|
|
|
|
result = run_command(
|
|
|
|
PYTHON,
|
|
|
|
'-c',
|
|
|
|
'import sysconfig; print(sysconfig.get_paths()[\'purelib\'])',
|
|
|
|
check: false,
|
|
|
|
)
|
|
|
|
if result.returncode() == 0
|
|
|
|
PKGPYTHONDIR = result.stdout().strip() / 'kea'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2025-03-11 10:28:00 +01:00
|
|
|
if TESTS_OPT.enabled()
|
|
|
|
conf_data.set('ENABLE_DEBUG', true)
|
|
|
|
conf_data.set('ENABLE_LOGGER_CHECKS', true)
|
|
|
|
endif
|
2025-03-10 14:08:51 +02:00
|
|
|
conf_data.set('FUZZING', FUZZ_OPT.enabled())
|
|
|
|
conf_data.set('HAVE_MYSQL', MYSQL_DEP.found())
|
|
|
|
conf_data.set('HAVE_PGSQL', POSTGRESQL_DEP.found())
|
2025-03-10 01:17:38 +01:00
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
#### Compiler Checks
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-03-22 09:40:33 +01:00
|
|
|
# The required keyword in cpp.run() is an 1.5.0 feature.
|
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/get-cpp-standard.cc'),
|
|
|
|
name: 'Get cpp standard',
|
|
|
|
)
|
|
|
|
if result.returncode() == 0
|
|
|
|
cpp_standard = result.stdout().strip()
|
|
|
|
else
|
|
|
|
error('C++ standard is unknown')
|
|
|
|
endif
|
|
|
|
message(f'Detected C++ standard (__cplusplus value) is @cpp_standard@.')
|
|
|
|
cpp_std_opt = get_option('cpp_std')
|
2025-03-26 21:42:45 +01:00
|
|
|
no_cpp_std_opt_msg = 'Please set a C++ standard by passing the -D cpp_std argument to meson.'
|
|
|
|
cpp_std_opt_msg = f'-D cpp_std=@cpp_std_opt@ is not enough.'
|
2025-03-22 09:40:33 +01:00
|
|
|
if cpp_standard.version_compare('<201100')
|
|
|
|
msgs = [
|
|
|
|
'Kea requires at least C++11 to build.',
|
|
|
|
'Recommended C++ standard is C++14 but some dependencies require at least C++20',
|
|
|
|
]
|
|
|
|
if cpp_std_opt == 'none'
|
|
|
|
msgs += no_cpp_std_opt_msg
|
|
|
|
else
|
|
|
|
msgs += cpp_std_opt_msg
|
|
|
|
endif
|
|
|
|
error('\n'.join(msgs))
|
|
|
|
endif
|
2025-03-23 09:57:13 +01:00
|
|
|
if cpp_standard.version_compare('<201400')
|
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/boost-math-cpp14.cc'),
|
|
|
|
name: 'BOOST_MATH_REQUIRES_CPP14',
|
|
|
|
dependencies: [boost_dep, threads_dep],
|
|
|
|
)
|
|
|
|
if result.returncode() != 0
|
|
|
|
msgs = ['Boost Math requires at least C++14.']
|
|
|
|
if cpp_std_opt == 'none'
|
|
|
|
msgs += no_cpp_std_opt_msg
|
|
|
|
else
|
|
|
|
msgs += cpp_std_opt_msg
|
|
|
|
endif
|
|
|
|
error('\n'.join(msgs))
|
|
|
|
endif
|
|
|
|
endif
|
2025-03-22 09:40:33 +01:00
|
|
|
# Add Botan 3 to this.
|
|
|
|
if NETCONF_DEP.found() and cpp_standard.version_compare('<202000')
|
|
|
|
msgs = ['Netconf dependency requires at least C++20.']
|
|
|
|
if cpp_std_opt == 'none'
|
|
|
|
msgs += no_cpp_std_opt_msg
|
|
|
|
else
|
|
|
|
msgs += cpp_std_opt_msg
|
|
|
|
endif
|
|
|
|
error('\n'.join(msgs))
|
|
|
|
endif
|
|
|
|
|
2025-03-15 00:30:58 +01:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/boost-has-threads.cc'),
|
|
|
|
dependencies: [boost_dep, threads_dep],
|
|
|
|
name: 'BOOST_HAS_THREADS',
|
|
|
|
)
|
|
|
|
if result.returncode() != 0
|
|
|
|
error('boost is not configured to use threads')
|
|
|
|
endif
|
|
|
|
|
2025-03-11 13:03:00 +01:00
|
|
|
if cpp.has_header('boost/regex.h', dependencies: [boost_dep], required: false)
|
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/boost-regex.cc'),
|
2025-03-15 00:30:58 +01:00
|
|
|
dependencies: [boost_dep, threads_dep],
|
2025-03-11 13:03:00 +01:00
|
|
|
name: 'GET_SYSTEM_VS_BOOST_REGEX_HEADER',
|
|
|
|
)
|
|
|
|
if result.returncode() != 0
|
|
|
|
error('boost/regex.h is used in place of system regex.h')
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/chrono-same-duration.cc'),
|
|
|
|
name: 'CHRONO_SAME_DURATION',
|
|
|
|
)
|
|
|
|
conf_data.set('CHRONO_SAME_DURATION', result.returncode() == 0)
|
|
|
|
|
2025-02-10 09:53:14 +02:00
|
|
|
ENVIRON_SHLIB_FLAGS = []
|
2025-02-10 21:14:20 +01:00
|
|
|
# --no-undefined is not supported by all loaders.
|
|
|
|
if cpp.has_link_argument('-Wl,--no-undefined')
|
|
|
|
result = cpp.links(
|
|
|
|
fs.read('compiler-checks/environ-in-shlib.cc'),
|
|
|
|
name: 'ENVIRON_SHLIB_FLAGS',
|
|
|
|
args: ['--shared', '-fPIC', '-Wl,--no-undefined'],
|
|
|
|
)
|
|
|
|
if not result
|
2025-03-22 09:40:33 +01:00
|
|
|
ENVIRON_SHLIB_FLAGS += 'b_lundef=false'
|
2025-02-10 21:14:20 +01:00
|
|
|
endif
|
2025-02-10 09:53:14 +02:00
|
|
|
endif
|
|
|
|
|
2025-03-18 01:01:13 +01:00
|
|
|
if CRYPTO_DEP.name() == openssl.name()
|
2025-03-23 09:57:13 +01:00
|
|
|
result1 = cpp.run(
|
2025-03-18 01:01:13 +01:00
|
|
|
fs.read('compiler-checks/have-generic-tls-method.cc'),
|
|
|
|
name: 'HAVE_GENERIC_TLS_METHOD',
|
|
|
|
dependencies: [boost_dep, CRYPTO_DEP, threads_dep],
|
|
|
|
)
|
2025-03-23 09:57:13 +01:00
|
|
|
result2 = cpp.run(
|
2025-03-18 01:01:13 +01:00
|
|
|
fs.read('compiler-checks/stream-truncated-error.cc'),
|
|
|
|
name: 'HAVE_STREAM_TRUNCATED_ERROR',
|
|
|
|
dependencies: [boost_dep, CRYPTO_DEP, threads_dep],
|
|
|
|
)
|
2025-03-23 09:57:13 +01:00
|
|
|
if result1.returncode() != 0 or result2.returncode() != 0
|
2025-03-19 10:47:38 +01:00
|
|
|
error('Boost TLS support broken.')
|
2025-03-19 09:12:21 +01:00
|
|
|
endif
|
2025-03-18 01:01:13 +01:00
|
|
|
endif
|
2025-01-29 13:23:29 +02:00
|
|
|
|
2025-02-15 10:05:31 +01:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/have-optreset.cc'),
|
|
|
|
name: 'HAVE_OPTRESET',
|
|
|
|
)
|
|
|
|
conf_data.set('HAVE_OPTRESET', result.returncode() == 0)
|
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
result = cpp.run(fs.read('compiler-checks/have-sa-len.cc'), name: 'HAVE_SA_LEN')
|
|
|
|
conf_data.set('HAVE_SA_LEN', result.returncode() == 0)
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-02-10 09:56:40 +02:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/log4cplus-initializer.cc'),
|
|
|
|
name: 'LOG4CPLUS_INITIALIZER_H',
|
2025-03-10 14:08:51 +02:00
|
|
|
dependencies: [LOG4CPLUS_DEP],
|
2025-02-10 09:56:40 +02:00
|
|
|
)
|
|
|
|
conf_data.set('LOG4CPLUS_INITIALIZER_H', result.returncode() == 0)
|
|
|
|
|
2025-03-10 14:08:51 +02:00
|
|
|
if MYSQL_DEP.found()
|
2025-01-29 13:23:29 +02:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/mysql-my-bool.cc'),
|
2025-03-10 14:08:51 +02:00
|
|
|
name: 'MYSQL_MY_BOOL',
|
|
|
|
dependencies: [MYSQL_DEP],
|
2025-01-29 13:23:29 +02:00
|
|
|
)
|
|
|
|
conf_data.set('HAVE_MYSQL_MY_BOOL', result.returncode() == 0)
|
2025-03-11 02:11:27 +01:00
|
|
|
|
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/mysql-get-option.cc'),
|
|
|
|
name: 'HAVE_MYSQL_GET_OPTION',
|
|
|
|
dependencies: [MYSQL_DEP],
|
|
|
|
)
|
|
|
|
conf_data.set('HAVE_MYSQL_GET_OPTION', result.returncode() == 0)
|
2024-12-19 13:27:16 +02:00
|
|
|
endif
|
|
|
|
|
2025-03-10 14:08:51 +02:00
|
|
|
# TODO: implement when integrating with CI
|
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/fuzzing-with-clusterfuzzlite.cc'),
|
|
|
|
name: 'FUZZING_WITH_CLUSTERFUZZLITE',
|
|
|
|
)
|
|
|
|
FUZZING_WITH_CLUSTERFUZZLITE = result.returncode() == 0
|
|
|
|
|
2025-03-13 00:03:28 +01:00
|
|
|
have_afl = false
|
2025-03-18 09:42:53 +01:00
|
|
|
result = cpp.run(fs.read('compiler-checks/have-afl.cc'), name: 'HAVE_AFL')
|
|
|
|
if result.returncode() == 0
|
|
|
|
have_afl = true
|
2025-03-11 02:11:27 +01:00
|
|
|
endif
|
2025-03-18 09:42:53 +01:00
|
|
|
conf_data.set('HAVE_AFL', have_afl)
|
2025-03-11 02:11:27 +01:00
|
|
|
|
|
|
|
if GTEST_DEP.found()
|
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/have-create-unified-diff.cc'),
|
|
|
|
name: 'HAVE_CREATE_UNIFIED_DIFF',
|
|
|
|
dependencies: [GTEST_DEP],
|
|
|
|
)
|
|
|
|
conf_data.set('HAVE_CREATE_UNIFIED_DIFF', result.returncode() == 0)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if KRB5_DEP.found()
|
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/have-gss-str-to-oid.cc'),
|
|
|
|
name: 'HAVE_GSS_STR_TO_OID',
|
|
|
|
dependencies: [KRB5_DEP],
|
|
|
|
)
|
|
|
|
conf_data.set('HAVE_GSS_STR_TO_OID', result.returncode() == 0)
|
|
|
|
endif
|
|
|
|
|
|
|
|
#### Other checks.
|
|
|
|
|
|
|
|
if POSTGRESQL_DEP.found()
|
2025-03-17 11:28:13 +02:00
|
|
|
# TODO: change to proper check, not version check.
|
2025-03-11 02:11:27 +01:00
|
|
|
version = POSTGRESQL_DEP.version()
|
|
|
|
conf_data.set(
|
|
|
|
'HAVE_PGSQL_TCP_USER_TIMEOUT',
|
|
|
|
version.version_compare('>=12.0'),
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# For Solaris.
|
|
|
|
conf_data.set('HAVE_SYS_FILIO_H', cpp.has_header('sys/filio.h', required: false))
|
|
|
|
|
|
|
|
if valgrind.found()
|
|
|
|
conf_data.set(
|
|
|
|
'HAVE_VALGRIND_HEADERS',
|
|
|
|
cpp.has_header('valgrind/valgrind.h', required: false),
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
result = run_command(cpp, '-dumpmachine', check: false)
|
|
|
|
if result.returncode() == 0
|
|
|
|
d = result.stdout().strip()
|
|
|
|
conf_data.set('LIBC_MUSL', d.endswith('-musl'))
|
|
|
|
endif
|
|
|
|
|
2025-03-18 11:02:17 +02:00
|
|
|
if KRB5_DEP.found() and KRB5_DEP.get_variable('vendor').contains('Heimdal')
|
2025-03-11 10:12:00 +01:00
|
|
|
conf_data.set('WITH_HEIMDAL', true)
|
|
|
|
endif
|
|
|
|
|
2025-03-17 11:28:13 +02:00
|
|
|
# KEA_PKG_VERSION_IN_CONFIGURE: date and timestamp of the package e.g. "isc20230921141113"
|
|
|
|
# KEA_PKG_TYPE_IN_CONFIGURE: type of the package "rpm", "deb" or "apk"
|
|
|
|
kea_pkg_type_in_configure = run_command(
|
|
|
|
ENV,
|
|
|
|
'KEA_PKG_TYPE_IN_CONFIGURE',
|
|
|
|
check: true,
|
|
|
|
).stdout().strip()
|
|
|
|
kea_pkg_version_in_configure = run_command(
|
|
|
|
ENV,
|
|
|
|
'KEA_PKG_VERSION_IN_CONFIGURE',
|
|
|
|
check: true,
|
|
|
|
).stdout().strip()
|
|
|
|
if kea_pkg_type_in_configure != '' and kea_pkg_version_in_configure != ''
|
|
|
|
extended_version = f'@kea_pkg_version_in_configure@ @kea_pkg_type_in_configure@'
|
|
|
|
else
|
|
|
|
if fs.is_dir('.git') and git.found()
|
|
|
|
result = run_command(
|
|
|
|
CD_AND_RUN,
|
|
|
|
TOP_SOURCE_DIR,
|
|
|
|
git,
|
|
|
|
'rev-parse',
|
|
|
|
'HEAD',
|
|
|
|
check: false,
|
|
|
|
)
|
|
|
|
if result.returncode() == 0
|
|
|
|
extended_version = 'git ' + result.stdout().strip()
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
extended_version = 'tarball'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
conf_data.set('EXTENDED_VERSION', f'"@PROJECT_VERSION@ (@extended_version@)"')
|
|
|
|
|
|
|
|
if PROJECT_VERSION.split('.')[1].to_int() % 2 == 0
|
|
|
|
package_version_type = 'stable'
|
|
|
|
else
|
2025-03-19 09:37:25 +02:00
|
|
|
package_version_type = 'development'
|
2025-03-17 11:28:13 +02:00
|
|
|
endif
|
|
|
|
conf_data.set('PACKAGE_VERSION_TYPE', f'"@package_version_type@"')
|
|
|
|
|
2025-03-22 09:40:33 +01:00
|
|
|
#### Compiler
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-03-21 10:29:13 +01:00
|
|
|
compile_args = []
|
|
|
|
link_args = []
|
2025-02-28 11:00:03 +02:00
|
|
|
|
|
|
|
# $ORIGIN documented at https://www.man7.org/linux/man-pages/man8/ld.so.8.html
|
2025-03-19 15:46:31 +02:00
|
|
|
# EXECUTABLE_RPATH = f'$ORIGIN/../@LIBDIR@'
|
|
|
|
# HOOK_RPATH = '$ORIGIN/../..'
|
|
|
|
BUILD_RPATH = TOP_BUILD_DIR / 'src/lib'
|
2025-03-26 07:36:15 +02:00
|
|
|
INSTALL_RPATH = PREFIX / LIBDIR
|
|
|
|
# rpmbuild complains about rpaths to standard locations so let us conform to
|
|
|
|
# its liking and remove them. And let's do it consistently for all packages.
|
|
|
|
if kea_pkg_type_in_configure != ''
|
|
|
|
BUILD_RPATH = ''
|
|
|
|
INSTALL_RPATH = ''
|
|
|
|
endif
|
2025-03-19 15:46:31 +02:00
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
if SYSTEM == 'darwin'
|
2025-03-22 09:40:33 +01:00
|
|
|
compile_args += '-D__APPLE_USE_RFC_3542'
|
2025-01-29 13:23:29 +02:00
|
|
|
add_project_arguments('-D__APPLE_USE_RFC_3542', language: 'cpp')
|
2024-12-19 13:27:16 +02:00
|
|
|
endif
|
|
|
|
|
2025-03-21 11:46:00 +01:00
|
|
|
cpp_args_opt = get_option('cpp_args')
|
|
|
|
werror_opt = get_option('werror')
|
|
|
|
|
|
|
|
# List of warnings to add and to remove.
|
|
|
|
warnings = [
|
|
|
|
'-Wnon-virtual-dtor',
|
|
|
|
'-Wwrite-strings',
|
|
|
|
'-Woverloaded-virtual',
|
|
|
|
'-Wno-missing-field-initializers',
|
|
|
|
# '-Wshadow',
|
|
|
|
]
|
|
|
|
no_warnings = ['-Wno-sign-compare']
|
|
|
|
# Clang++ specific settings.
|
|
|
|
cxx_id = cpp.get_id()
|
|
|
|
if cxx_id == 'clang' and cpp_args_opt.length() == 0
|
|
|
|
add_project_arguments('-Qunused-arguments', language: 'cpp')
|
2025-03-22 09:40:33 +01:00
|
|
|
compile_args += '-Qunused-arguments'
|
2025-03-21 11:46:00 +01:00
|
|
|
no_warnings += ['-Wno-unused-variable', '-Wno-unused-parameter']
|
|
|
|
endif
|
|
|
|
if werror_opt
|
|
|
|
warnings += no_warnings
|
|
|
|
endif
|
|
|
|
if cpp_args_opt.length() == 0
|
|
|
|
foreach warning : warnings
|
|
|
|
if cpp.has_argument(warning)
|
|
|
|
add_project_arguments(warning, language: 'cpp')
|
2025-03-22 09:40:33 +01:00
|
|
|
compile_args += warning
|
2025-03-21 11:46:00 +01:00
|
|
|
else
|
|
|
|
message(f'@warning@ is not supported by the compiler')
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
endif
|
|
|
|
|
|
|
|
#### Premium hooks
|
|
|
|
|
2025-03-15 00:30:58 +01:00
|
|
|
premium = fs.is_dir('premium')
|
|
|
|
if premium
|
2025-02-08 04:04:58 +01:00
|
|
|
conf_data.set('PREMIUM', 'yes')
|
2025-03-17 11:28:13 +02:00
|
|
|
conf_data.set('PREMIUM_EXTENDED_VERSION', f'"yes (@extended_version@)"')
|
2025-02-08 04:04:58 +01:00
|
|
|
else
|
|
|
|
conf_data.set('PREMIUM', 'no')
|
|
|
|
conf_data.set('PREMIUM_EXTENDED_VERSION', '"no"')
|
2024-12-19 13:27:16 +02:00
|
|
|
endif
|
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
#### Default Includes
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
INCLUDES = [
|
|
|
|
include_directories('.'),
|
2025-02-08 04:04:58 +01:00
|
|
|
include_directories('src'),
|
2025-01-29 13:23:29 +02:00
|
|
|
include_directories('src/bin'),
|
|
|
|
include_directories('src/lib'),
|
2024-12-19 13:27:16 +02:00
|
|
|
]
|
|
|
|
|
2025-02-08 04:04:58 +01:00
|
|
|
#### Build report
|
|
|
|
|
|
|
|
report_conf_data = configuration_data()
|
2025-03-03 17:01:09 +02:00
|
|
|
report_conf_data.merge_from(conf_data)
|
2025-02-08 04:04:58 +01:00
|
|
|
report_conf_data.set('TOP_BUILD_DIR', TOP_BUILD_DIR)
|
|
|
|
report_conf_data.set('PACKAGE_NAME', 'kea')
|
2025-02-28 11:00:03 +02:00
|
|
|
report_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION)
|
2025-03-17 11:28:13 +02:00
|
|
|
report_conf_data.set('PACKAGE_VERSION_TYPE', package_version_type)
|
2025-03-18 10:57:46 +02:00
|
|
|
report_conf_data.set(
|
|
|
|
'EXTENDED_VERSION',
|
|
|
|
f'@PROJECT_VERSION@ (@extended_version@)',
|
|
|
|
)
|
2025-02-08 04:04:58 +01:00
|
|
|
report_conf_data.set('OS_TYPE', OS_TYPE)
|
|
|
|
report_conf_data.set('PREFIX', PREFIX)
|
|
|
|
report_conf_data.set('HOOKS_DIR', DEFAULT_HOOKS_PATH)
|
2025-03-15 00:30:58 +01:00
|
|
|
report_conf_data.set('PREMIUM', premium ? 'yes' : 'no')
|
2025-02-09 01:43:13 +01:00
|
|
|
report_conf_data.set('MESON_VERSION', meson.version())
|
2025-03-19 14:14:22 +01:00
|
|
|
report_conf_data.set('MESON_INFO', DATADIR / 'kea/meson-info')
|
2025-03-21 11:46:00 +01:00
|
|
|
build_options = meson.build_options()
|
2025-03-21 10:29:13 +01:00
|
|
|
report_conf_data.set('BUILD_OPTIONS', build_options.replace('\'', '"'))
|
2025-02-08 04:04:58 +01:00
|
|
|
report_conf_data.set('CXX', ' '.join(cpp.cmd_array()))
|
2025-03-21 11:46:00 +01:00
|
|
|
report_conf_data.set('CXX_ID', cxx_id)
|
2025-02-08 04:04:58 +01:00
|
|
|
result = run_command(cpp, '--version', check: false)
|
|
|
|
if result.returncode() == 0
|
|
|
|
v = result.stdout().strip().split('\n')
|
|
|
|
report_conf_data.set('CXX_VERSION', v.get(0, 'unknown'))
|
|
|
|
else
|
|
|
|
report_conf_data.set('CXX_VERSION', 'unknown')
|
|
|
|
endif
|
2025-03-22 09:40:33 +01:00
|
|
|
report_conf_data.set('CXX_STANDARD', cpp_standard)
|
2025-03-21 11:46:00 +01:00
|
|
|
compile_args += cpp_args_opt
|
2025-02-09 01:43:13 +01:00
|
|
|
report_conf_data.set('CXX_ARGS', ' '.join(compile_args))
|
|
|
|
report_conf_data.set('LD_ID', cpp.get_linker_id())
|
2025-03-21 10:29:13 +01:00
|
|
|
link_args += get_option('cpp_link_args')
|
2025-02-09 01:43:13 +01:00
|
|
|
report_conf_data.set('LD_ARGS', ' '.join(link_args))
|
2025-03-13 00:03:28 +01:00
|
|
|
report_conf_data.set('PYTHON_PATH', PYTHON.full_path())
|
|
|
|
report_conf_data.set('PYTHON_VERSION', PYTHON.version())
|
2025-03-13 07:54:06 +02:00
|
|
|
report_conf_data.set('PKGPYTHONDIR', PKGPYTHONDIR)
|
2025-02-08 04:04:58 +01:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/get-boost-version.cc'),
|
2025-03-15 00:30:58 +01:00
|
|
|
dependencies: [boost_dep, threads_dep],
|
2025-02-08 04:04:58 +01:00
|
|
|
name: 'Get Boost version',
|
|
|
|
)
|
|
|
|
if result.returncode() == 0
|
|
|
|
report_conf_data.set('BOOST_VERSION', result.stdout().strip())
|
|
|
|
else
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('BOOST_VERSION', 'unknown version')
|
2025-02-08 04:04:58 +01:00
|
|
|
endif
|
2025-03-10 14:08:51 +02:00
|
|
|
if CRYPTO_DEP.name() == botan.name()
|
2025-02-09 01:43:13 +01:00
|
|
|
report_conf_data.set('CRYPTO_NAME', 'Botan')
|
2025-03-18 23:50:26 +01:00
|
|
|
report_conf_data.set('SPACES', ' ')
|
2025-02-08 04:04:58 +01:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/get-botan-version.cc'),
|
|
|
|
name: 'Get Botan version',
|
2025-03-10 14:08:51 +02:00
|
|
|
dependencies: [CRYPTO_DEP],
|
2025-02-08 04:04:58 +01:00
|
|
|
)
|
|
|
|
if result.returncode() == 0
|
2025-03-18 15:35:24 +01:00
|
|
|
version = result.stdout().strip()
|
2025-02-08 04:04:58 +01:00
|
|
|
else
|
2025-03-18 15:35:24 +01:00
|
|
|
version = botan.version()
|
|
|
|
endif
|
|
|
|
if version == 'unknown'
|
|
|
|
version = 'unknown version'
|
2025-02-08 04:04:58 +01:00
|
|
|
endif
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('CRYPTO_VERSION', version)
|
2025-03-10 14:08:51 +02:00
|
|
|
elif CRYPTO_DEP.name() == openssl.name()
|
2025-02-09 01:43:13 +01:00
|
|
|
report_conf_data.set('CRYPTO_NAME', 'OpenSSL')
|
2025-03-18 23:50:26 +01:00
|
|
|
report_conf_data.set('SPACES', ' ')
|
2025-02-08 04:04:58 +01:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/get-openssl-version.cc'),
|
|
|
|
name: 'Get OpenSSL version',
|
2025-03-10 14:08:51 +02:00
|
|
|
dependencies: [CRYPTO_DEP],
|
2025-02-08 04:04:58 +01:00
|
|
|
)
|
|
|
|
if result.returncode() == 0
|
2025-03-18 15:35:24 +01:00
|
|
|
version = result.stdout().strip()
|
2025-02-08 04:04:58 +01:00
|
|
|
else
|
2025-03-18 15:35:24 +01:00
|
|
|
version = openssl.version()
|
2025-02-08 04:04:58 +01:00
|
|
|
endif
|
2025-03-18 15:35:24 +01:00
|
|
|
if version == 'unknown'
|
|
|
|
version = 'unknown version'
|
|
|
|
endif
|
|
|
|
report_conf_data.set('CRYPTO_VERSION', version)
|
2025-03-06 12:05:44 +02:00
|
|
|
endif
|
2025-02-08 04:04:58 +01:00
|
|
|
result = cpp.run(
|
|
|
|
fs.read('compiler-checks/get-log4cplus-version.cc'),
|
|
|
|
name: 'Get Log4cplus version',
|
2025-03-10 14:08:51 +02:00
|
|
|
dependencies: [LOG4CPLUS_DEP],
|
2025-02-08 04:04:58 +01:00
|
|
|
)
|
|
|
|
if result.returncode() == 0
|
2025-03-18 15:35:24 +01:00
|
|
|
version = result.stdout().strip()
|
2025-02-08 04:04:58 +01:00
|
|
|
else
|
2025-03-18 15:35:24 +01:00
|
|
|
version = log4cplus.version()
|
|
|
|
endif
|
|
|
|
if version == 'unknown'
|
|
|
|
version = 'unknown version'
|
2025-02-08 04:04:58 +01:00
|
|
|
endif
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('LOG4CPLUS_VERSION', version)
|
2025-02-24 12:01:19 +02:00
|
|
|
if FLEX.found()
|
|
|
|
report_conf_data.set('FLEX', FLEX.full_path())
|
2025-02-08 04:04:58 +01:00
|
|
|
else
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('FLEX', 'no')
|
2025-02-08 04:04:58 +01:00
|
|
|
endif
|
2025-02-24 12:01:19 +02:00
|
|
|
if BISON.found()
|
|
|
|
report_conf_data.set('BISON', BISON.full_path())
|
2025-02-08 04:04:58 +01:00
|
|
|
else
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('BISON', 'no')
|
2025-02-08 04:04:58 +01:00
|
|
|
endif
|
2025-03-10 14:08:51 +02:00
|
|
|
if MYSQL_DEP.found()
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('HAVE_MYSQL', 'yes')
|
|
|
|
version = MYSQL_DEP.version()
|
|
|
|
if version == 'unknown'
|
|
|
|
version = 'unknown version'
|
|
|
|
endif
|
|
|
|
report_conf_data.set('MYSQL_VERSION', version)
|
2025-02-09 01:43:13 +01:00
|
|
|
else
|
|
|
|
report_conf_data.set('HAVE_MYSQL', 'no')
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('MYSQL_VERSION', 'no')
|
2025-02-09 01:43:13 +01:00
|
|
|
endif
|
2025-03-10 14:08:51 +02:00
|
|
|
if POSTGRESQL_DEP.found()
|
2025-02-09 01:43:13 +01:00
|
|
|
report_conf_data.set('HAVE_PGSQL', 'yes')
|
2025-03-18 15:35:24 +01:00
|
|
|
version = POSTGRESQL_DEP.version()
|
|
|
|
if version == 'unknown'
|
|
|
|
version = 'unknown version'
|
|
|
|
endif
|
|
|
|
report_conf_data.set('PGSQL_VERSION', version)
|
2025-02-09 01:43:13 +01:00
|
|
|
else
|
|
|
|
report_conf_data.set('HAVE_PGSQL', 'no')
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('PGSQL_VERSION', 'no')
|
2025-02-09 01:43:13 +01:00
|
|
|
endif
|
2025-03-10 14:08:51 +02:00
|
|
|
if NETCONF_DEP.found()
|
|
|
|
report_conf_data.set('HAVE_NETCONF', 'yes')
|
2025-03-13 00:03:28 +01:00
|
|
|
report_conf_data.set(
|
|
|
|
'LIBYANG_PREFIX',
|
|
|
|
NETCONF_DEP.get_variable('libyang_prefix', default_value: 'unknown'),
|
|
|
|
)
|
|
|
|
report_conf_data.set(
|
|
|
|
'SYSREPO_PREFIX',
|
|
|
|
NETCONF_DEP.get_variable('sysrepo_prefix', default_value: 'unknown'),
|
|
|
|
)
|
2025-03-18 16:37:49 +01:00
|
|
|
report_conf_data.set(
|
|
|
|
'LIBYANG_VERSION',
|
|
|
|
NETCONF_DEP.get_variable(
|
|
|
|
'libyang_version',
|
|
|
|
default_value: 'unknown version',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
report_conf_data.set(
|
|
|
|
'LIBYANGCPP_VERSION',
|
|
|
|
NETCONF_DEP.get_variable(
|
|
|
|
'libyangcpp_version',
|
|
|
|
default_value: 'unknown version',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
report_conf_data.set(
|
|
|
|
'SYSREPO_VERSION',
|
|
|
|
NETCONF_DEP.get_variable(
|
|
|
|
'sysrepo_version',
|
|
|
|
default_value: 'unknown version',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
report_conf_data.set(
|
|
|
|
'SYSREPOCPP_VERSION',
|
|
|
|
NETCONF_DEP.get_variable(
|
|
|
|
'sysrepocpp_version',
|
|
|
|
default_value: 'unknown version',
|
|
|
|
),
|
|
|
|
)
|
2025-03-10 14:08:51 +02:00
|
|
|
else
|
|
|
|
report_conf_data.set('HAVE_NETCONF', 'no')
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('LIBYANG_PREFIX', 'no')
|
|
|
|
report_conf_data.set('SYSREPO_PREFIX', 'no')
|
2025-03-18 16:37:49 +01:00
|
|
|
report_conf_data.set('LIBYANG_VERSION', 'no')
|
|
|
|
report_conf_data.set('LIBYANGCPP_VERSION', 'no')
|
|
|
|
report_conf_data.set('SYSREPO_VERSION', 'no')
|
|
|
|
report_conf_data.set('SYSREPOCPP_VERSION', 'no')
|
2025-03-10 14:08:51 +02:00
|
|
|
endif
|
|
|
|
if FUZZ_OPT.enabled() or TESTS_OPT.enabled()
|
2025-02-08 04:04:58 +01:00
|
|
|
report_conf_data.set('HAVE_GTEST', 'yes')
|
2025-03-18 15:35:24 +01:00
|
|
|
version = GTEST_DEP.version()
|
|
|
|
if version == 'unknown'
|
|
|
|
version = 'unknown version'
|
|
|
|
endif
|
|
|
|
report_conf_data.set('GTEST_VERSION', version)
|
2025-02-08 04:04:58 +01:00
|
|
|
else
|
|
|
|
report_conf_data.set('HAVE_GTEST', 'no')
|
2025-03-18 15:35:24 +01:00
|
|
|
report_conf_data.set('GTEST_VERSION', 'no')
|
2025-02-08 04:04:58 +01:00
|
|
|
endif
|
2025-03-13 00:03:28 +01:00
|
|
|
if KRB5_DEP.found()
|
|
|
|
report_conf_data.set('HAVE_KRB5', 'yes')
|
2025-03-18 15:35:24 +01:00
|
|
|
version = KRB5_DEP.version()
|
|
|
|
if version == 'unknown'
|
|
|
|
version = 'unknown version'
|
|
|
|
endif
|
|
|
|
report_conf_data.set('KRB5_GSSAPI_VERSION', version)
|
2025-03-13 00:03:28 +01:00
|
|
|
report_conf_data.set(
|
|
|
|
'KRB5_GSSAPI_VENDOR',
|
|
|
|
KRB5_DEP.get_variable('vendor', default_value: 'unknown'),
|
|
|
|
)
|
|
|
|
else
|
|
|
|
report_conf_data.set('HAVE_KRB5', 'no')
|
|
|
|
report_conf_data.set('KRB5_GSSAPI_VERSION', 'unknown')
|
|
|
|
report_conf_data.set('KRB5_GSSAPI_VENDOR', 'unknown')
|
|
|
|
endif
|
|
|
|
if TESTS_OPT.enabled()
|
|
|
|
report_conf_data.set('TESTS_ENABLED', 'enabled')
|
|
|
|
else
|
|
|
|
report_conf_data.set('TESTS_ENABLED', 'disabled')
|
|
|
|
endif
|
|
|
|
if FUZZ_OPT.enabled()
|
|
|
|
report_conf_data.set('FUZZ_ENABLED', 'enabled')
|
|
|
|
else
|
|
|
|
report_conf_data.set('FUZZ_ENABLED', 'disabled')
|
|
|
|
endif
|
2025-03-18 23:50:26 +01:00
|
|
|
if valgrind.found()
|
|
|
|
report_conf_data.set('VALGRIND', valgrind.full_path())
|
|
|
|
else
|
|
|
|
report_conf_data.set('VALGRIND', 'no')
|
|
|
|
endif
|
2025-03-13 00:03:28 +01:00
|
|
|
if have_afl
|
|
|
|
report_conf_data.set('HAVE_AFL', 'yes')
|
|
|
|
else
|
|
|
|
report_conf_data.set('HAVE_AFL', 'no')
|
|
|
|
endif
|
2025-02-08 04:04:58 +01:00
|
|
|
|
2025-02-21 14:47:24 +01:00
|
|
|
#### Custom Targets
|
|
|
|
|
|
|
|
run_target(
|
|
|
|
'add-changelog-entry',
|
2025-03-18 10:57:46 +02:00
|
|
|
command: [TOP_SOURCE_DIR / 'changelog_unreleased/.add-entry.sh'],
|
2025-02-21 14:47:24 +01:00
|
|
|
)
|
|
|
|
|
2025-02-24 12:01:19 +02:00
|
|
|
if cppcheck.found()
|
2025-02-21 14:47:24 +01:00
|
|
|
run_target(
|
|
|
|
'cppcheck',
|
|
|
|
command: [
|
2025-02-24 12:01:19 +02:00
|
|
|
cppcheck,
|
2025-02-21 14:47:24 +01:00
|
|
|
'-I.',
|
|
|
|
'-I./src/lib',
|
|
|
|
'-I./src/bin',
|
|
|
|
'--inline-suppr',
|
|
|
|
'--quiet',
|
|
|
|
'--max-configs=256',
|
|
|
|
f'--suppressions-list=@TOP_SOURCE_DIR@/src/cppcheck-suppress.lst',
|
|
|
|
'--template={file}:{line}: check_fail: {message} ({severity},{id})',
|
|
|
|
'--xml',
|
|
|
|
'--xml-version=2',
|
|
|
|
'.',
|
|
|
|
],
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
2025-02-24 12:01:19 +02:00
|
|
|
if cppcheck_htmlreport.found()
|
2025-02-21 14:47:24 +01:00
|
|
|
run_target(
|
|
|
|
'cppcheck-report',
|
|
|
|
command: [
|
2025-02-24 12:01:19 +02:00
|
|
|
cppcheck_htmlreport,
|
2025-02-21 14:47:24 +01:00
|
|
|
'--file',
|
|
|
|
'./cppcheck-result.xml',
|
|
|
|
'--report-dir',
|
|
|
|
'./report',
|
|
|
|
'--title',
|
|
|
|
'"cppcheck report"',
|
|
|
|
],
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
2025-02-24 12:01:19 +02:00
|
|
|
if valgrind.found()
|
2025-02-21 14:47:24 +01:00
|
|
|
add_test_setup(
|
|
|
|
'valgrind',
|
|
|
|
exe_wrapper: [
|
2025-02-24 12:01:19 +02:00
|
|
|
valgrind,
|
2025-02-21 14:47:24 +01:00
|
|
|
'--child-silent-after-fork=yes',
|
2025-03-06 21:16:31 +02:00
|
|
|
'--error-exitcode=0',
|
2025-02-21 14:47:24 +01:00
|
|
|
'--fullpath-after=',
|
|
|
|
'--leak-check=full',
|
|
|
|
'--num-callers=64',
|
|
|
|
'--quiet',
|
|
|
|
'--show-leak-kinds=all',
|
2025-03-17 10:04:51 +02:00
|
|
|
f'--suppressions=@TOP_SOURCE_DIR@/src/valgrind.supp',
|
2025-03-04 11:30:40 +02:00
|
|
|
'--xml=yes',
|
|
|
|
'--xml-file=valgrind-results-%p.xml',
|
2025-02-21 14:47:24 +01:00
|
|
|
],
|
2025-03-04 11:30:40 +02:00
|
|
|
exclude_suites: ['python-tests', 'shell-tests'],
|
|
|
|
)
|
|
|
|
add_test_setup(
|
|
|
|
'valgrind_gen_suppressions',
|
|
|
|
exe_wrapper: [
|
|
|
|
valgrind,
|
|
|
|
'--child-silent-after-fork=yes',
|
2025-03-06 21:16:31 +02:00
|
|
|
'--error-exitcode=0',
|
2025-03-04 11:30:40 +02:00
|
|
|
'--fullpath-after=',
|
|
|
|
'--leak-check=full',
|
|
|
|
'--num-callers=64',
|
|
|
|
'--quiet',
|
|
|
|
'--show-leak-kinds=all',
|
2025-03-17 10:04:51 +02:00
|
|
|
f'--suppressions=@TOP_SOURCE_DIR@/src/valgrind.supp',
|
2025-03-04 11:30:40 +02:00
|
|
|
'--gen-suppressions=all',
|
|
|
|
'--log-file=valgrind.supp',
|
|
|
|
],
|
|
|
|
exclude_suites: ['python-tests', 'shell-tests'],
|
2025-02-21 14:47:24 +01:00
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
2025-02-21 15:06:10 +02:00
|
|
|
#### Configuration Files
|
|
|
|
|
2025-02-08 04:04:58 +01:00
|
|
|
config_report_sh = configure_file(
|
|
|
|
input: 'config-report.sh.in',
|
|
|
|
output: 'config-report.sh',
|
|
|
|
configuration: report_conf_data,
|
|
|
|
)
|
2025-02-21 15:06:10 +02:00
|
|
|
|
2025-03-04 10:19:31 +02:00
|
|
|
CONFIG_REPORT = configure_file(
|
2025-02-21 14:47:24 +01:00
|
|
|
output: 'config.report',
|
2025-03-04 10:19:31 +02:00
|
|
|
input: config_report_sh,
|
2025-03-18 10:57:46 +02:00
|
|
|
command: [TOP_BUILD_DIR / 'config-report.sh'],
|
2025-02-21 14:47:24 +01:00
|
|
|
)
|
|
|
|
|
2025-02-21 15:06:10 +02:00
|
|
|
# TODO: Change to config.h.in when autotools are removed.
|
|
|
|
configure_file(
|
|
|
|
input: 'meson-config.h.in',
|
|
|
|
output: 'config.h',
|
|
|
|
configuration: conf_data,
|
|
|
|
install: true,
|
2025-03-19 09:33:50 +01:00
|
|
|
install_dir: INCLUDEDIR / 'kea',
|
2025-02-21 15:06:10 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# TODO: Change to kea_version.h.in when autotools are removed.
|
|
|
|
configure_file(
|
|
|
|
input: 'meson-kea_version.h.in',
|
|
|
|
output: 'kea_version.h',
|
|
|
|
configuration: conf_data,
|
|
|
|
install: true,
|
2025-03-19 09:33:50 +01:00
|
|
|
install_dir: INCLUDEDIR / 'kea',
|
2025-02-21 15:06:10 +02:00
|
|
|
)
|
|
|
|
|
2025-01-29 13:23:29 +02:00
|
|
|
#### Build Starts Here
|
2024-12-19 13:27:16 +02:00
|
|
|
|
2025-03-16 10:23:01 +01:00
|
|
|
# LIBS_BUILT_SO_FAR makes sense because the linker is called with
|
|
|
|
# the --as-needed flag so ignores (i.e. does not link) unused libraries.
|
2025-01-29 13:23:29 +02:00
|
|
|
LIBS_BUILT_SO_FAR = []
|
2025-03-16 10:23:01 +01:00
|
|
|
|
2025-02-19 22:51:36 +01:00
|
|
|
TARGETS_GEN_MESSAGES = []
|
2025-02-20 01:02:16 +01:00
|
|
|
TARGETS_GEN_PARSER = []
|
2025-03-16 10:23:01 +01:00
|
|
|
|
2025-02-07 02:41:02 +01:00
|
|
|
subdir('tools')
|
2024-12-19 13:27:16 +02:00
|
|
|
subdir('src')
|
2025-02-04 16:58:43 +02:00
|
|
|
subdir('fuzz')
|
2025-02-18 15:54:20 +01:00
|
|
|
subdir('doc')
|
2025-03-15 00:30:58 +01:00
|
|
|
if premium
|
|
|
|
subdir('premium')
|
|
|
|
endif
|
2025-02-17 11:03:38 +02:00
|
|
|
|
2025-02-21 14:47:24 +01:00
|
|
|
#### More Custom Targets
|
|
|
|
|
2025-03-03 17:01:09 +02:00
|
|
|
if TARGETS_GEN_MESSAGES.length() > 0
|
|
|
|
alias_target('messages', TARGETS_GEN_MESSAGES)
|
|
|
|
else
|
|
|
|
error(
|
2025-03-13 00:23:16 +01:00
|
|
|
'No messages to generate. This is probably an error in the meson.build files.',
|
2025-03-03 17:01:09 +02:00
|
|
|
)
|
|
|
|
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
|
2025-02-21 14:47:24 +01:00
|
|
|
|
|
|
|
#### Installation
|
|
|
|
|
2025-02-19 22:51:36 +01:00
|
|
|
top_docs = [
|
|
|
|
'AUTHORS',
|
2025-02-21 15:06:10 +02:00
|
|
|
'CONTRIBUTING.md',
|
2025-02-19 22:51:36 +01:00
|
|
|
'COPYING',
|
|
|
|
'ChangeLog',
|
|
|
|
'README',
|
|
|
|
'SECURITY.md',
|
|
|
|
'code_of_conduct.md',
|
2025-02-21 15:06:10 +02:00
|
|
|
'platforms.rst',
|
2025-02-19 22:51:36 +01:00
|
|
|
]
|
2025-03-13 09:30:58 +02:00
|
|
|
install_data(top_docs, install_dir: DATADIR / 'doc/kea')
|
2025-03-19 09:37:25 +02:00
|
|
|
install_emptydir(RUNSTATEDIR)
|
2025-03-04 10:19:31 +02:00
|
|
|
|
|
|
|
# Print the setup report.
|
|
|
|
message(run_command(['cat', CONFIG_REPORT], check: true).stdout())
|
2025-03-18 15:35:24 +01:00
|
|
|
|
2025-03-18 17:04:34 +01:00
|
|
|
# Copy the meson.info directory during installation.
|
2025-03-19 12:36:56 +02:00
|
|
|
install_meson_info = configure_file(
|
|
|
|
input: 'install-meson-info.sh.in',
|
|
|
|
output: 'install-meson-info.sh',
|
|
|
|
configuration: configuration_data(
|
|
|
|
{
|
|
|
|
'INSTALL': INSTALL.full_path(),
|
|
|
|
'PREFIX': PREFIX,
|
|
|
|
'TOP_BUILD_DIR': TOP_BUILD_DIR,
|
|
|
|
'DATADIR': DATADIR,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
meson.add_install_script(install_meson_info)
|