]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3680] Unroll NETCONF fallback subproject into the main meson.build to have all...
authorAndrei Pavel <andrei@isc.org>
Thu, 19 Jun 2025 14:44:35 +0000 (17:44 +0300)
committerAndrei Pavel <andrei@isc.org>
Thu, 19 Jun 2025 14:45:34 +0000 (17:45 +0300)
meson.build
src/share/yang/modules/utils/meson.build
subprojects/netconf/meson.build [deleted file]

index aee37da214c86738d10f144e712682fe8e70ca2a..187d1a9b88bbf81c1a40db23cfa65517ef5dd3c3 100644 (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',
index d2a0b14132adfb39f24c86e22192ce3b0c2c5441..4674c7c764607849bec93decf81d79ed0703ea4d 100644 (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',
diff --git a/subprojects/netconf/meson.build b/subprojects/netconf/meson.build
deleted file mode 100644 (file)
index 2219dab..0000000
+++ /dev/null
@@ -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