From 8df6056ed4be5f0aee9de0d48a813db03f5d395b Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 25 Nov 2025 16:17:53 +0100 Subject: [PATCH] dnsdist: Build our Rust lib in `dev` profile when `CARGO_USE_DEV` is set It is roughly halving the compile time in my tests, and comes with more checks (see https://doc.rust-lang.org/cargo/reference/profiles.html#dev) so I find it useful to be able to explicitly request building using the `dev` profile. The default remains to build in `release` mode for performance, of course. Signed-off-by: Remi Gacogne --- .../rust/build_dnsdist_rust_library | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pdns/dnsdistdist/dnsdist-rust-lib/rust/build_dnsdist_rust_library b/pdns/dnsdistdist/dnsdist-rust-lib/rust/build_dnsdist_rust_library index dee4f4df2c..acca1c4f9a 100644 --- a/pdns/dnsdistdist/dnsdist-rust-lib/rust/build_dnsdist_rust_library +++ b/pdns/dnsdistdist/dnsdist-rust-lib/rust/build_dnsdist_rust_library @@ -11,9 +11,18 @@ export CARGO="${CARGO:-$_defaultCARGO}" mytarget=${CARGO_TARGET_DIR-target} #echo "mytarget=${mytarget}" -$CARGO build --release $RUST_TARGET --target-dir=$builddir/target --manifest-path $srcdir/Cargo.toml --locked +CARGO_PROFILE="--release" +if [ -n "${CARGO_USE_DEV}" ]; then + CARGO_PROFILE="" +fi -cp -p target/$RUSTC_TARGET_ARCH/release/libdnsdist_rust.a $builddir/dnsdist-rust-lib/rust/libdnsdist_rust.a +$CARGO build ${CARGO_PROFILE} $RUST_TARGET --target-dir=$builddir/target --manifest-path $srcdir/Cargo.toml --locked + +if [ -n "${CARGO_USE_DEV}" ]; then + cp -p target/$RUSTC_TARGET_ARCH/debug/libdnsdist_rust.a $builddir/dnsdist-rust-lib/rust/libdnsdist_rust.a +else + cp -p target/$RUSTC_TARGET_ARCH/release/libdnsdist_rust.a $builddir/dnsdist-rust-lib/rust/libdnsdist_rust.a +fi cp -p $mytarget/$RUSTC_TARGET_ARCH/cxxbridge/dnsdist-rust/src/lib.rs.h $srcdir/lib.rs.h cp -p $mytarget/$RUSTC_TARGET_ARCH/cxxbridge/dnsdist-rust/src/lib.rs.h $builddir/dnsdist-rust-lib/rust/lib.rs.h -- 2.47.3