From 2c026e1b6bef606de8156abda7af6f8c631b15a1 Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Mon, 23 Oct 2017 21:07:07 -0700 Subject: [PATCH] minor cleanups to ffmpeg build setup * the "lib: {}" print didn't do anything. It turns out that the pkg-config crate emits the necessary metadata for linking automatically. I had the wrong format and didn't notice because something else did it correctly. * gcc::Config is deprecated; the new name is Build. * and the crate is now called cc, version 1.0. Stuff found while looking at #11. Still haven't figured that issue out. --- Cargo.lock | 2 +- ffmpeg/Cargo.toml | 2 +- ffmpeg/build.rs | 12 +++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 906c5cd..392de5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -481,7 +481,7 @@ dependencies = [ name = "moonfire-ffmpeg" version = "0.0.1" dependencies = [ - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ffmpeg/Cargo.toml b/ffmpeg/Cargo.toml index a6bf644..d96f5a6 100644 --- a/ffmpeg/Cargo.toml +++ b/ffmpeg/Cargo.toml @@ -13,5 +13,5 @@ libc = "0.2" log = { version = "0.3", features = ["release_max_level_info"] } [build-dependencies] -gcc = "0.3" +cc = "1.0" pkg-config = "0.3" diff --git a/ffmpeg/build.rs b/ffmpeg/build.rs index f15158a..ee9dcc9 100644 --- a/ffmpeg/build.rs +++ b/ffmpeg/build.rs @@ -28,7 +28,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -extern crate gcc; +extern crate cc; extern crate pkg_config; fn main() { @@ -37,17 +37,15 @@ fn main() { pkg_config::Config::new().atleast_version("56.0").probe("libavcodec").unwrap(), pkg_config::Config::new().atleast_version("56.0").probe("libavformat").unwrap(), ]; - let mut wrapper = gcc::Config::new(); + let mut wrapper = cc::Build::new(); - // Pass compilation flags on to gcc. It'd be nice if pkg-config made this easier; see - // . for lib in &libraries { + // Pass include paths on to gcc. It'd be nice if pkg-config allowed fetching CFLAGS and + // passing that on; see . But + // the include paths are likely all that's included/significant for compilation. for p in &lib.include_paths { wrapper.include(p); } - for l in &lib.libs { - println!("lib: {}", l); - } } wrapper.file("wrapper.c").compile("libwrapper.a");