public
Description: An automatic way to convert videos and put them on your iPod
Homepage:
Clone URL: git://github.com/xpaulbettsx/yikes.git
Click here to lend your support to: yikes and make a donation at www.pledgie.com !
yikes / Rakefile
100644 212 lines (166 sloc) 5.482 kb
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
$:.unshift File.dirname(__FILE__)
 
require 'rubygems'
require 'rake/clean'
require 'rake/testtask'
require 'spec/rake/spectask'
require 'pallet'
 
 
# Load other build files
Dir.glob("build/*.rake").each {|x| load x}
 
# Include JRuby packaging, but doesn't work on MRI
require 'rawr' if ruby_runtime == :jruby
 
### Constants
 
PKG_NAME = "yikes"
PKG_VERSION = "0.1"
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
 
RootDir = File.dirname(__FILE__)
InstallPrefix = get_install_prefix()
 
 
########################
## Native library tasks
########################
 
# libgpac
GPacConfigureFlags = [ "--disable-ipv6", "--disable-wx", "--disable-ssl", "--disable-opengl" ]
#file "libexec/lib/#{libname('libgpac')}" => Dir.glob("ext/gpac/**/*.{c,h,cpp}") do |t|
autoconf_task("gpac", [], GPacConfigureFlags, ["make lib", "make install-lib"], ["make clean"])
 
# libx264
X264ConfigureFlags = [
'--enable-mp4-output', '--enable-pthread',
"--extra-cflags=\"-I#{File.join(RootDir, 'lib', 'libexec', 'include')}\"",
"--extra-ldflags=\"-L#{File.join(RootDir, 'lib', 'libexec', 'lib')}\""
]
autoconf_task("x264", ["gpac"], X264ConfigureFlags)
 
# libmp4v2
autoconf_task("mp4v2")
 
# libfaac
FaacConfigureFlags = [ '--with-mp4v2=yes' ]
autoconf_task("faac", ["mp4v2"], FaacConfigureFlags)
 
# ffmpeg
FFMpegConfigureFlags = [
"--prefix=#{RootDir}/lib/libexec",
'--enable-gpl', '--enable-pp', '--enable-swscaler',
'--enable-libx264', '--enable-libfaac', '--enable-pthreads',
 
# FIXME: I get weird compile errors on OS X unless I disable MMX
'--disable-ffserver', '--disable-ffplay', '--disable-strip', "--disable-mmx",
"--extra-cflags=\"-I#{File.join(RootDir, 'lib', 'libexec', 'include')}\"",
"--extra-ldflags=\"-L#{File.join(RootDir, 'lib', 'libexec', 'lib')} -lpthread\""
]
autoconf_task("ffmpeg", ["x264", "faac"], FFMpegConfigureFlags)
 
desc "Process .erb files"
task :expandify do |f|
Dir.glob("{lib,bin,build}/**/*.erb").each() do |ex|
expand_erb(ex, ex.gsub(/\.erb$/, ''))
end
end
 
 
########################
## Test Tasks
########################
 
desc "Run specifications"
Spec::Rake::SpecTask.new("spec") do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
end
 
desc "Run Heckle on tests"
task :heckle do |t|
# Collect a list of defined classes
class_list = []
Dir.glob('lib/**/*.rb').each do |path|
File.open(path) do |f|
class_list += f.readlines.grep(/^class /) {|x| x.gsub(/class ([a-zA-Z]*).*$/, '\1') }
class_list.delete_if {|x| x =~ /^\W*$/}
end
end
 
class_list.each do |x|
STDERR.puts "Heckling #{x}"
system("heckle -f #{x}")
end
 
# sh "echo cat " + Dir.glob("lib/**/*.rb").join(' ') + " | grep '^class ' | grep -v 'class <<' | sed -e 's/\\1/g' | xargs -I {} heckle -f"
end
 
desc "Run all examples with RCov"
Spec::Rake::SpecTask.new('coverage') do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts = ['--exclude', '.*gems.*']
end
 
desc "Flog code"
task :flog do |t|
sh "flog " + Dir.glob("lib/**/*.rb").join(' ') + " | grep '^\\w'"
end
 
task :alltest => [
:spec,
:coverage,
:heckle
]
 
desc "Build Documentation"
task :doc do |t|
end
 
 
#######################
## Package building
#######################
 
Pallet.new('yikes', "0.1") do |p|
p.author = 'Paul Betts'
p.email = 'paul.betts@gmail.com'
p.summary = 'An automatic way to put your TV shows on your iPod'
p.description = <<-DESC.margin
|This is a description!
DESC
 
p.packages << Pallet::Gem.new(p) do |gem|
gem.depends = ['rake']
gem.files.include FileList['bin/*']
gem.files.include FileList['share/**/*']
gem.files.include FileList['lib/**/*']
end
 
# load_os("pallet_deb")
end
 
desc "Create a bundle folder that has all dependencies included"
task :bundle do
ENV["REQUIRE2LIB_LIBDIR"] = "#{RootDir}/bundle/lib/yikes"
sh "#{RootDir}/findlibs/main.rb #{RootDir}/lib/main.rb"
sh "cp -R #{RootDir}/bin #{RootDir}/bundle/"
sh "cp -R #{RootDir}/lib/* #{RootDir}/bundle/lib/yikes"
end
 
desc "Create a bundle folder that has all dependencies included for JRuby"
task :jbundle do
ENV["REQUIRE2LIB_LIBDIR"] = "#{RootDir}/bundle/lib/yikes"
sh "jruby #{RootDir}/findlibs/main.rb #{RootDir}/lib/main.rb"
sh "cp -R #{RootDir}/bin #{RootDir}/bundle/"
sh "cp -R #{RootDir}/lib/* #{RootDir}/bundle/lib/yikes"
end
 
#######################
## Gettext section
#######################
 
require 'gettext/utils'
 
desc "Create mo-files for l10n"
task :makemo do
GetText.create_mofiles(true, "./po", "./data/locale")
end
 
desc "Update pot/po files to match new version."
task :updatepo do
GetText.update_pofiles(PKG_NAME,
Dir.glob("{app,lib}/**/*.{rb,html.erb}"),
"#{PKG_NAME} #{PKG_VERSION}")
end
 
 
#######################
## Final tasks
#######################
 
desc "Miscellaneous post-build tasks"
task :postbuild => [:expandify] do
# FIXME: There's a Rake'y way to do this...
sh "cp #{RootDir}/build/config.rb #{RootDir}/lib"
sh "mkdir -p #{RootDir}/bin && mv #{RootDir}/build/execscript #{RootDir}/bin/yikes"
sh "chmod +x #{RootDir}/bin/yikes"
end
 
desc "Run Yikes from the source directory"
task :run do
sh "mkdir -p #{RootDir}/output"
sh "ruby #{RootDir}/lib/main.rb --debug -r 10 -l #{RootDir}/spec -t #{RootDir}/output"
end
 
desc "Run Yikes from the source directory using JRuby"
task :jrun do
sh "mkdir -p #{RootDir}/output"
sh "jruby #{RootDir}/lib/main.rb --debug -r 10 -l #{RootDir}/spec -t #{RootDir}/output"
end
 
# Default Actions
task :default => [
:updatepo,
:makemo,
:expandify,
:postbuild,
]