]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
When table.py changes, some files need to be regenerated, but cargo neglects that...
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 9 May 2025 09:23:06 +0000 (11:23 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 9 May 2025 13:52:38 +0000 (15:52 +0200)
meson/compiler-setup/meson.build
pdns/recursordist/rec-rust-lib/generate.py
pdns/recursordist/rec-rust-lib/rust/build.rs
pdns/recursordist/rec-rust-lib/rust/meson.build

index 77769490e70d3c07022f3703c8f1d8110bc0a650..0386d6813c8f85cb3f507c2deb3bf361a4f7a305 100644 (file)
@@ -14,3 +14,9 @@ add_project_arguments(
 
 cxx = meson.get_compiler('cpp')
 system = target_machine.system()
+
+link_no_warn_duplicate_libraries = cxx.get_supported_link_arguments([
+  '-Wl,-no_warn_duplicate_libraries',
+])
+
+add_project_link_arguments(link_no_warn_duplicate_libraries, language: ['c', 'cpp'])
index b9ec2a71fc4deab753b53518598b3b4676bf439a..92e764bc1c9db0a1708f2e8df29169e253111600 100644 (file)
@@ -89,6 +89,7 @@ from enum import auto
 import os
 import re
 import sys
+from pathlib import Path
 
 class LType(Enum):
     """The type we handle in table.py"""
@@ -838,8 +839,18 @@ def generate():
     if os.path.isdir('../docs'):
         gen_oldstyle_docs(srcdir, entries)
         gen_newstyle_docs(srcdir, entries)
-    # touch pseudo output file
-    with open(gendir + '/timestamp', mode='w', encoding="utf-8") as file:
-        file.write('')
-        file.close()
+    # Remove rust generated files, they need to be re-generated after a table change and the rust dependency tracking does
+    # not do that in some cases. For the autotools case Makefile.am takes care.
+    Path(gendir, 'rust', 'librecrust.a').unlink(True)
+    Path(gendir, 'rust', 'lib.rs.h').unlink(True)
+    Path(gendir, 'rust', 'web.rs.h').unlink(True)
+    Path(gendir, 'rust', 'cxx.h').unlink(True)
+    Path(gendir, 'rust', 'misc.rs.h').unlink(True)
+    target = Path('target')
+    for root, dirs, files in target.walk(top_down=False):
+        for name in files:
+              (root / name).unlink()
+        for name in dirs:
+              (root / name).rmdir()
+
 generate()
index b06c900de4f47566ff008f6657e8d41cd3f76e56..37b6efe258d8a98ca9e93b44acf1a2f15b5560d3 100644 (file)
@@ -5,7 +5,7 @@ fn main() {
         .flag_if_supported("-std=c++17")
         .flag("-Isrc")
         .flag("-I../..")
-        .compile("settings");
+        .compile("recrust");
 
     // lib.rs is generated and taken care of by parent Makefile
     println!("cargo:rerun-if-changed=src/misc.rs");
index 478b3d6c78eee84e4b2c701d005c0bd33ff23a17..f58afa86c55e297e0446faa4d12fd26e399cf83c 100644 (file)
@@ -16,7 +16,7 @@ env.append('RUST_TARGET', '')
 env.append('RUSTC_TARGET_ARCH', '')
 
 lib_recrust = custom_target('librecrust.a',
-  output: [outfile, 'cxx.h'],
+  output: [outfile, 'cxx.h', 'lib.rs.h', 'misc.rs.h', 'web.rs.h'],
   input: infile,
   command: [build,
   ],