1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
#!/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)
sh "cd #{dirname} && #{configure} && make && sudo make install"
sh "cd $TRAVIS_BUILD_DIR"
end
def configure
"./configure"
end
def sh(command)
`#{command}`
end
end
class Libav < TravisDepsBuilder
def self.build_map
{
"libav-stable" => {
:action => :stable,
:url => 'http://libav.org/releases/libav-9.10.tar.gz'
},
"libav-git" => {
:action => :git,
:url => "git://git.libav.org/libav.git"
},
"ffmpeg-stable" => {
:action => :stable,
:url => 'http://www.ffmpeg.org/releases/ffmpeg-1.2.4.tar.gz'
},
"ffmpeg-git" => {
:action => :git,
:url => "git://github.com/FFmpeg/FFmpeg.git"
}
}
end
def configure
[super, "--disable-doc", "--cc=#{ENV['CC']}"].join(" ")
end
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
sh "sudo apt-get update -y"
sh "sudo apt-get install pkg-config fontconfig libfribidi-dev yasm -y"
end
end
Dependencies.new(:deps).deps
Libass.make(ARGV[0])
Libav.make(ARGV[1])
|