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.
This commit is contained in:
Scott Lamb 2017-10-23 21:07:07 -07:00
parent 8de7e391f8
commit 2c026e1b6b
3 changed files with 7 additions and 9 deletions

2
Cargo.lock generated
View File

@ -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)",

View File

@ -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"

View File

@ -28,7 +28,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
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
// <https://github.com/alexcrichton/pkg-config-rs/issues/43>.
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 <https://github.com/alexcrichton/pkg-config-rs/issues/43>. 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");