Skip to content

Commit

Permalink
Merge pull request #1 from Polochon-street/fix-travis-build
Browse files Browse the repository at this point in the history
Change the block extracting the extralib flags
  • Loading branch information
bacek committed Feb 28, 2020
2 parents ad0803a + f66dc36 commit bb2981f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
10 changes: 3 additions & 7 deletions .travis.yml
Expand Up @@ -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'
17 changes: 0 additions & 17 deletions .travis/install_linux.sh

This file was deleted.

16 changes: 12 additions & 4 deletions build.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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::<Vec<String>>();
let linker_args = extra_libs
.iter()
.flat_map(|line| line.split('=').last().unwrap().split(' '))
.collect::<HashSet<&str>>();

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..]);

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bb2981f

Please sign in to comment.