2013-05-19 07:19:29 +00:00
|
|
|
#!/usr/bin/ruby
|
|
|
|
|
|
|
|
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.deps
|
|
|
|
instance.build
|
|
|
|
end
|
|
|
|
|
|
|
|
attr_reader :name, :url, :action
|
|
|
|
|
|
|
|
def initialize(name, url=nil, action=nil)
|
|
|
|
@name, @url, @action = name, url, action
|
|
|
|
end
|
|
|
|
|
|
|
|
def build
|
|
|
|
send(@action)
|
|
|
|
end
|
|
|
|
|
|
|
|
def deps; end
|
|
|
|
|
|
|
|
private
|
|
|
|
def git
|
|
|
|
sh "git clone --depth=1 #{url} #{name}"
|
|
|
|
compile name
|
|
|
|
end
|
|
|
|
|
|
|
|
def stable
|
|
|
|
filename = File.basename(url)
|
|
|
|
sh "wget #{url}"
|
|
|
|
sh "tar -xzvf #{filename}"
|
|
|
|
dirname = File.basename(url, ".tar.gz" )
|
|
|
|
compile dirname
|
|
|
|
end
|
|
|
|
|
|
|
|
def compile(dirname)
|
2013-09-01 16:46:38 +00:00
|
|
|
sh "cd #{dirname} && #{configure} && make && sudo make install"
|
2013-05-19 07:19:29 +00:00
|
|
|
sh "cd $TRAVIS_BUILD_DIR"
|
|
|
|
end
|
|
|
|
|
2013-09-01 16:46:38 +00:00
|
|
|
def configure
|
|
|
|
"./configure"
|
|
|
|
end
|
|
|
|
|
2013-05-19 07:19:29 +00:00
|
|
|
def sh(command)
|
|
|
|
`#{command}`
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Libav < TravisDepsBuilder
|
|
|
|
def self.build_map
|
|
|
|
{
|
|
|
|
"libav-stable" => {
|
|
|
|
:action => :stable,
|
2014-03-23 23:12:48 +00:00
|
|
|
:url => 'http://libav.org/releases/libav-10.tar.gz'
|
2013-05-19 07:19:29 +00:00
|
|
|
},
|
|
|
|
"libav-git" => {
|
|
|
|
:action => :git,
|
|
|
|
:url => "git://git.libav.org/libav.git"
|
|
|
|
},
|
|
|
|
"ffmpeg-stable" => {
|
|
|
|
:action => :stable,
|
2014-03-16 01:57:41 +00:00
|
|
|
:url => 'http://www.ffmpeg.org/releases/ffmpeg-2.1.4.tar.gz'
|
2013-05-19 07:19:29 +00:00
|
|
|
},
|
|
|
|
"ffmpeg-git" => {
|
|
|
|
:action => :git,
|
|
|
|
:url => "git://github.com/FFmpeg/FFmpeg.git"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2013-09-01 16:46:38 +00:00
|
|
|
|
|
|
|
def configure
|
2013-11-24 13:45:27 +00:00
|
|
|
[super, "--cc=#{ENV['CC']}"].join(" ")
|
2013-09-01 16:46:38 +00:00
|
|
|
end
|
2013-05-19 07:19:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
class Libass < TravisDepsBuilder
|
|
|
|
def self.build_map
|
|
|
|
{
|
|
|
|
"libass-stable" => {
|
|
|
|
:action => :stable,
|
|
|
|
:url => 'http://libass.googlecode.com/files/libass-0.10.1.tar.gz'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Dependencies < TravisDepsBuilder
|
|
|
|
def deps
|
2014-07-21 12:55:12 +00:00
|
|
|
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
|
2013-05-19 07:19:29 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
Dependencies.new(:deps).deps
|
|
|
|
|
|
|
|
Libass.make(ARGV[0])
|
|
|
|
Libav.make(ARGV[1])
|