Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 276 lines (220 sloc) 7.697 kB
90c05c1 @drbrain Update INSTALL to latest information.
drbrain authored
1 # NOTE! When updating this file, also update INSTALL, if necessary.
a8bdc6b @evanphx Cleanup / reorganize Rakefile
evanphx authored
2 # NOTE! Please keep your tasks grouped together.
90c05c1 @drbrain Update INSTALL to latest information.
drbrain authored
3
af5cae6 @brixen Refuse to configure, build if RUBYLIB is set.
brixen authored
4 if ENV["RUBYLIB"]
5 STDERR.puts "ERROR: Please unset RUBYLIB to build Rubinius"
6 exit 1
7 end
8
c3a6df2 Wipe out CDPATH when building. Fixes #555
Evan Phoenix authored
9 # Wipe out CDPATH, it interferes with building in some cases,
e4c03c2 @czarneckid Change only the appropriate references to point from evanphx to rubin…
czarneckid authored
10 # see http://github.com/rubinius/rubinius/issues#issue/555
c3a6df2 Wipe out CDPATH when building. Fixes #555
Evan Phoenix authored
11 if ENV["CDPATH"]
12 ENV.delete("CDPATH")
13 end
14
1088784 Silence a rake warning
Jacqui Maher and Wilson Bilkovich authored
15 $trace ||= false
69a6063 Enable warnings for rake.
Tilman Sauerbeck authored
16 $VERBOSE = true
bdcf9cb @rue DEV is gone. See `rake build:help`. vm:test always uses debug flags.
rue authored
17 $verbose = Rake.application.options.trace || ARGV.delete("-v")
18
a352624 Start of new LLVM JIT
Evan Phoenix authored
19 if !$verbose and respond_to?(:verbose)
20 verbose(false) if verbose() == :default
21 end
22
9465976 @brixen Generalize building with MRI 1.8/1.9 or rbx.
brixen authored
23 $:.unshift File.expand_path("../", __FILE__)
24
a632b48 @brixen Added new rake install tasks.
brixen authored
25 config_rb = File.expand_path "../config.rb", __FILE__
26 config_h = File.expand_path "../vm/gen/config.h", __FILE__
27
28 unless File.exists?(config_rb) and File.exists?(config_h)
243a775 @brixen Reworked configuring tasks.
brixen authored
29 STDERR.puts "Please run ./configure first"
30 exit 1
31 end
32
a632b48 @brixen Added new rake install tasks.
brixen authored
33 require config_rb
34 BUILD_CONFIG = Rubinius::BUILD_CONFIG
0941eb2 @drbrain Add tasks to build .rba files
drbrain authored
35
629c592 @dbussink Support LLVM 3.1
dbussink authored
36 unless BUILD_CONFIG[:config_version] == 157
e846db9 @brixen Ensure Rakefile checks configure version before anything. Closes #385.
brixen authored
37 STDERR.puts "Your configuration is outdated, please run ./configure first"
9465976 @brixen Generalize building with MRI 1.8/1.9 or rbx.
brixen authored
38 exit 1
39 end
40
e846db9 @brixen Ensure Rakefile checks configure version before anything. Closes #385.
brixen authored
41 # Yes, this is duplicated from the configure script for now.
42 unless BUILD_CONFIG[:which_ruby] == :ruby or BUILD_CONFIG[:which_ruby] == :rbx
43 STDERR.puts "Sorry, building Rubinius requires MRI or Rubinius"
84e1594 @brixen Added config version to enable detecting stale configuration.
brixen authored
44 exit 1
45 end
46
31a0d90 @brixen Merge master.
brixen authored
47 # Records the full path to the ruby executable that runs this configure
48 # script. That path will be made available to the rest of the build system
49 # so the same version of ruby is invoked as needed.
50 #
51 # This is duplicated from the configure script for now.
52 @build_ruby = nil
53
54 def build_ruby
55 unless @build_ruby
56 bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
57 bin += (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
58 @build_ruby = File.join(RbConfig::CONFIG['bindir'], bin)
59 end
60 @build_ruby
61 end
a5aff42 @dbussink Verify that the ruby to build with is the one it was configured with
dbussink authored
62
63 unless BUILD_CONFIG[:build_ruby] == build_ruby
3ae4157 @brixen Tweaks for configure, Rakefile and install to support common ruby com…
brixen authored
64 STDERR.puts "\nUnable to build using the running Ruby executable.\n\n"
65
66 STDERR.puts "To resolve this issue:"
67 if ENV['PATH'] =~ /#{BUILD_CONFIG[:bindir]}/
68 STDERR.puts " * Remove '#{BUILD_CONFIG[:bindir]}' from your PATH."
69 elsif build_ruby == File.join(BUILD_CONFIG[:bindir], BUILD_CONFIG[:program_name])
70 # This may occur using rbx from the build directory to build a version
71 # of rbx to install. The rbx in the build directory will pick up the
72 # lib/rubinius/build_config.rb that was just written by configure.
73 # Obviously, this chewing gum, duct tape, bailing wire, and toilet paper
74 # system needs fixing.
75 STDERR.puts " * Configure using a Ruby executable other than the one in your build directory."
76 else
77 STDERR.puts " * Use '#{BUILD_CONFIG[:build_ruby]}' to build."
78 end
79
a5aff42 @dbussink Verify that the ruby to build with is the one it was configured with
dbussink authored
80 exit 1
81 end
82
6b363a8 @brixen Propagate --cc configure setting to CC, CXX env vars. Closes #520.
brixen authored
83 # Set the build compiler to the configured compiler unless
84 # the compiler is set via CC environment variable.
6596ed7 @brixen Provide both --cc and --cxx in configure.
brixen authored
85 ENV['CC'] = BUILD_CONFIG[:cc] unless ENV['CC']
86 ENV['CXX'] = BUILD_CONFIG[:cxx] unless ENV['CXX']
6b363a8 @brixen Propagate --cc configure setting to CC, CXX env vars. Closes #520.
brixen authored
87
bd6aef7 @dbussink Use RbConfig instead of Config
dbussink authored
88 $dlext = RbConfig::CONFIG["DLEXT"]
53969ac @brixen Fixed package:llvm task, remove unused misleading compile_c.
brixen authored
89 $CC = ENV['CC']
9ebee09 @brixen Add mspec and spec rakelib files from master.
brixen authored
90
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
91 class SpecRunner
d5be52f @brixen Fixed rake process exit status. Fixes #1687.
brixen authored
92
93 @at_exit_handler_set = false
94 @at_exit_status = 0
95
96 def self.set_at_exit_handler
97 return if @at_exit_handler_set
98
99 at_exit { exit @at_exit_status }
100 @at_exit_handler_set = true
101 end
102
103 def self.set_at_exit_status(status)
104 @at_exit_status = status
105 end
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
106
107 def initialize
108 unless File.directory? BUILD_CONFIG[:runtime]
109 # Setting these enables the specs to run when rbx has been configured
110 # to be installed, but rake install has not been run yet.
111 ENV["RBX_RUNTIME"] = File.expand_path "../runtime", __FILE__
112 ENV["RBX_LIB"] = File.expand_path "../lib", __FILE__
113 ENV["CFLAGS"] = "-Ivm/capi"
114 end
0c1fb8e @brixen Make specs run from rake regardless of install config.
brixen authored
115
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
116 ENV.delete("RUBYOPT")
117
118 @handler = lambda do |ok, status|
d5be52f @brixen Fixed rake process exit status. Fixes #1687.
brixen authored
119 self.class.set_at_exit_status(status.exitstatus) unless ok
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
120 end
121 end
4e10d14 @brixen Unset RUBYOPT when running CI from rake.
brixen authored
122
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
123 def run(flags=nil)
84b9977 @brixen Fixed setting exit status when specs run.
brixen authored
124 self.class.set_at_exit_handler
125
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
126 sh("bin/mspec ci #{ENV['CI_MODE_FLAG'] || flags} -d --background", &@handler)
127 end
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
128 end
129
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
130 task :default => :spec
8dd2b6b @evanphx r43@vatu: evan | 2006-08-24 16:34:21 -0700
evanphx authored
131
6ea4f49 @evanphx Add github task to aid in migration
evanphx authored
132 task :github do
133 cur = `git config remote.origin.url`.strip
134 if cur == "git://github.com/evanphx/rubinius.git"
135 sh "git config remote.origin.url git://github.com/rubinius/rubinius.git"
136 puts "\nSwitch to git://github.com/rubinius/rubinius.git"
137 else
138 sh "git config remote.origin.url git@github.com:rubinius/rubinius.git"
139 puts "\nSwitch to github.com:rubinius/rubinius.git"
140 end
141 end
142
bdcf9cb @rue DEV is gone. See `rake build:help`. vm:test always uses debug flags.
rue authored
143 # See vm.rake for more information
144 desc "Build everything that needs to be built at default level."
39a7914 Introdue Daedalus, a new native code builder
Evan Phoenix authored
145 task :build => ["build:build", "gem_bootstrap"]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
146
90ffc92 @drbrain Rip out irrelevant parts of the Rakefile
drbrain authored
147 desc "Recompile all ruby system files"
148 task :rebuild => %w[clean build]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
149
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
150 def run_ci
a8390a9 Add ci rake task
Evan Phoenix authored
151 unless system("rake -q")
152 puts "<< ERROR IN CI, CLEANING AND RERUNNING >>"
153 system "rake -q clean"
154 system "find . -name *.rbc -delete"
155 sh "rake -q"
156 end
157 end
158
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
159 desc "Run CI in default (configured) mode"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
160 task :ci => %w[build vm:test] do
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
161 run_ci
162 end
163
164 # These tasks run the specs in the specified mode regardless of
165 # the default mode with which Rubinius was configured.
166 desc "Run CI in 1.8 mode"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
167 task :ci18 => %w[build vm:test] do
168 ENV['CI_MODE_FLAG'] = "-T -X18"
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
169 run_ci
170 end
171
172 desc "Run CI in 1.9 mode"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
173 task :ci19 => %w[build vm:test] do
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
174 ENV['CI_MODE_FLAG'] = "-T -X19"
175 run_ci
176 end
177
58a50ec @brixen Added experimental 2.0 support.
brixen authored
178 desc "Run CI in 2.0 mode"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
179 task :ci20 => %w[build vm:test] do
58a50ec @brixen Added experimental 2.0 support.
brixen authored
180 ENV['CI_MODE_FLAG'] = "-T -X20"
181 run_ci
182 end
183
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
184 desc 'Remove rubinius build files'
af222ee @drbrain Restore generation of ruby_config and rubinius_config, add clean rules
drbrain authored
185 task :clean => %w[
186 vm:clean
187 kernel:clean
188 clean:crap
9ed0630 @brixen Reworked compiling C extensions.
brixen authored
189 extensions:clean
af222ee @drbrain Restore generation of ruby_config and rubinius_config, add clean rules
drbrain authored
190 ]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
191
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
192 desc 'Remove rubinius build files and external library build files'
af222ee @drbrain Restore generation of ruby_config and rubinius_config, add clean rules
drbrain authored
193 task :distclean => %w[
194 clean
195 vm:distclean
196 ]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
197
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
198 namespace :clean do
199 desc "Cleans up editor files and other misc crap"
200 task :crap do
201 files = (Dir["*~"] + Dir["**/*~"]).uniq
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
202
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
203 rm_f files, :verbose => $verbose unless files.empty?
204 end
205 end
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
206
bed9da6 @brixen Installed pre-installed gems with rubygems. Fixes #1712
brixen authored
207 desc 'Install the pre-installed gems'
a632b48 @brixen Added new rake install tasks.
brixen authored
208 task :gem_bootstrap do
bed9da6 @brixen Installed pre-installed gems with rubygems. Fixes #1712
brixen authored
209 STDOUT.puts "Installing pre-installed gems..."
fc7ad0b @mpapis reset GEM_HOME & GEM_PATH to not install gems in currently used RVM r…
mpapis authored
210 ENV['GEM_HOME'] = ENV['GEM_PATH'] = nil
bed9da6 @brixen Installed pre-installed gems with rubygems. Fixes #1712
brixen authored
211
212 rbx = "#{BUILD_CONFIG[:bindir]}/#{BUILD_CONFIG[:program_name]}"
213 gems = Dir["preinstalled-gems/*.gem"]
214 options = "--local --conservative --ignore-dependencies --no-rdoc --no-ri"
215
216 BUILD_CONFIG[:version_list].each do |ver|
217 gems.each do |gem|
218 parts = File.basename(gem, ".gem").split "-"
219 gem_name = parts[0..-2].join "-"
220 gem_version = parts[-1]
221
222 system "#{rbx} -X#{ver} -S gem query --name-matches #{gem_name} --installed --version #{gem_version} > #{DEV_NULL}"
223
224 unless $?.success?
225 sh "#{rbx} -X#{ver} -S gem install #{options} #{gem}"
226 end
227 end
a632b48 @brixen Added new rake install tasks.
brixen authored
228 end
229 end
230
df791c5 @brixen Enable running docs site with bootstrap Ruby using 'rake docs'.
brixen authored
231 desc "Run the Rubinius documentation website"
232 task :docs do
233 require 'kernel/delta/options'
234 require 'rbconfig'
235 require 'webrick'
236 require 'lib/rubinius/documentation'
237
238 Rubinius::Documentation.main
239 end
240
d5be52f @brixen Fixed rake process exit status. Fixes #1687.
brixen authored
241 spec_runner = SpecRunner.new
242
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
243 desc "Run the CI specs in 1.8 mode but do not rebuild on failure"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
244 task :spec18 => %w[build vm:test] do
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
245 spec_runner.run "-T -X18"
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
246 end
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
247
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
248 desc "Run the CI specs in 1.9 mode but do not rebuild on failure"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
249 task :spec19 => %w[build vm:test] do
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
250 spec_runner.run "-T -X19"
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
251 end
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
252
58a50ec @brixen Added experimental 2.0 support.
brixen authored
253 desc "Run the CI specs in 2.0 mode but do not rebuild on failure"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
254 task :spec20 => %w[build vm:test] do
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
255 spec_runner.run "-T -X20"
58a50ec @brixen Added experimental 2.0 support.
brixen authored
256 end
257
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
258 desc "Run CI in default (configured) mode but do not rebuild on failure"
ccaa717 @brixen Build and test with only 1.8 or 1.9 mode enabled.
brixen authored
259 task :spec => BUILD_CONFIG[:version_list].map { |v| "spec#{v}" }
580e56e @rue Add task :todos to do a simple grep for todo marks in kernel/.
rue authored
260
261 desc "Print list of items marked to-do in kernel/ (@todo|TODO)"
262 task :todos do
0640ece Apply patch for todo. Fixes #810
Evan Phoenix authored
263
264 # create array with files to be checked
265 filesA = Dir['kernel/**/*.*']
7a59f42 @veganstraightedge rake tasks for getting a list of committers by calendar quarter
veganstraightedge authored
266
0640ece Apply patch for todo. Fixes #810
Evan Phoenix authored
267 # search for @todo or TODO
268 filesA.sort!.each do |filename|
269 File.open(filename) do |file|
270 file.each do |line|
271 puts "#{filename} #{file.lineno.to_s}:\t#{line.strip}" if line.include?("@todo") or line.include?("TODO")
272 end
273 end
274 end
580e56e @rue Add task :todos to do a simple grep for todo marks in kernel/.
rue authored
275 end
Something went wrong with that request. Please try again.