summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2014-08-01 07:49:28 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2014-08-01 10:38:18 +0200
commit33137606e9fba8677f1cb1f5424aff2067075147 (patch)
tree4e3a6fc82aab307ef2e7824446b21f969b16f762
parent33f465d9a787698ba42749b273f58327b40a59d3 (diff)
downloadmpv-33137606e9fba8677f1cb1f5424aff2067075147.tar.bz2
mpv-33137606e9fba8677f1cb1f5424aff2067075147.tar.xz
travis: use homebrew to build ffmpeg on OS X
This allows us to use a newer version of ffmpeg and to test the build of our VDA code.
-rwxr-xr-xtravis-deps76
1 files changed, 58 insertions, 18 deletions
diff --git a/travis-deps b/travis-deps
index adf7fadefa..8df9147f69 100755
--- a/travis-deps
+++ b/travis-deps
@@ -2,26 +2,57 @@
class TravisDepsBuilder
def self.make(name)
- info = build_map[name]
- raise "unrecognized dependency identifier '#{name}'" unless info
- instance = new(name, info[:url], info[:action])
+ instance = klass.new(name)
+ instance.fill_data
instance.deps
instance.build
end
- attr_reader :name, :url, :action
+ def self.klass
+ Module.const_get([self.name, self.os.capitalize].join)
+ rescue NameError
+ self
+ end
+
+ def self.os
+ ENV['TRAVIS_OS_NAME']
+ end
+
+ attr_reader :name, :url, :action, :os
+
+ def initialize(name)
+ @name, @os = name, self.class.os
+ end
- def initialize(name, url=nil, action=nil)
- @name, @url, @action = name, url, action
+ def fill_data
+ data = build_map.fetch(name)
+ @url, @action = data[:url], data[:action]
end
def build
- send(@action)
+ send(action)
end
def deps; end
private
+ def package_manager_update
+ # yes class variable, you wanna update only once across all instances
+ @@updated ||= false
+ return if @@updated
+ sh({'linux' => 'sudo apt-get update -y', 'osx' => 'brew update'}[os])
+ @@updated = true
+ end
+
+ def package_install(*packages)
+ cmd = {
+ 'linux' => 'sudo apt-get install %s -y',
+ 'osx' => 'brew install %s'
+ }[os] % [packages.join(" ")]
+
+ sh cmd
+ end
+
def git
sh "git clone --depth=1 #{url} #{name}"
compile name
@@ -35,6 +66,10 @@ class TravisDepsBuilder
compile dirname
end
+ def package
+ package_install(url)
+ end
+
def compile(dirname)
sh "cd #{dirname} && #{configure} && make && sudo make install"
sh "cd $TRAVIS_BUILD_DIR"
@@ -50,7 +85,7 @@ class TravisDepsBuilder
end
class Libav < TravisDepsBuilder
- def self.build_map
+ def build_map
{
"libav-stable" => {
:action => :stable,
@@ -76,8 +111,16 @@ class Libav < TravisDepsBuilder
end
end
+class LibavOsx < Libav
+ def build_map
+ {
+ "ffmpeg-stable" => { :action => :package, :url => 'ffmpeg' },
+ }
+ end
+end
+
class Libass < TravisDepsBuilder
- def self.build_map
+ def build_map
{
"libass-stable" => {
:action => :stable,
@@ -89,15 +132,12 @@ end
class Dependencies < TravisDepsBuilder
def deps
- case ENV['TRAVIS_OS_NAME']
- when 'linux' then
- sh "sudo apt-get update -y"
- sh "sudo apt-get install pkg-config fontconfig libfribidi-dev yasm -y"
- when 'osx' then
- sh 'brew install pkg-config fontconfig freetype fribidi yasm'
- else
- abort "Unrecognized OS"
- end
+ packages = {
+ 'linux' => 'pkg-config fontconfig libfribidi-dev yasm',
+ 'osx' => 'pkg-config fontconfig freetype fribidi yasm'
+ }
+ package_manager_update
+ package_install(packages.fetch(os))
end
end