diff --git a/.travis.yml b/.travis.yml index c7e14d5a..884cdb03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,20 +14,16 @@ addons: apt: packages: - build-essential +dist: bionic before_install: - - if [[ $TRAVIS_OS_NAME == 'linux' ]]; then ./.travis/install_linux.sh; fi + - if [[ $TRAVIS_OS_NAME == 'linux' ]]; then sudo apt-get install yasm; fi - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install yasm; fi + - rustup component add rustfmt script: | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - # Current Travis Ubuntu version uses libav which doesn't come with libswresample - cargo build --verbose --no-default-features --features "avcodec avfilter avformat avresample swscale" && - cargo test --verbose --no-default-features --features "avcodec avfilter avformat avresample swscale" - else travis_wait cargo build --verbose --features "build" cargo test --verbose --features "build" - fi after_failure: - find /usr -type f 2>/dev/null | grep -E 'lib(avcodec/version|avcodec/avcodec).h$' | xargs -I THEFILE -- sh -c 'echo "=== THEFILE ==="; cat THEFILE' diff --git a/.travis/install_linux.sh b/.travis/install_linux.sh deleted file mode 100755 index 96dc5ec3..00000000 --- a/.travis/install_linux.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -sudo apt-get update -q -# From https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu -sudo apt-get -y --force-yes install autoconf automake build-essential libass-dev libfreetype6-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo zlib1g-dev -sudo apt-get install yasm -pushd ~ -git clone https://github.com/FFmpeg/FFmpeg.git -cd FFmpeg -git checkout release/3.2 -mkdir ~/FFmpeg-build -cd ~/FFmpeg-build -../FFmpeg/configure --disable-ffprobe --disable-ffserver --disable-doc --enable-avresample -make -j -sudo make install -make distclean -popd diff --git a/build.rs b/build.rs index 45f7e463..bee2303f 100644 --- a/build.rs +++ b/build.rs @@ -4,6 +4,7 @@ extern crate num_cpus; extern crate pkg_config; extern crate regex; +use std::collections::HashSet; use std::env; use std::fs::{self, File}; use std::io::{self, BufRead, BufReader, Write}; @@ -514,18 +515,23 @@ fn main() { } // Check additional required libraries. + // Flags are now of the type `EXTRALIBS-avcodec` { let config_mak = source().join("ffbuild/config.mak"); let file = File::open(config_mak).unwrap(); let reader = BufReader::new(file); let extra_libs = reader .lines() - .find(|ref line| line.as_ref().unwrap().starts_with("EXTRALIBS")) - .map(|line| line.unwrap()) - .unwrap(); + .filter_map(Result::ok) + .filter(|line| line.starts_with("EXTRALIBS")) + .collect::>(); + let linker_args = extra_libs + .iter() + .flat_map(|line| line.split('=').last().unwrap().split(' ')) + .collect::>(); - let linker_args = extra_libs.split('=').last().unwrap().split(' '); let include_libs = linker_args + .iter() .filter(|v| v.starts_with("-l")) .map(|flag| &flag[2..]); @@ -940,6 +946,8 @@ fn main() { .rustified_enum("*") .prepend_enum_name(false) .derive_eq(true) + // Otherwise bindgen is confused with multiline comments + .generate_comments(false) .parse_callbacks(Box::new(IntCallbacks)); // The input headers we would like to generate