Skip to content

Commit

Permalink
Only call pkg_config if the feature is enabled (meh#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
hatzel authored and barzamin committed Oct 17, 2018
1 parent 22db9f8 commit 6e4ceae
Showing 1 changed file with 20 additions and 30 deletions.
50 changes: 20 additions & 30 deletions ffmpeg-sys/build.rs
Expand Up @@ -515,40 +515,30 @@ fn main() {
}
// Fallback to pkg-config
else {
pkg_config::Config::new()
.statik(statik)
.probe("libavformat")
.unwrap();

pkg_config::Config::new()
.statik(statik)
.probe("libavfilter")
.unwrap();

pkg_config::Config::new()
.statik(statik)
.probe("libavdevice")
.unwrap();

pkg_config::Config::new()
.statik(statik)
.probe("libavresample")
.unwrap();

pkg_config::Config::new()
.statik(statik)
.probe("libavutil")
.unwrap();

pkg_config::Config::new()
.statik(statik)
.probe("libswscale")
.unwrap();
.unwrap()
.include_paths;

let libs = vec![
("libavformat", "AVFORMAT"),
("libavfilter", "AVFILTER"),
("libavdevice", "AVDEVICE"),
("libavresample", "AVRESAMPLE"),
("libswscale", "SWSCALE"),
("libswresample", "SWRESAMPLE"),
];

pkg_config::Config::new()
.statik(statik)
.probe("libswresample")
.unwrap();
for (lib_name, env_variable_name) in libs.iter() {
if env::var(format!("CARGO_FEATURE_{}", env_variable_name)).is_ok() {
pkg_config::Config::new()
.statik(statik)
.probe(lib_name)
.unwrap()
.include_paths;
}
};

pkg_config::Config::new()
.statik(statik)
Expand Down

0 comments on commit 6e4ceae

Please sign in to comment.