Skip to content

Commit

Permalink
merge: pull request #2 from namib-project/fix_unnecessary_rebuilds
Browse files Browse the repository at this point in the history
Bump tinydtls and crate version, fix unnecessary rebuilds
  • Loading branch information
pulsastrix authored Nov 19, 2022
2 parents dfff31a + 4069b2a commit 14614c6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tinydtls-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 13 additions & 4 deletions tinydtls-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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!");
Expand Down

0 comments on commit 14614c6

Please sign in to comment.