Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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