From 680a4b18d714e786efba1eed76c8e56ccb9adb49 Mon Sep 17 00:00:00 2001 From: Hugo Hakim Damer Date: Sun, 20 Nov 2022 00:30:59 +0100 Subject: [PATCH 1/2] fix(sys): Prevent rebuild on every build with vendored feat --- tinydtls-sys/build.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tinydtls-sys/build.rs b/tinydtls-sys/build.rs index 44c5f37..2123163 100644 --- a/tinydtls-sys/build.rs +++ b/tinydtls-sys/build.rs @@ -62,17 +62,20 @@ fn main() { // Create build configuration instance and enable in-source builds. let mut build_config = autotools::Config::new(&tinydtls_src_dir); - build_config.insource(true).out_dir(&out_dir); + build_config + .insource(true) + .out_dir(&out_dir) + .make_args(vec!["-W".to_string(), "doc".to_string()]); // Set Makeflags //build_config.make_args(make_flags); // Enable debug symbols if enabled in Rust. match std::env::var_os("DEBUG").unwrap().to_str().unwrap() { - "0" | "false" => {} + "0" | "false" => {}, _ => { build_config.with("debug", None); - } + }, } // Enable dependency features based on selected cargo features. @@ -109,7 +112,6 @@ fn main() { // Customize and configure generated bindings. bindgen_builder = bindgen_builder .header("src/wrapper.h") - .parse_callbacks(Box::new(bindgen::CargoCallbacks)) .default_enum_style(EnumVariation::Rust { non_exhaustive: true }) .rustfmt_bindings(false) // Some types cannot have `Debug` as they are packed and have non-Copy fields. @@ -151,6 +153,13 @@ fn main() { .blocklist_type("__fd_mask") // size_t matches usize in our case here. .size_t_is_usize(true); + if !cfg!(feature = "vendored") { + // Triggers a rebuild on every cargo build invocation if used for the vendored version, as + // the included headers seem to come from our built version. + // Should be fine though, as we already printed `cargo:rerun-if-changed=src/tinydtls/` at the + // start of the file. + bindgen_builder = bindgen_builder.parse_callbacks(Box::new(bindgen::CargoCallbacks)); + } // Run binding generation and write the output to a file. let bindings = bindgen_builder.generate().expect("Could not generate bindings!"); From 4069b2ad7b0db037ee05f435f7938c5aa3be0b77 Mon Sep 17 00:00:00 2001 From: Hugo Hakim Damer Date: Sun, 20 Nov 2022 00:32:22 +0100 Subject: [PATCH 2/2] chore(sys): bump tinydtls submodule and crate version to 0.1.2 --- .gitmodules | 2 +- tinydtls-sys/Cargo.toml | 2 +- tinydtls-sys/src/tinydtls | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 6947627..04ce683 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "tinydtls-sys/src/tinydtls"] path = tinydtls-sys/src/tinydtls url = https://github.com/eclipse/tinydtls.git - branch = develop + branch = main diff --git a/tinydtls-sys/Cargo.toml b/tinydtls-sys/Cargo.toml index 6b5a80e..dc5c770 100644 --- a/tinydtls-sys/Cargo.toml +++ b/tinydtls-sys/Cargo.toml @@ -4,7 +4,7 @@ [package] name = "tinydtls-sys" description = "Raw bindings to the TinyDTLS library." -version = "0.1.1+tinydtls-c7c3ca8" +version = "0.1.2+tinydtls-c84e36f" edition = "2021" links = "tinydtls" # For tinydtls, both licenses can be applied, see https://www.eclipse.org/legal/eplfaq.php#DUALLIC diff --git a/tinydtls-sys/src/tinydtls b/tinydtls-sys/src/tinydtls index c7c3ca8..c84e36f 160000 --- a/tinydtls-sys/src/tinydtls +++ b/tinydtls-sys/src/tinydtls @@ -1 +1 @@ -Subproject commit c7c3ca8a95cdfa6dcada1bf58e831e36b62ec11d +Subproject commit c84e36ff60a283ee1953458239828477cd4e98ec