Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/webrtc-sys-glib-probe-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
webrtc-sys: patch
---

Allow webrtc-sys build script to probe GLib/GIO without panicking when system headers are missing.
13 changes: 10 additions & 3 deletions webrtc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,18 @@ fn main() {
// In order to avoid any ABI mismatches we use the sysroot's headers.
add_gio_headers(&mut builder);

let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let local_links = Path::new(&manifest_dir).join("../local_links");
println!("cargo:rustc-link-search=native={}", local_links.display());

// Do not use pkg_config::probe_library, because we only require headers.
for lib_name in ["glib-2.0", "gobject-2.0", "gio-2.0"] {
let lib = pkg_config::Config::new().cargo_metadata(false).probe(lib_name).unwrap();
for path in lib.include_paths {
builder.include(path);
if let Ok(lib) = pkg_config::Config::new().cargo_metadata(false).probe(lib_name) {
for path in lib.include_paths {
builder.include(path);
}
} else {
println!("cargo:rustc-link-lib=dylib={}", lib_name);
}
}

Expand Down
Loading