Skip to content
Newer
Older
100644 544 lines (431 sloc) 13.4 KB
90c05c1 @drbrain Update INSTALL to latest information.
drbrain authored
1 # NOTE! When updating this file, also update INSTALL, if necessary.
2
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
3 $verbose = Rake.application.options.trace
be4319e Don't hardcode extension suffixes to 'bundle'.
Tilman Sauerbeck authored
4 $dlext = Config::CONFIG["DLEXT"]
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
5
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
6 require 'tsort'
7
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
8 task :default => :build
8dd2b6b @evanphx r43@vatu: evan | 2006-08-24 16:34:21 -0700
evanphx authored
9
335f63e @drbrain Better runner of the correct make
drbrain authored
10 def make(args = nil)
11 "#{ENV['MAKE'] || 'make'} #{args}"
12 end
13
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
14 class Hash
15 include TSort
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
16
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
17 alias tsort_each_node each_key
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
18
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
19 def tsort_each_child(node, &block)
20 fetch(node).each(&block)
21 end
22 end
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
23
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
24 def newer?(file, cmp)
25 File.exists?(cmp) and File.mtime(cmp) >= File.mtime(file)
26 end
939f9ac @evanphx Revert array changes back to r1088. r1089 is busted bigtime.
evanphx authored
27
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
28 def source_name(compiled)
29 File.basename(compiled, '.*') + '.rb'
30 end
31
32 def compiled_name(source, dir)
33 File.join(dir, File.basename(source, '.*') + '.rbc')
34 end
35
36 # Some files have load order dependencies. To specify a load order
37 # dependency, include a comment in the file that has the dependency.
38 # For example, assume files a.rb and b.rb, where a.rb requires that
39 # b.rb is loaded first. In a.rb, include a comment
40 # # depends on: b.rb
41 #
42 # The 'depends on:' declaration takes a space separated list of file.
43 # When the '.load_order.txt' file is created, a topological sort
44 # (see name caveat in TSort) of the dependencies is performed
45 # so files that are depended on are loaded first.
46 #
47 # If there is a 'depends on:' declarations for a non-existent file,
48 # or if there are cyclic dependencies, this method will not create
49 # the '.load_order.txt' file.
50
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
51 def create_load_order(files, output=".load_order.txt")
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
52 d = Hash.new { |h,k| h[k] = [] }
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
53
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
54 # assume all the files are in the same directory
55 dir = File.dirname(files.first)
ade5bc1 @evanphx Fix tsort in the Rakefile
evanphx authored
56 found = false
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
57 files.each do |fname|
58 name = source_name(fname)
ade5bc1 @evanphx Fix tsort in the Rakefile
evanphx authored
59 # Force every entry to be in the hash
60 d[name]
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
61 File.open(File.join(dir, name), "r") do |f|
62 f.each do |line|
63 if m = /#\s*depends on:\s*(.*)/.match(line)
ade5bc1 @evanphx Fix tsort in the Rakefile
evanphx authored
64 found = true
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
65 m[1].split.each { |dep| d[name] << dep }
66 end
67 end
68 end
69 end
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
70
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
71 File.open(output, "w") do |f|
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
72 begin
ade5bc1 @evanphx Fix tsort in the Rakefile
evanphx authored
73 if found
8634917 @evanphx Load order files are now in alphabetical order if there are no other …
evanphx authored
74 list = d.tsort
ade5bc1 @evanphx Fix tsort in the Rakefile
evanphx authored
75 else
76 list = files.sort
8634917 @evanphx Load order files are now in alphabetical order if there are no other …
evanphx authored
77 end
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
78
8634917 @evanphx Load order files are now in alphabetical order if there are no other …
evanphx authored
79 f.puts list.collect { |n| compiled_name(n, dir) }.join("\n")
ade5bc1 @evanphx Fix tsort in the Rakefile
evanphx authored
80 rescue IndexError => e
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
81 puts "Unable to generate '.load_order.txt'"
82 puts "Most likely, a file includes a 'depends on:' declaration for a non-existent file"
ade5bc1 @evanphx Fix tsort in the Rakefile
evanphx authored
83 raise e
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
84 rescue TSort::Cyclic => e
85 puts "Unable to generate '.load_order.txt' due to a cyclic dependency\n (#{e.message})"
ade5bc1 @evanphx Fix tsort in the Rakefile
evanphx authored
86 raise e
da5f9e6 @brixen Added load-order dependency generation to rake build:(core|platform) …
brixen authored
87 end
88 end
89 end
90
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
91 def compile(name, output)
92 dir = File.dirname(output)
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
93
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
94 unless File.exists?(dir)
95 FileUtils.mkdir_p dir
96 end
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
97
d997ba7 @drbrain Prefix all env vars with RBX_
drbrain authored
98 sh "shotgun/rubinius compile #{name} #{output}", :verbose => $verbose
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
99 end
100
101 task :compiler do
102 if ENV['USE_CURRENT']
103 puts "Use current versions, not stable."
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
104 else
d997ba7 @drbrain Prefix all env vars with RBX_
drbrain authored
105 ENV['RBX_BOOTSTRAP'] = "runtime/stable/bootstrap.rba"
106 ENV['RBX_COMPILER'] = "runtime/stable/compiler.rba"
107 ENV['RBX_CORE'] = "runtime/stable/core.rba"
108 ENV['RBX_LOADER'] = "runtime/stable/loader.rbc"
109 ENV['RBX_PLATFORM'] = "runtime/stable/platform.rba"
329ec45 @evanphx Loading directly from directory structure
evanphx authored
110 end
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
111 end
329ec45 @evanphx Loading directly from directory structure
evanphx authored
112
08d0979 @evanphx Added compiled field to CompiledMethod.
evanphx authored
113 task :stable_shell => :compiler do
114 sh "shotgun/rubinius --gdb"
115 end
116
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
117 rule ".rbc" => %w[compiler .rb] do |t|
118 compile t.source, t.name
329ec45 @evanphx Loading directly from directory structure
evanphx authored
119 end
120
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
121 #file 'runtime/core/kernel/core/proc.rbc' => 'kernel/core/proc.rb' do |t|
122 # p t.prerequisites
123 # p t.name
124 #end
125
126 class CodeGroup
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
127
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
128 def initialize(files, compile_dir, rba_name, load_order=true)
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
129 @files = FileList[files]
130 @output = nil
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
131 @compile_dir = compile_dir
132 @build_dir = File.join 'runtime', rba_name
133 @rba_name = "#{rba_name}.rba"
134
1b1afb2 Always initialize CodeGroup::load_order.
Tilman Sauerbeck authored
135 if load_order
136 @load_order = File.join @compile_dir, '.load_order.txt'
137 else
138 @load_order = nil
139 end
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
140
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
141 @output = []
142
143 make_tasks
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
144 end
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
145
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
146 attr_reader :output
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
147
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
148 def clean
149 sh "find #{@compile_dir} -name '*.rbc' -delete"
150 end
329ec45 @evanphx Loading directly from directory structure
evanphx authored
151
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
152 def compile_task
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
153 @files.each do |source|
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
154 runtime = File.join(@compile_dir, source.ext("rbc"))
155
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
156 @output << runtime
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
157
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
158 deps = [source, @load_order].compact
159
160 file runtime => deps do |t|
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
161 compile t.prerequisites.first, t.name
567d4f7 @evanphx Stack allocated lvars, GC fixes, compiler changes, oh my!
evanphx authored
162 end
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
163 end
164 end
165
166 def load_order_task
167 return unless @load_order
168
f4fc2ff @drbrain Don't rebuild everything if .load_order.txt updates
drbrain authored
169 file @load_order do
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
170 create_load_order(@files, @load_order)
6b9c27b Complete rspec coverage of subtend string compat to date.
Kev authored
171 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
172
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
173 @output << @load_order
cdfdc27 Added my idea of a sanity check against MRI for compatibility purposes
Mae authored
174 end
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
175
176 def make_tasks
177 Dir.mkdir @compile_dir unless File.exists? @compile_dir
178
179 compile_task
180 load_order_task
181 rba_task
182
183 @output
184 end
185
186 def rba_task
187 file File.join('runtime', 'stable', @rba_name) => @output do
0f98906 @drbrain Don't put compiler files into every .rba
drbrain authored
188 files = @output.map do |path|
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
189 path.sub File.join(@build_dir, ''), ''
190 end
191
192 Dir.chdir @build_dir do
193 zip_name = File.join '..', 'stable', @rba_name
194 rm_f zip_name, :verbose => $verbose
195 sh "zip #{zip_name} #{files.join ' '}", :verbose => $verbose
196 end
197 end
086f889 * bin/specrunner is a small bash kludge for running mini_rspec over
Eero Saynatkari authored
198 end
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
199
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
200 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
201
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
202 Core = CodeGroup.new 'kernel/core/*.rb', 'runtime/core', 'core'
203 Bootstrap = CodeGroup.new 'kernel/bootstrap/*.rb', 'runtime/bootstrap',
204 'bootstrap'
205 Platform = CodeGroup.new 'kernel/platform/*.rb', 'runtime/platform', 'platform'
206 Compiler = CodeGroup.new 'compiler/**/*.rb', 'runtime', 'compiler', false
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
207
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
208 file 'runtime/loader.rbc' => 'kernel/loader.rb' do
209 compile 'kernel/loader.rb', 'runtime/loader.rbc'
4d4f6fa @brixen Added namespaces to the Rakefile with aliases to the old tasks.
brixen authored
210 end
211
d997ba7 @drbrain Prefix all env vars with RBX_
drbrain authored
212 file 'runtime/stable/loader.rbc' => 'runtime/loader.rbc' do
213 cp 'runtime/loader.rbc', 'runtime/stable', :verbose => $verbose
214 end
215
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
216 AllPreCompiled = Core.output + Bootstrap.output + Platform.output + Compiler.output
217 AllPreCompiled << "runtime/loader.rbc"
218
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
219 # spec tasks
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
220 desc "Run all 'known good' specs (task alias for spec:ci)"
8b118bf Removed legacy rake tasks
Brian Ford authored
221 task :spec => 'spec:ci'
d0e6b65 @brixen changes to support better CI specs
brixen authored
222
03dfae6 @brixen Added rake task spec:ci. added svn:executable for bin/mspec. enhanced…
brixen authored
223 namespace :spec do
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
224 namespace :setup do
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
225 # Setup for 'Subtend' specs. No need to call this yourself.
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
226 task :subtend do
ed682b8 @mkhl Fix rake spec:subtend:setup.
mkhl authored
227 Dir["spec/subtend/**/Rakefile"].each do |rakefile|
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
228 sh "rake -f #{rakefile}"
229 end
230 end
231 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
232
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
233 desc "Run continuous integration examples"
03dfae6 @brixen Added rake task spec:ci. added svn:executable for bin/mspec. enhanced…
brixen authored
234 task :ci do
c7d623e @brixen enhanced spec:ci to take a target on the command line, invoke like: S…
brixen authored
235 target = ENV['SPEC_TARGET'] || 'rbx'
236 system %(shotgun/rubinius -e 'puts "rbx build: \#{Rubinius::BUILDREV}"') if target == 'rbx'
4ef0b9f @brixen Updated exclusion list for CI specs.
brixen authored
237 sh "bin/ci -t #{target}"
03dfae6 @brixen Added rake task spec:ci. added svn:executable for bin/mspec. enhanced…
brixen authored
238 end
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
239
8b118bf Removed legacy rake tasks
Brian Ford authored
240 spec_targets = %w(compiler core language library parser rubinius)
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
241 # Build a spec:<task_name> for each group of Rubinius specs
242 spec_targets.each do |group|
243 desc "Run #{group} examples"
d08e789 @brixen fixed typo. bad typo. that's a no.
brixen authored
244 task group do
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
245 sh "bin/mspec spec/#{group}"
246 end
247 end
248
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
249 desc "Run subtend (Rubinius C API) examples"
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
250 task :subtend => "spec:setup:subtend" do
d0e6b65 @brixen changes to support better CI specs
brixen authored
251 sh "bin/mspec spec/rubinius/subtend"
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
252 end
253
254 # Specdiffs to make it easier to see what your changes have affected :)
255 desc 'Run specs and produce a diff against current base'
256 task :diff => 'diff:run'
257
258 namespace :diff do
259 desc 'Run specs and produce a diff against current base'
260 task :run do
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
261 system 'bin/mspec -f ci -o spec/reports/specdiff.txt spec'
d0e6b65 @brixen changes to support better CI specs
brixen authored
262 system 'diff -u spec/reports/base.txt spec/reports/specdiff.txt'
263 system 'rm spec/reports/specdiff.txt'
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
264 end
265
266 desc 'Replace the base spec file with a new one'
267 task :replace do
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
268 system 'bin/mspec -f ci -o spec/reports/base.txt spec'
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
269 end
270 end
d630d96 Rakefile now supports rake report:all which runs all of the reports. …
Ryantm authored
271
272 task :r2r do
273 puts ARGV.inspect
274 end
03dfae6 @brixen Added rake task spec:ci. added svn:executable for bin/mspec. enhanced…
brixen authored
275 end
276
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
277 desc "Build everything that needs to be built"
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
278 task :build => 'build:all'
6e51eee @brixen put guards on imcompatible specs to prevent ruby, jruby from running …
brixen authored
279
2449c03 @drbrain Make install put lib files in the right place.
drbrain authored
280 def install_files(files, destination)
281 files.sort.each do |path|
282 next if File.directory? path
283
284 file = path.sub %r%^(runtime|lib)/%, ''
285 dest_file = File.join destination, file
286 dest_dir = File.dirname dest_file
287 mkdir_p dest_dir unless File.directory? dest_dir
288
289 install path, dest_file, :mode => 0644, :verbose => true
290 end
291 end
292
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
293 desc "Install rubinius as rbx"
9a2747f @drbrain Move install target to install task. Make install task work.
drbrain authored
294 task :install => :config_env do
fe62971 @arthurschreiber Fix a problem with the rake install task.
arthurschreiber authored
295 sh "cd shotgun; #{make "install"}"
9a2747f @drbrain Move install target to install task. Make install task work.
drbrain authored
296
297 mkdir_p ENV['RBAPATH'], :verbose => true
298 mkdir_p ENV['CODEPATH'], :verbose => true
299
e5517d5 @drbrain Also need to install .load_order.txt files. My bad.
drbrain authored
300 rba_files = Rake::FileList.new('runtime/**/*.rb{a,c}',
2449c03 @drbrain Make install put lib files in the right place.
drbrain authored
301 'runtime/**/.load_order.txt')
9a2747f @drbrain Move install target to install task. Make install task work.
drbrain authored
302
2449c03 @drbrain Make install put lib files in the right place.
drbrain authored
303 install_files rba_files, ENV['RBAPATH']
9a2747f @drbrain Move install target to install task. Make install task work.
drbrain authored
304
2449c03 @drbrain Make install put lib files in the right place.
drbrain authored
305 lib_files = Rake::FileList.new 'lib/**/*'
9a2747f @drbrain Move install target to install task. Make install task work.
drbrain authored
306
2449c03 @drbrain Make install put lib files in the right place.
drbrain authored
307 install_files lib_files, ENV['CODEPATH']
9a2747f @drbrain Move install target to install task. Make install task work.
drbrain authored
308
309 mkdir_p File.join(ENV['CODEPATH'], 'bin'), :verbose => true
310
311 Rake::FileList.new("#{ENV['CODEPATH']}/**/*.rb").sort.each do |rb_file|
312 sh File.join(ENV['BINPATH'], 'rbx'), 'compile', rb_file, :verbose => true
313 end
314 end
315
2ef13f9 @drbrain Generate lib/rbconfig.rb
drbrain authored
316 task :config_env => 'shotgun/config.mk' do
9a2747f @drbrain Move install target to install task. Make install task work.
drbrain authored
317 File.foreach 'shotgun/config.mk' do |line|
318 next unless line =~ /(.*?)=(.*)/
319 ENV[$1] = $2
320 end
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
321 end
322
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
323 desc "Recompile all ruby system files"
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
324 task :rebuild => %w[clean:rbc clean:shotgun build:all]
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
325
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
326 task :clean => %w[clean:rbc clean:shotgun]
327
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
328 desc "Remove all ruby system files"
d492a25 @drbrain Make distclean task clean everything
drbrain authored
329 task :distclean => %w[clean:rbc clean:shotgun clean:external]
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
330
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
331 desc "Remove all stray compiled Ruby files"
332 task :pristine do
333 FileList['**/*.rbc'].each do |fn|
334 next if /^runtime/.match(fn)
335 FileUtils.rm fn rescue nil
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
336 end
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
337 end
5468980 @evanphx kernel/ reorg! New functionality goes in kernel/core only. kernel.rba…
evanphx authored
338
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
339 namespace :clean do
d492a25 @drbrain Make distclean task clean everything
drbrain authored
340
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
341 desc "Remove all compile system ruby files (runtime/)"
342 task :rbc do
343 AllPreCompiled.each do |f|
12efacd @drbrain Create .load_order.txt when needed.
drbrain authored
344 rm_f f, :verbose => $verbose
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
345 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
346 end
5468980 @evanphx kernel/ reorg! New functionality goes in kernel/core only. kernel.rba…
evanphx authored
347
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
348 desc "Cleans up VM building site"
349 task :shotgun do
335f63e @drbrain Better runner of the correct make
drbrain authored
350 sh make('clean')
351 end
d492a25 @drbrain Make distclean task clean everything
drbrain authored
352
353 desc "Cleans up VM and external libs"
354 task :external do
355 sh "cd shotgun; #{make('distclean')}"
356 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
357 end
404f8ab Don't call configure on build:shotgun everytime.
Tilman authored
358
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
359 namespace :build do
27d0364 @drbrain Build extensions with build:all
drbrain authored
360
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
361 task :all => %w[
362 build:shotgun
363 build:rbc
2ef13f9 @drbrain Generate lib/rbconfig.rb
drbrain authored
364 lib/rbconfig.rb
27d0364 @drbrain Build extensions with build:all
drbrain authored
365 build:extensions
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
366 ]
27d0364 @drbrain Build extensions with build:all
drbrain authored
367
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
368 # This nobody rule lets use use all the shotgun files as
369 # prereqs. This rule is run for all those prereqs and just
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
370 # (obviously) does nothing, but it makes rake happy.
27d0364 @drbrain Build extensions with build:all
drbrain authored
371 rule '^shotgun/.+'
372
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
373 c_source = FileList[
a092725 @drbrain Make LIBVER and VERSION match (now 0.8.x for everything).
drbrain authored
374 "shotgun/config.h",
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
375 "shotgun/lib/*.[ch]",
376 "shotgun/lib/*.rb",
377 "shotgun/lib/subtend/*.[chS]",
378 "shotgun/main.c",
e0bd4d7 @brixen Fixed rake rebuild by omitting cleaned files from dependencies.
brixen authored
379 ].exclude(/auto/, /instruction_names/, /node_types/)
27d0364 @drbrain Build extensions with build:all
drbrain authored
380
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
381 file "shotgun/rubinius.bin" => c_source do
335f63e @drbrain Better runner of the correct make
drbrain authored
382 sh make('vm')
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
383 end
27d0364 @drbrain Build extensions with build:all
drbrain authored
384
a092725 @drbrain Make LIBVER and VERSION match (now 0.8.x for everything).
drbrain authored
385 file 'shotgun/mkconfig.sh' => 'configure'
386 file 'shotgun/config.mk' => %w[shotgun/config.h shotgun/mkconfig.sh shotgun/vars.mk]
387 file 'shotgun/config.h' => %w[shotgun/mkconfig.sh shotgun/vars.mk] do
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
388 sh "./configure"
389 raise 'Failed to configure Rubinius' unless $?.success?
3751f33 @evanphx * Reworked the Rakefile to build the compiler by detection, like boot…
evanphx authored
390 end
970dca2 @wilson Rakefile cleanup. Removed some tasks, renamed others. rake -T for det…
wilson authored
391
dc16b49 @wilson * Near-total rewrite of the Rakefile. Tasks that use rcompile are in …
wilson authored
392 desc "Compiles shotgun (the C-code VM)"
a092725 @drbrain Make LIBVER and VERSION match (now 0.8.x for everything).
drbrain authored
393 task :shotgun => %w[configure shotgun/rubinius.bin]
27d0364 @drbrain Build extensions with build:all
drbrain authored
394
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
395 task :setup_rbc => :compiler
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
396
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
397 task :rbc => ([:setup_rbc] + AllPreCompiled)
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
398
27d0364 @drbrain Build extensions with build:all
drbrain authored
399 # EXTENSIONS
6eab3b6 @brixen Added MRI stdlib Fcntl to lib/ext with build script.
brixen authored
400 task :extensions => %w[build:shotgun build:rbc build:syck build:fcntl]
27d0364 @drbrain Build extensions with build:all
drbrain authored
401
be4319e Don't hardcode extension suffixes to 'bundle'.
Tilman Sauerbeck authored
402 task :syck => "lib/ext/syck/rbxext.#{$dlext}"
27d0364 @drbrain Build extensions with build:all
drbrain authored
403
2ef13f9 @drbrain Generate lib/rbconfig.rb
drbrain authored
404 file 'lib/rbconfig.rb' => %w[config_env Rakefile] do
405 rbconfig = <<-EOF
406 module Config
407
408 CONFIG = {}
409
410 CONFIG['DLEXT'] = Rubinius::LIBSUFFIX.dup
411 CONFIG['EXEEXT'] = ""
412 CONFIG['RUBY_SO_NAME'] = "rubinius-#\{Rubinius::RBX_VERSION}"
413 CONFIG['arch'] = RUBY_PLATFORM.dup
414 CONFIG['bindir'] = "#{ENV['BINPATH']}"
415 CONFIG['datadir'] = "#{File.join ENV['PREFIX'], 'share'}"
416 CONFIG['libdir'] = "#{ENV['LIBPATH']}"
417 CONFIG['ruby_install_name'] = "#{ENV['ENGINE']}"
418 CONFIG['ruby_version'] = Rubinius::RUBY_VERSION.dup
419 CONFIG['sitedir'] = "#{File.join ENV['LIBPATH'], 'rubinius'}"
420 CONFIG['sitelibdir'] = "#{ENV['CODEPATH']}"
421
422 end
423 EOF
424
425 File.open 'lib/rbconfig.rb', 'w' do |fp|
426 fp.write rbconfig
427 end
428 end
429
be4319e Don't hardcode extension suffixes to 'bundle'.
Tilman Sauerbeck authored
430 file "lib/ext/syck/rbxext.#{$dlext}" => FileList[
27d0364 @drbrain Build extensions with build:all
drbrain authored
431 'lib/ext/syck/build.rb',
432 'lib/ext/syck/*.c',
433 'lib/ext/syck/*.h',
434 ] do
435 sh "./shotgun/rubinius compile lib/ext/syck"
436 end
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
437
6eab3b6 @brixen Added MRI stdlib Fcntl to lib/ext with build script.
brixen authored
438 task :fcntl => "lib/ext/fcntl/fcntl.#{$dlext}"
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
439
6eab3b6 @brixen Added MRI stdlib Fcntl to lib/ext with build script.
brixen authored
440 file "lib/ext/fcntl/fcntl.#{$dlext}" => FileList[
441 'lib/ext/fcntl/build.rb',
442 'lib/ext/fcntl/*.c'
443 ] do
444 sh "./shotgun/rubinius compile lib/ext/fcntl"
445 end
27d0364 @drbrain Build extensions with build:all
drbrain authored
446
f0650d1 @drbrain Add build:stable task with appropriate warning
drbrain authored
447 desc "Rebuild runtime/stable/*. If you don't know why you're running this, don't."
448 task :stable => %w[
449 build:all
450 runtime/stable/bootstrap.rba
451 runtime/stable/compiler.rba
452 runtime/stable/core.rba
453 runtime/stable/loader.rbc
454 runtime/stable/platform.rba
455 ]
456
27d0364 @drbrain Build extensions with build:all
drbrain authored
457 # OBSOLETE
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
458 task :core => :rbc do
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
459 raise "OBSOLETE. Use 'rake build'"
6001be6 @evanphx loader.rb is now seperated from bootstrap and core.
evanphx authored
460 end
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
461
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
462 task :bootstrap => :rbc do
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
463 raise "OBSOLETE. Use 'rake build'"
e8b73c6 @wilson * Added build:delete_rbc task to clean up all rbc files, everywhere.
wilson authored
464 end
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
465
4638b74 @evanphx Vast rework of the Rakefile and build process
evanphx authored
466 task :platform => :rbc do
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
467 raise "OBSOLETE. Use 'rake build'"
9e24421 @wilson * Use a random pivot point for better worst-case Array#sort performance
wilson authored
468 end
469
93c6297 @drbrain Add install task, remove tasks task, make build task default, make ob…
drbrain authored
470 task :loader => :rbc do
471 raise "OBSOLETE. Use 'rake build'"
121d2bb @evanphx A little magic for a more bulletproof process. Run rake dev:setup aft…
evanphx authored
472 end
473 end
474
ff3da55 Added :ccrb rake target to build and spec:ci in one target
Andrew Goodney authored
475 desc "Build task for CruiseControl"
476 task :ccrb => [:build, 'spec:ci']
3c0b50e @agardiner Added doc:vm tasks to main Rakefile
agardiner authored
477
478
479 ## Include tasks to build documentation
480 def redcloth_present?
481 if $redcloth_available.nil?
482 begin
483 require 'rubygems'
484 gem 'RedCloth', '~> 3.0'
485 $redcloth_available = true
486 rescue Gem::LoadError
487 puts
488 puts "WARNING: RedCloth 3.x is required to build the VM html docs"
489 puts "Run 'gem install redcloth' to install the latest RedCloth gem"
490 puts
491 $redcloth_available = false
492 end
493 end
494 $redcloth_available
495 end
496
497 namespace "doc" do
498 namespace "vm" do
499
500 desc "Remove all generated HTML files under doc/vm"
501 task "clean" do
502 Dir.glob('doc/vm/**/*.html').each do |html|
503 rm_f html unless html =~ /\/?index.html$/
504 end
505 end
506
507 desc "Generate HTML in doc/vm from YAML and Textile sources"
508 task "html"
509
510 # Define tasks for each opcode html file on the corresponding YAML file
511 require 'doc/vm/op_code_info'
512 OpCode::Info.op_codes.each do |op|
513 html = "doc/vm/op_codes/#{op}.html"
514 yaml = "doc/vm/op_codes/#{op}.yaml"
515 file html => yaml do
516 cd 'doc/vm' do
517 ruby "gen_op_code_html.rb #{op}"
518 end
519 end
520
521 task "html" => html
522 end
523
524 # Define tasks for each section html file on the corresponding textile file
525 # Note: requires redcloth gem to convert textile markup to html
526 Dir.glob('doc/vm/*.textile').each do |f|
527 html = f.chomp('.textile') + '.html'
528 file html => f do
529 if redcloth_present?
530 section = File.basename(f)
531 cd 'doc/vm' do
532 ruby "gen_section_html.rb #{section}"
533 end
534 end
535 end
536
537 task "html" => html
538 end
539 end
540 end
541
542 task :build => 'doc:vm:html'
543
Something went wrong with that request. Please try again.