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

[#3732] Remove unnecessary kludge section from netconf fallback that searched in /opt

This commit is contained in:
Andrei Pavel 2025-03-26 15:17:59 +02:00
parent 950cbdeca1
commit 42edde7415
No known key found for this signature in database
GPG Key ID: D4E804481939CB21
4 changed files with 111 additions and 136 deletions

View File

@ -88,12 +88,14 @@ fi
if test '@HAVE_NETCONF@' != 'no'; then
add_to_report <<HERE_DOCUMENT
Netconf:
LIBYANG: @LIBYANG_VERSION@
LIBYANGCPP: @LIBYANGCPP_VERSION@
LIBYANG_PREFIX: @LIBYANG_PREFIX@
YANG: @YANG_VERSION@
YANG_PREFIX: @YANG_PREFIX@
YANGCPP: @YANGCPP_VERSION@
YANGCPP_PREFIX: @YANGCPP_PREFIX@
SYSREPO: @SYSREPO_VERSION@
SYSREPOCPP: @SYSREPOCPP_VERSION@
SYSREPO_PREFIX: @SYSREPO_PREFIX@
SYSREPOCPP: @SYSREPOCPP_VERSION@
SYSREPOCPP_PREFIX: @SYSREPOCPP_PREFIX@
HERE_DOCUMENT
else

View File

@ -223,7 +223,7 @@ NETCONF_DEP = dependency(
required: netconf_opt,
)
if netconf_opt.enabled() and NETCONF_DEP.get_variable(
'libyang_prefix',
'yang-prefix',
default_value: 'unknown',
) == 'unknown'
error('Dependency not found: NETCONF.')
@ -541,11 +541,26 @@ conf_data.set('PACKAGE_VERSION_TYPE', f'"@package_version_type@"')
compile_args = []
link_args = []
# TODO: Use $ORIGIN
# $ORIGIN documented at https://www.man7.org/linux/man-pages/man8/ld.so.8.html
# It is preferable since it would allow Kea to start even if the installation is moved.
# We have to be careful at making executables work both in the build directory and in the installation directory.
# Also, Meson might use it by default, but might not use it on all systems, so lots of variables...
# EXECUTABLE_RPATH = f'$ORIGIN/../@LIBDIR@'
# HOOK_RPATH = '$ORIGIN/../..'
BUILD_RPATH = TOP_BUILD_DIR / 'src/lib'
INSTALL_RPATH = PREFIX / LIBDIR
# Add rpaths for NETCONF dependencies.
if NETCONF_DEP.found()
foreach i : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
libdir = NETCONF_DEP.get_variable(f'@i@-libdir')
BUILD_RPATH += f':@libdir@'
INSTALL_RPATH += f':@libdir@'
endforeach
endif
# 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 != ''
@ -743,49 +758,59 @@ endif
if NETCONF_DEP.found()
report_conf_data.set('HAVE_NETCONF', 'yes')
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'),
)
report_conf_data.set(
'LIBYANG_VERSION',
'YANG_VERSION',
NETCONF_DEP.get_variable(
'libyang_version',
'yang-version',
default_value: 'unknown version',
),
)
report_conf_data.set(
'LIBYANGCPP_VERSION',
'YANG_PREFIX',
NETCONF_DEP.get_variable('yang-prefix', default_value: 'unknown'),
)
report_conf_data.set(
'YANGCPP_VERSION',
NETCONF_DEP.get_variable(
'libyangcpp_version',
'yang-cpp-version',
default_value: 'unknown 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',
'sysrepo-version',
default_value: 'unknown 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(
'sysrepocpp_version',
'sysrepo-cpp-version',
default_value: 'unknown version',
),
)
report_conf_data.set(
'SYSREPOCPP_PREFIX',
NETCONF_DEP.get_variable('sysrepo-cpp-prefix', default_value: 'unknown'),
)
else
report_conf_data.set('HAVE_NETCONF', 'no')
report_conf_data.set('LIBYANG_PREFIX', 'no')
report_conf_data.set('SYSREPO_PREFIX', 'no')
report_conf_data.set('LIBYANG_VERSION', 'no')
report_conf_data.set('LIBYANGCPP_VERSION', 'no')
report_conf_data.set('YANG_VERSION', 'no')
report_conf_data.set('YANG_PREFIX', 'no')
report_conf_data.set('YANGCPP_VERSION', 'no')
report_conf_data.set('YANGCPP_PREFIX', 'no')
report_conf_data.set('SYSREPO_VERSION', 'no')
report_conf_data.set('SYSREPO_PREFIX', 'no')
report_conf_data.set('SYSREPOCPP_VERSION', 'no')
report_conf_data.set('SYSREPOCPP_PREFIX', 'no')
endif
if FUZZ_OPT.enabled() or TESTS_OPT.enabled()
report_conf_data.set('HAVE_GTEST', 'yes')

View File

@ -8,11 +8,11 @@ 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('libyang_prefix'),
NETCONF_DEP.get_variable('yang-prefix'),
)
yang_utils_conf_data.set(
'SYSREPO_PREFIX',
NETCONF_DEP.get_variable('sysrepo_prefix'),
NETCONF_DEP.get_variable('sysrepo-prefix'),
)
configure_file(

View File

@ -10,39 +10,13 @@ foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
continue
endif
# Try adding lib to it. libyang and libyang-cpp define the wrong pkg-config.
# 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
# Search in /opt.
foreach prefix : ['', 'lib']
path = f'/opt/@prefix@@dep@'
lib = cpp.find_library(dep, dirs: [f'/@path@/lib'], required: false)
if lib.found()
netconf_deps = netconf_deps + {
dep: declare_dependency(
dependencies: [lib],
include_directories: include_directories(f'/@path@/include'),
variables: {'prefix': f'@path@'},
),
}
if SYSTEM == 'darwin'
add_project_link_arguments(
f'-Wl,-rpath,@path@/lib',
language: 'cpp',
)
else
add_project_link_arguments(
f'-Wl,-rpath=@path@/lib',
language: 'cpp',
)
endif
endif
endforeach
endforeach
all_deps_found = true
@ -55,48 +29,22 @@ endforeach
if all_deps_found
variables = {}
if netconf_deps['yang'].found()
libyang_prefix = netconf_deps['yang'].get_variable('prefix')
libyang_version = netconf_deps['yang'].version()
if libyang_version == 'unknown'
libyang_version = 'unknown version'
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
libyang_prefix = 'unknown'
libyang_version = 'unknown version'
prefix = 'unknown'
version = 'unknown version'
endif
variables += {'libyang_prefix': libyang_prefix}
variables += {'libyang_version': libyang_version}
if netconf_deps['yang-cpp'].found()
libyangcpp_version = netconf_deps['yang-cpp'].version()
if libyangcpp_version == 'unknown'
libyangcpp_version = 'unknown version'
endif
else
libyangcpp_version = 'unknown version'
endif
variables += {'libyangcpp_version': libyangcpp_version}
if netconf_deps['sysrepo'].found()
sysrepo_prefix = netconf_deps['sysrepo'].get_variable('prefix')
sysrepo_version = netconf_deps['sysrepo'].version()
if sysrepo_version == 'unknown'
sysrepo_version = 'unknown version'
endif
else
sysrepo_prefix = 'unknown'
sysrepo_version = 'unknown version'
endif
variables += {'sysrepo_prefix': sysrepo_prefix}
variables += {'sysrepo_version': sysrepo_version}
if netconf_deps['sysrepo-cpp'].found()
sysrepocpp_version = netconf_deps['sysrepo-cpp'].version()
if sysrepocpp_version == 'unknown'
sysrepocpp_version = 'unknown version'
endif
else
sysrepocpp_version = 'unknown version'
endif
variables += {'sysrepocpp_version': sysrepocpp_version}
variables += {f'@i@-libdir': libdir}
variables += {f'@i@-prefix': prefix}
variables += {f'@i@-version': version}
endforeach
netconf = declare_dependency(
dependencies: [
netconf_deps['yang'],