diff --git a/build.rs b/build.rs index 05c216f..2183987 100644 --- a/build.rs +++ b/build.rs @@ -185,6 +185,22 @@ fn main() { }) .collect(); + // Debug helper for https://github.com/RIOT-OS/riotdocker/issues/242 + let preprocessor_include = cflags.iter().filter_map(|f| f.strip_prefix("-I")).filter(|f| f.ends_with("/preprocessor")).next(); + if let Some(preprocessor_include) = preprocessor_include { + let filename = format!("{}/preprocessor_successor.h", preprocessor_include); + let mut countdown: usize = 10; + loop { + if std::path::PathBuf::from(&filename).exists() { + break; + } + countdown = countdown.checked_sub(1).unwrap_or_else(|| { + panic!("Preprocessor include path {} was present but preprocessor_successor.h did not show up there after 20 seconds", filename); + }); + std::thread::sleep(std::time::Duration::from_secs(2)); + } + } + let bindings = builder() .header("riot-bindgen.h") .clang_args(&cflags)