Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 272 lines (218 sloc) 7.277 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
7862130 @brixen Build Rubinius file system location independent.
brixen authored
36 unless BUILD_CONFIG[:config_version] == 159
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
7862130 @brixen Build Rubinius file system location independent.
brixen authored
47 def libprefixdir
48 if BUILD_CONFIG[:stagingdir]
49 "#{BUILD_CONFIG[:stagingdir]}#{BUILD_CONFIG[:libdir]}"
50 else
51 "#{BUILD_CONFIG[:sourcedir]}/lib"
52 end
53 end
54
31a0d90 @brixen Merge master.
brixen authored
55 # Records the full path to the ruby executable that runs this configure
56 # script. That path will be made available to the rest of the build system
57 # so the same version of ruby is invoked as needed.
58 #
59 # This is duplicated from the configure script for now.
60 @build_ruby = nil
61
62 def build_ruby
63 unless @build_ruby
64 bin = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
65 bin += (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
66 @build_ruby = File.join(RbConfig::CONFIG['bindir'], bin)
67 end
68 @build_ruby
69 end
a5aff42 @dbussink Verify that the ruby to build with is the one it was configured with
dbussink authored
70
71 unless BUILD_CONFIG[:build_ruby] == build_ruby
3ae4157 @brixen Tweaks for configure, Rakefile and install to support common ruby com…
brixen authored
72 STDERR.puts "\nUnable to build using the running Ruby executable.\n\n"
73
74 STDERR.puts "To resolve this issue:"
75 if ENV['PATH'] =~ /#{BUILD_CONFIG[:bindir]}/
76 STDERR.puts " * Remove '#{BUILD_CONFIG[:bindir]}' from your PATH."
77 elsif build_ruby == File.join(BUILD_CONFIG[:bindir], BUILD_CONFIG[:program_name])
78 # This may occur using rbx from the build directory to build a version
79 # of rbx to install. The rbx in the build directory will pick up the
80 # lib/rubinius/build_config.rb that was just written by configure.
81 # Obviously, this chewing gum, duct tape, bailing wire, and toilet paper
82 # system needs fixing.
83 STDERR.puts " * Configure using a Ruby executable other than the one in your build directory."
84 else
85 STDERR.puts " * Use '#{BUILD_CONFIG[:build_ruby]}' to build."
86 end
87
a5aff42 @dbussink Verify that the ruby to build with is the one it was configured with
dbussink authored
88 exit 1
89 end
90
6b363a8 @brixen Propagate --cc configure setting to CC, CXX env vars. Closes #520.
brixen authored
91 # Set the build compiler to the configured compiler unless
92 # the compiler is set via CC environment variable.
6596ed7 @brixen Provide both --cc and --cxx in configure.
brixen authored
93 ENV['CC'] = BUILD_CONFIG[:cc] unless ENV['CC']
94 ENV['CXX'] = BUILD_CONFIG[:cxx] unless ENV['CXX']
6b363a8 @brixen Propagate --cc configure setting to CC, CXX env vars. Closes #520.
brixen authored
95
bd6aef7 @dbussink Use RbConfig instead of Config
dbussink authored
96 $dlext = RbConfig::CONFIG["DLEXT"]
53969ac @brixen Fixed package:llvm task, remove unused misleading compile_c.
brixen authored
97 $CC = ENV['CC']
9ebee09 @brixen Add mspec and spec rakelib files from master.
brixen authored
98
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
99 class SpecRunner
d5be52f @brixen Fixed rake process exit status. Fixes #1687.
brixen authored
100
101 @at_exit_handler_set = false
102 @at_exit_status = 0
103
7862130 @brixen Build Rubinius file system location independent.
brixen authored
104 def self.at_exit_status
105 @at_exit_status
106 end
107
d5be52f @brixen Fixed rake process exit status. Fixes #1687.
brixen authored
108 def self.set_at_exit_handler
109 return if @at_exit_handler_set
110
111 at_exit { exit @at_exit_status }
112 @at_exit_handler_set = true
113 end
114
115 def self.set_at_exit_status(status)
116 @at_exit_status = status
117 end
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
118
119 def initialize
7862130 @brixen Build Rubinius file system location independent.
brixen authored
120 unless File.directory? BUILD_CONFIG[:runtimedir]
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
121 # Setting these enables the specs to run when rbx has been configured
122 # to be installed, but rake install has not been run yet.
123 ENV["RBX_RUNTIME"] = File.expand_path "../runtime", __FILE__
124 ENV["RBX_LIB"] = File.expand_path "../lib", __FILE__
125 ENV["CFLAGS"] = "-Ivm/capi"
126 end
0c1fb8e @brixen Make specs run from rake regardless of install config.
brixen authored
127
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
128 ENV.delete("RUBYOPT")
129
130 @handler = lambda do |ok, status|
d5be52f @brixen Fixed rake process exit status. Fixes #1687.
brixen authored
131 self.class.set_at_exit_status(status.exitstatus) unless ok
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
132 end
133 end
4e10d14 @brixen Unset RUBYOPT when running CI from rake.
brixen authored
134
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
135 def run(flags=nil)
84b9977 @brixen Fixed setting exit status when specs run.
brixen authored
136 self.class.set_at_exit_handler
137
c75e346 @brixen Try adding Agent to CI again.
brixen authored
138 sh("bin/mspec ci #{ENV['CI_MODE_FLAG'] || flags} -d --agent --background", &@handler)
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
139 end
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
140 end
141
7862130 @brixen Build Rubinius file system location independent.
brixen authored
142 if BUILD_CONFIG[:stagingdir]
143 task :default => [:spec, :check_status, :install]
144 else
145 task :default => :spec
146 end
147
148 task :check_status do
149 exit unless SpecRunner.at_exit_status == 0
150 end
8dd2b6b @evanphx r43@vatu: evan | 2006-08-24 16:34:21 -0700
evanphx authored
151
6ea4f49 @evanphx Add github task to aid in migration
evanphx authored
152 task :github do
153 cur = `git config remote.origin.url`.strip
154 if cur == "git://github.com/evanphx/rubinius.git"
155 sh "git config remote.origin.url git://github.com/rubinius/rubinius.git"
156 puts "\nSwitch to git://github.com/rubinius/rubinius.git"
157 else
158 sh "git config remote.origin.url git@github.com:rubinius/rubinius.git"
159 puts "\nSwitch to github.com:rubinius/rubinius.git"
160 end
161 end
162
bdcf9cb @rue DEV is gone. See `rake build:help`. vm:test always uses debug flags.
rue authored
163 # See vm.rake for more information
7862130 @brixen Build Rubinius file system location independent.
brixen authored
164 desc "Build Rubinius"
165 task :build => %w[build:build gems:install]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
166
90ffc92 @drbrain Rip out irrelevant parts of the Rakefile
drbrain authored
167 desc "Recompile all ruby system files"
168 task :rebuild => %w[clean build]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
169
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
170 def run_ci
a8390a9 Add ci rake task
Evan Phoenix authored
171 unless system("rake -q")
172 puts "<< ERROR IN CI, CLEANING AND RERUNNING >>"
173 system "rake -q clean"
174 system "find . -name *.rbc -delete"
175 sh "rake -q"
176 end
177 end
178
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
179 desc "Run CI in default (configured) mode"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
180 task :ci => %w[build vm:test] do
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
181 run_ci
182 end
183
184 # These tasks run the specs in the specified mode regardless of
185 # the default mode with which Rubinius was configured.
186 desc "Run CI in 1.8 mode"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
187 task :ci18 => %w[build vm:test] do
188 ENV['CI_MODE_FLAG'] = "-T -X18"
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
189 run_ci
190 end
191
192 desc "Run CI in 1.9 mode"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
193 task :ci19 => %w[build vm:test] do
5853d7f @brixen Specific :ci18 and :ci19 tasks.
brixen authored
194 ENV['CI_MODE_FLAG'] = "-T -X19"
195 run_ci
196 end
197
58a50ec @brixen Added experimental 2.0 support.
brixen authored
198 desc "Run CI in 2.0 mode"
a276d22 @brixen Run specs in 1.8 and 1.9 mode by default.
brixen authored
199 task :ci20 => %w[build vm:test] do
58a50ec @brixen Added experimental 2.0 support.
brixen authored
200 ENV['CI_MODE_FLAG'] = "-T -X20"
201 run_ci
202 end
203
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
204 desc 'Remove rubinius build files'
af222ee @drbrain Restore generation of ruby_config and rubinius_config, add clean rules
drbrain authored
205 task :clean => %w[
206 vm:clean
207 kernel:clean
208 clean:crap
9ed0630 @brixen Reworked compiling C extensions.
brixen authored
209 extensions:clean
af222ee @drbrain Restore generation of ruby_config and rubinius_config, add clean rules
drbrain authored
210 ]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
211
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
212 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
213 task :distclean => %w[
214 clean
215 vm:distclean
216 ]
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
217
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
218 namespace :clean do
219 desc "Cleans up editor files and other misc crap"
220 task :crap do
221 files = (Dir["*~"] + Dir["**/*~"]).uniq
1ce3d9b Reduced Rakefile to a minimally working version
Ryan Davis authored
222
569fccd @drbrain Move vm/Rakefile to rakelib/vm.rake, integrate it into the base rake …
drbrain authored
223 rm_f files, :verbose => $verbose unless files.empty?
224 end
225 end
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
226
df791c5 @brixen Enable running docs site with bootstrap Ruby using 'rake docs'.
brixen authored
227 desc "Run the Rubinius documentation website"
228 task :docs do
229 require 'kernel/delta/options'
230 require 'rbconfig'
231 require 'webrick'
232 require 'lib/rubinius/documentation'
233
234 Rubinius::Documentation.main
235 end
236
d5be52f @brixen Fixed rake process exit status. Fixes #1687.
brixen authored
237 spec_runner = SpecRunner.new
238
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
239 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
240 task :spec18 => %w[build vm:test] do
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
241 spec_runner.run "-T -X18"
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
242 end
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
243
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
244 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
245 task :spec19 => %w[build vm:test] do
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
246 spec_runner.run "-T -X19"
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
247 end
2e737d7 @brixen Removed rake spec commands. See rake spec for details.
brixen authored
248
58a50ec @brixen Added experimental 2.0 support.
brixen authored
249 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
250 task :spec20 => %w[build vm:test] do
02d7caa @brixen Run all spec tasks even when a failure occurs.
brixen authored
251 spec_runner.run "-T -X20"
58a50ec @brixen Added experimental 2.0 support.
brixen authored
252 end
253
c4e6508 @brixen Added spec, spec18, spec19 rake tasks.
brixen authored
254 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
255 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
256
257 desc "Print list of items marked to-do in kernel/ (@todo|TODO)"
258 task :todos do
0640ece Apply patch for todo. Fixes #810
Evan Phoenix authored
259
260 # create array with files to be checked
261 filesA = Dir['kernel/**/*.*']
7a59f42 @veganstraightedge rake tasks for getting a list of committers by calendar quarter
veganstraightedge authored
262
0640ece Apply patch for todo. Fixes #810
Evan Phoenix authored
263 # search for @todo or TODO
264 filesA.sort!.each do |filename|
265 File.open(filename) do |file|
266 file.each do |line|
267 puts "#{filename} #{file.lineno.to_s}:\t#{line.strip}" if line.include?("@todo") or line.include?("TODO")
268 end
269 end
270 end
580e56e @rue Add task :todos to do a simple grep for todo marks in kernel/.
rue authored
271 end
Something went wrong with that request. Please try again.