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
NETCONF_DEP = dependency( NETCONF_DEP = disabler()
'yang+yang-cpp+sysrepo+sysrepo-cpp', YANG_DEP = disabler()
fallback: ['netconf', 'netconf'], YANGCPP_DEP = disabler()
required: netconf_opt, SYSREPO_DEP = disabler()
) SYSREPOCPP_DEP = disabler()
if netconf_opt.enabled() and NETCONF_DEP.get_variable( if netconf_opt.enabled()
'yang-prefix', netconf_deps = {}
default_value: 'unknown',
) == 'unknown' all_deps_found = true
error('Dependency not found: NETCONF.') 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 endif
# Google Test # Google Test
@ -607,7 +632,7 @@ if NETCONF_DEP.found()
endif endif
foreach i : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp'] 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@' BUILD_RPATH += f':@libdir@'
INSTALL_RPATH += f':@libdir@' INSTALL_RPATH += f':@libdir@'
endforeach endforeach
@ -811,49 +836,25 @@ else
endif endif
if NETCONF_DEP.found() if NETCONF_DEP.found()
report_conf_data.set('HAVE_NETCONF', 'yes') report_conf_data.set('HAVE_NETCONF', 'yes')
report_conf_data.set( report_conf_data.set('YANG_VERSION', YANG_DEP.version())
'YANG_VERSION',
NETCONF_DEP.get_variable(
'yang-version',
default_value: 'unknown version',
),
)
report_conf_data.set( report_conf_data.set(
'YANG_PREFIX', 'YANG_PREFIX',
NETCONF_DEP.get_variable('yang-prefix', default_value: 'unknown'), YANG_DEP.get_variable('prefix', default_value: 'unknown'),
)
report_conf_data.set(
'YANGCPP_VERSION',
NETCONF_DEP.get_variable(
'yang-cpp-version',
default_value: 'unknown version',
),
) )
report_conf_data.set('YANGCPP_VERSION', YANGCPP_DEP.version())
report_conf_data.set( report_conf_data.set(
'YANGCPP_PREFIX', 'YANGCPP_PREFIX',
NETCONF_DEP.get_variable('yang-cpp-prefix', default_value: 'unknown'), YANGCPP_DEP.get_variable('prefix', default_value: 'unknown'),
)
report_conf_data.set(
'SYSREPO_VERSION',
NETCONF_DEP.get_variable(
'sysrepo-version',
default_value: 'unknown version',
),
) )
report_conf_data.set('SYSREPO_VERSION', SYSREPO_DEP.version())
report_conf_data.set( report_conf_data.set(
'SYSREPO_PREFIX', 'SYSREPO_PREFIX',
NETCONF_DEP.get_variable('sysrepo-prefix', default_value: 'unknown'), SYSREPO_DEP.get_variable('prefix', default_value: 'unknown'),
)
report_conf_data.set(
'SYSREPOCPP_VERSION',
NETCONF_DEP.get_variable(
'sysrepo-cpp-version',
default_value: 'unknown version',
),
) )
report_conf_data.set('SYSREPOCPP_VERSION', SYSREPOCPP_DEP.version())
report_conf_data.set( report_conf_data.set(
'SYSREPOCPP_PREFIX', 'SYSREPOCPP_PREFIX',
NETCONF_DEP.get_variable('sysrepo-cpp-prefix', default_value: 'unknown'), SYSREPOCPP_DEP.get_variable('prefix', default_value: 'unknown'),
) )
else else
report_conf_data.set('HAVE_NETCONF', 'no') report_conf_data.set('HAVE_NETCONF', 'no')
@ -1052,14 +1053,15 @@ foreach i : [
LOG4CPLUS_DEP, LOG4CPLUS_DEP,
MYSQL_DEP, MYSQL_DEP,
POSTGRESQL_DEP, POSTGRESQL_DEP,
YANG_DEP,
YANGCPP_DEP,
SYSREPO_DEP,
SYSREPOCPP_DEP,
] ]
if i.found() and i.type_name() == 'pkgconfig' if i.found() and i.type_name() == 'pkgconfig'
requires += i requires += i
endif endif
endforeach endforeach
if NETCONF_DEP.found()
requires += ['libyang', 'sysrepo', 'libyang-cpp', 'sysrepo-cpp']
endif
pkg.generate( pkg.generate(
description: 'High-performance, extensible DHCP server engine', description: 'High-performance, extensible DHCP server engine',
filebase: 'kea', 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('top_srcdir', '../../../../..')
yang_utils_conf_data.set('datarootdir', '${prefix}/' + DATADIR) yang_utils_conf_data.set('datarootdir', '${prefix}/' + DATADIR)
yang_utils_conf_data.set('prefix', PREFIX) yang_utils_conf_data.set('prefix', PREFIX)
yang_utils_conf_data.set( yang_utils_conf_data.set('LIBYANG_PREFIX', YANG_DEP.get_variable('prefix'))
'LIBYANG_PREFIX', yang_utils_conf_data.set('SYSREPO_PREFIX', SYSREPO_DEP.get_variable('prefix'))
NETCONF_DEP.get_variable('yang-prefix'),
)
yang_utils_conf_data.set(
'SYSREPO_PREFIX',
NETCONF_DEP.get_variable('sysrepo-prefix'),
)
check_hashes_sh = configure_file( check_hashes_sh = configure_file(
input: 'check-hashes.sh.in', 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