]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3393] Hammer: Fix yang compilation
authorAndrei Pavel <andrei@isc.org>
Fri, 9 May 2025 11:27:26 +0000 (14:27 +0300)
committerAndrei Pavel <andrei@isc.org>
Fri, 9 May 2025 11:27:26 +0000 (14:27 +0300)
hammer.py

index 505860809007b589994501e6f1ada463772d3b7e..46ceec803738e23242241d1d230a997b952ced3d 100755 (executable)
--- a/hammer.py
+++ b/hammer.py
@@ -1178,6 +1178,10 @@ def _install_libyang_cpp_from_sources(ignore_errors = False):
     try:
         execute('git clone https://github.com/CESNET/libyang-cpp.git ~/.hammer-tmp/libyang-cpp')
         execute(f'git checkout {version}', cwd='~/.hammer-tmp/libyang-cpp')
+        # New cpp compiler is more picky about missing headers. (ex. Fedora 40)
+        return_code = execute('sudo grep "#include <algorithm>" ~/.hammer-tmp/libyang-cpp/src/Context.cpp', raise_error=False)
+        if return_code == 1:
+            execute('sed -i "/#include <libyang\/libyang.h>/a #include <algorithm>" ~/.hammer-tmp/libyang-cpp/src/Context.cpp')
         execute('mkdir ~/.hammer-tmp/libyang-cpp/build')
         execute('cmake -DBUILD_TESTING=OFF .. ', cwd='~/.hammer-tmp/libyang-cpp/build')
         execute('make -j $(nproc || gnproc || echo 1)', cwd='~/.hammer-tmp/libyang-cpp/build')