Skip to content

Commit 14614c6

Browse files
authored
merge: pull request #2 from namib-project/fix_unnecessary_rebuilds
Bump tinydtls and crate version, fix unnecessary rebuilds
2 parents dfff31a + 4069b2a commit 14614c6

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "tinydtls-sys/src/tinydtls"]
22
path = tinydtls-sys/src/tinydtls
33
url = https://github.com/eclipse/tinydtls.git
4-
branch = develop
4+
branch = main

tinydtls-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[package]
55
name = "tinydtls-sys"
66
description = "Raw bindings to the TinyDTLS library."
7-
version = "0.1.1+tinydtls-c7c3ca8"
7+
version = "0.1.2+tinydtls-c84e36f"
88
edition = "2021"
99
links = "tinydtls"
1010
# For tinydtls, both licenses can be applied, see https://www.eclipse.org/legal/eplfaq.php#DUALLIC

tinydtls-sys/build.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,20 @@ fn main() {
6262

6363
// Create build configuration instance and enable in-source builds.
6464
let mut build_config = autotools::Config::new(&tinydtls_src_dir);
65-
build_config.insource(true).out_dir(&out_dir);
65+
build_config
66+
.insource(true)
67+
.out_dir(&out_dir)
68+
.make_args(vec!["-W".to_string(), "doc".to_string()]);
6669

6770
// Set Makeflags
6871
//build_config.make_args(make_flags);
6972

7073
// Enable debug symbols if enabled in Rust.
7174
match std::env::var_os("DEBUG").unwrap().to_str().unwrap() {
72-
"0" | "false" => {}
75+
"0" | "false" => {},
7376
_ => {
7477
build_config.with("debug", None);
75-
}
78+
},
7679
}
7780

7881
// Enable dependency features based on selected cargo features.
@@ -109,7 +112,6 @@ fn main() {
109112
// Customize and configure generated bindings.
110113
bindgen_builder = bindgen_builder
111114
.header("src/wrapper.h")
112-
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
113115
.default_enum_style(EnumVariation::Rust { non_exhaustive: true })
114116
.rustfmt_bindings(false)
115117
// Some types cannot have `Debug` as they are packed and have non-Copy fields.
@@ -151,6 +153,13 @@ fn main() {
151153
.blocklist_type("__fd_mask")
152154
// size_t matches usize in our case here.
153155
.size_t_is_usize(true);
156+
if !cfg!(feature = "vendored") {
157+
// Triggers a rebuild on every cargo build invocation if used for the vendored version, as
158+
// the included headers seem to come from our built version.
159+
// Should be fine though, as we already printed `cargo:rerun-if-changed=src/tinydtls/` at the
160+
// start of the file.
161+
bindgen_builder = bindgen_builder.parse_callbacks(Box::new(bindgen::CargoCallbacks));
162+
}
154163

155164
// Run binding generation and write the output to a file.
156165
let bindings = bindgen_builder.generate().expect("Could not generate bindings!");

tinydtls-sys/src/tinydtls

0 commit comments

Comments
 (0)