From: Otto Moerbeek Date: Fri, 9 May 2025 09:23:06 +0000 (+0200) Subject: When table.py changes, some files need to be regenerated, but cargo neglects that... X-Git-Tag: dnsdist-2.0.0-alpha2~17^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d19122bee4a0ab20943ba8ade8b2c77d9f549ef9;p=thirdparty%2Fpdns.git When table.py changes, some files need to be regenerated, but cargo neglects that in some cases --- diff --git a/meson/compiler-setup/meson.build b/meson/compiler-setup/meson.build index 77769490e7..0386d6813c 100644 --- a/meson/compiler-setup/meson.build +++ b/meson/compiler-setup/meson.build @@ -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']) diff --git a/pdns/recursordist/rec-rust-lib/generate.py b/pdns/recursordist/rec-rust-lib/generate.py index b9ec2a71fc..92e764bc1c 100644 --- a/pdns/recursordist/rec-rust-lib/generate.py +++ b/pdns/recursordist/rec-rust-lib/generate.py @@ -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() diff --git a/pdns/recursordist/rec-rust-lib/rust/build.rs b/pdns/recursordist/rec-rust-lib/rust/build.rs index b06c900de4..37b6efe258 100644 --- a/pdns/recursordist/rec-rust-lib/rust/build.rs +++ b/pdns/recursordist/rec-rust-lib/rust/build.rs @@ -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"); diff --git a/pdns/recursordist/rec-rust-lib/rust/meson.build b/pdns/recursordist/rec-rust-lib/rust/meson.build index 478b3d6c78..f58afa86c5 100644 --- a/pdns/recursordist/rec-rust-lib/rust/meson.build +++ b/pdns/recursordist/rec-rust-lib/rust/meson.build @@ -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, ],