2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 01:49:48 +00:00

[#3680] Unroll NETCONF fallback subproject into the main meson.build to have all the sub dependencies available for pkg-config

This commit is contained in:
Andrei Pavel 2025-06-19 17:44:35 +03:00
parent 72f8978cc5
commit 0a7d3844b6
No known key found for this signature in database
GPG Key ID: D4E804481939CB21
3 changed files with 50 additions and 114 deletions

View File

@ -260,16 +260,41 @@ POSTGRESQL_DEP = dependency(
)
# NETCONF
NETCONF_DEP = dependency(
'yang+yang-cpp+sysrepo+sysrepo-cpp',
fallback: ['netconf', 'netconf'],
required: netconf_opt,
)
if netconf_opt.enabled() and NETCONF_DEP.get_variable(
'yang-prefix',
default_value: 'unknown',
) == 'unknown'
error('Dependency not found: NETCONF.')
NETCONF_DEP = disabler()
YANG_DEP = disabler()
YANGCPP_DEP = disabler()
SYSREPO_DEP = disabler()
SYSREPOCPP_DEP = disabler()
if netconf_opt.enabled()
netconf_deps = {}
all_deps_found = true
foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
netconf_deps = netconf_deps + {dep: dependency(dep, required: false)}
if not netconf_deps[dep].found()
# Try adding lib to it. yang and yang-cpp define the wrong pkg-config.
netconf_deps = netconf_deps + {
dep: dependency('lib' + dep, required: false),
}
endif
if not netconf_deps[dep].found()
all_deps_found = false
break
endif
endforeach
if all_deps_found
YANG_DEP = netconf_deps['yang']
YANGCPP_DEP = netconf_deps['yang-cpp']
SYSREPO_DEP = netconf_deps['sysrepo']
SYSREPOCPP_DEP = netconf_deps['sysrepo-cpp']
NETCONF_DEP = declare_dependency(
dependencies: [YANG_DEP, YANGCPP_DEP, SYSREPO_DEP, SYSREPOCPP_DEP],
)
else
error('Dependency not found: NETCONF.')
endif
endif
# Google Test
@ -607,7 +632,7 @@ if NETCONF_DEP.found()
endif
foreach i : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
libdir = NETCONF_DEP.get_variable(f'@i@-libdir')
libdir = netconf_deps[i].get_variable('libdir')
BUILD_RPATH += f':@libdir@'
INSTALL_RPATH += f':@libdir@'
endforeach
@ -811,49 +836,25 @@ else
endif
if NETCONF_DEP.found()
report_conf_data.set('HAVE_NETCONF', 'yes')
report_conf_data.set(
'YANG_VERSION',
NETCONF_DEP.get_variable(
'yang-version',
default_value: 'unknown version',
),
)
report_conf_data.set('YANG_VERSION', YANG_DEP.version())
report_conf_data.set(
'YANG_PREFIX',
NETCONF_DEP.get_variable('yang-prefix', default_value: 'unknown'),
)
report_conf_data.set(
'YANGCPP_VERSION',
NETCONF_DEP.get_variable(
'yang-cpp-version',
default_value: 'unknown version',
),
YANG_DEP.get_variable('prefix', default_value: 'unknown'),
)
report_conf_data.set('YANGCPP_VERSION', YANGCPP_DEP.version())
report_conf_data.set(
'YANGCPP_PREFIX',
NETCONF_DEP.get_variable('yang-cpp-prefix', default_value: 'unknown'),
)
report_conf_data.set(
'SYSREPO_VERSION',
NETCONF_DEP.get_variable(
'sysrepo-version',
default_value: 'unknown version',
),
YANGCPP_DEP.get_variable('prefix', default_value: 'unknown'),
)
report_conf_data.set('SYSREPO_VERSION', SYSREPO_DEP.version())
report_conf_data.set(
'SYSREPO_PREFIX',
NETCONF_DEP.get_variable('sysrepo-prefix', default_value: 'unknown'),
)
report_conf_data.set(
'SYSREPOCPP_VERSION',
NETCONF_DEP.get_variable(
'sysrepo-cpp-version',
default_value: 'unknown version',
),
SYSREPO_DEP.get_variable('prefix', default_value: 'unknown'),
)
report_conf_data.set('SYSREPOCPP_VERSION', SYSREPOCPP_DEP.version())
report_conf_data.set(
'SYSREPOCPP_PREFIX',
NETCONF_DEP.get_variable('sysrepo-cpp-prefix', default_value: 'unknown'),
SYSREPOCPP_DEP.get_variable('prefix', default_value: 'unknown'),
)
else
report_conf_data.set('HAVE_NETCONF', 'no')
@ -1052,14 +1053,15 @@ foreach i : [
LOG4CPLUS_DEP,
MYSQL_DEP,
POSTGRESQL_DEP,
YANG_DEP,
YANGCPP_DEP,
SYSREPO_DEP,
SYSREPOCPP_DEP,
]
if i.found() and i.type_name() == 'pkgconfig'
requires += i
endif
endforeach
if NETCONF_DEP.found()
requires += ['libyang', 'sysrepo', 'libyang-cpp', 'sysrepo-cpp']
endif
pkg.generate(
description: 'High-performance, extensible DHCP server engine',
filebase: 'kea',

View File

@ -6,14 +6,8 @@ yang_utils_conf_data.set('abs_top_srcdir', TOP_SOURCE_DIR)
yang_utils_conf_data.set('top_srcdir', '../../../../..')
yang_utils_conf_data.set('datarootdir', '${prefix}/' + DATADIR)
yang_utils_conf_data.set('prefix', PREFIX)
yang_utils_conf_data.set(
'LIBYANG_PREFIX',
NETCONF_DEP.get_variable('yang-prefix'),
)
yang_utils_conf_data.set(
'SYSREPO_PREFIX',
NETCONF_DEP.get_variable('sysrepo-prefix'),
)
yang_utils_conf_data.set('LIBYANG_PREFIX', YANG_DEP.get_variable('prefix'))
yang_utils_conf_data.set('SYSREPO_PREFIX', SYSREPO_DEP.get_variable('prefix'))
check_hashes_sh = configure_file(
input: 'check-hashes.sh.in',

View File

@ -1,60 +0,0 @@
project('netconf')
cpp = meson.get_compiler('cpp')
SYSTEM = build_machine.system()
netconf_deps = {}
foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
netconf_deps = netconf_deps + {dep: dependency(dep, required: false)}
if netconf_deps[dep].found()
continue
endif
# Try adding lib to it. yang and yang-cpp define the wrong pkg-config.
netconf_deps = netconf_deps + {
dep: dependency('lib' + dep, required: false),
}
if netconf_deps[dep].found()
continue
endif
endforeach
all_deps_found = true
foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
if not netconf_deps[dep].found()
all_deps_found = false
break
endif
endforeach
if all_deps_found
variables = {}
foreach i : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
if netconf_deps[i].found()
libdir = netconf_deps[i].get_variable('libdir')
prefix = netconf_deps[i].get_variable('prefix')
version = netconf_deps[i].version()
if version == 'unknown'
version = 'unknown version'
endif
else
prefix = 'unknown'
version = 'unknown version'
endif
variables += {f'@i@-libdir': libdir}
variables += {f'@i@-prefix': prefix}
variables += {f'@i@-version': version}
endforeach
netconf = declare_dependency(
dependencies: [
netconf_deps['yang'],
netconf_deps['yang-cpp'],
netconf_deps['sysrepo'],
netconf_deps['sysrepo-cpp'],
],
variables: variables,
)
else
# Can't use a disabler here?
netconf = dependency('')
endif