Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid libv4l2 pkg-config dependency added by mistake #106

Merged
merged 1 commit into from
Sep 1, 2024
Merged
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
1 change: 0 additions & 1 deletion v4l2-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ build = "build.rs"

[build-dependencies]
bindgen = "0.69.1"
pkg-config = "0.3.30"
23 changes: 13 additions & 10 deletions v4l2-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
extern crate bindgen;

use std::env;
use std::path::PathBuf;
use std::path::{Path, PathBuf};

fn main() {
let pkg_conf = pkg_config::Config::new()
.probe("libv4l2")
.expect("pkg-config has failed to find `libv4l2`");
let extra_include_paths = if cfg!(target_os = "freebsd") {
assert!(
Path::new("/usr/local/include/linux/videodev2.h").exists(),
"Video4Linux `videodev2.h` UAPI header is required to generate bindings \
against `libv4l2` and the header file is missing.\n\
Consider installing `multimedia/v4l_compat` FreeBSD package."
);
vec!["-I/usr/local/include"]
} else {
vec![]
};

let bindings = bindgen::Builder::default()
.header("wrapper.h")
.clang_args(
pkg_conf
.include_paths
.into_iter()
.map(|path| format!("-I{}", path.to_string_lossy())),
)
.clang_args(extra_include_paths)
.generate()
.expect("Failed to generate bindings");

Expand Down