Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Generalize building with MRI 1.8/1.9 or rbx.

  • Loading branch information...
commit 9465976faa546f262993b06f3018d00bcfb81ec0 1 parent e92fc82
@brixen brixen authored
View
12 Rakefile
@@ -9,6 +9,8 @@ if !$verbose and respond_to?(:verbose)
verbose(false) if verbose() == :default
end
+$:.unshift File.expand_path("../", __FILE__)
+
config_rb = File.expand_path "../config.rb", __FILE__
config_h = File.expand_path "../vm/gen/config.h", __FILE__
@@ -20,15 +22,19 @@ end
require config_rb
BUILD_CONFIG = Rubinius::BUILD_CONFIG
-unless BUILD_CONFIG[:config_version] == 9
+# Yes, this is duplicated from the configure script for now.
+unless BUILD_CONFIG[:which_ruby] == :ruby or BUILD_CONFIG[:which_ruby] == :rbx
+ STDERR.puts "Sorry, building Rubinius requires MRI or Rubinius"
+ exit 1
+end
+
+unless BUILD_CONFIG[:config_version] == 10
STDERR.puts "Your configuration is outdated, please run ./configure first"
exit 1
end
$dlext = Config::CONFIG["DLEXT"]
-$: << "lib"
-
task :default => %w[build vm:test] do
unless File.directory? BUILD_CONFIG[:runtime]
# Setting these enables the specs to run when rbx has been configured
View
3  bin/mspec
@@ -1,3 +1,6 @@
#!/usr/bin/env ruby
+paths = ENV["RUBYLIB"]
+ENV["RUBYLIB"] = paths ? paths + ":." : "."
+
exec 'mspec/bin/mspec', *ARGV
View
31 configure
@@ -4,11 +4,6 @@ require 'rbconfig'
require 'tempfile'
require 'fileutils'
-unless !defined?(RUBY_ENGINE) || (RUBY_ENGINE == 'ruby' && RUBY_VERSION < '1.9.0')
- STDERR.puts "Sorry, for now please build rubinius using ruby 1.8"
- exit 1
-end
-
root = File.expand_path File.dirname(__FILE__)
require File.join(root, "kernel", "delta", "options")
@@ -70,7 +65,7 @@ class Configure
@libversion = "1.0"
@version = "#{@libversion}.1"
@release_date = "2010-06-03"
- @config_version = 9
+ @config_version = 10
if !ENV['RELEASE'] and File.directory?(root + "/.git")
@buildrev = `git rev-list --all | head -n1`.chomp
@@ -524,6 +519,23 @@ class Configure
detect_features
end
+ def which_ruby
+ if Object.const_defined?(:RUBY_ENGINE)
+ @which_ruby = RUBY_ENGINE.to_sym
+ else
+ @which_ruby = :ruby
+ end
+ end
+
+ # Records the full path to the ruby executable that runs this configure
+ # script. That path will be made available to the rest of the build system
+ # so the same version of ruby is invoked as needed.
+ def build_ruby
+ bin = Config::CONFIG["RUBY_INSTALL_NAME"] || Config::CONFIG["ruby_install_name"]
+ bin << (Config::CONFIG['EXEEXT'] || Config::CONFIG['exeext'] || '')
+ File.join(Config::CONFIG['bindir'], bin)
+ end
+
def write_config
unless @use_llvm
@llvm = :no
@@ -534,6 +546,8 @@ class Configure
f.puts <<-EOC
module Rubinius
BUILD_CONFIG = {
+ :which_ruby => :#{which_ruby},
+ :build_ruby => "#{build_ruby}",
:llvm => :#{@llvm},
:llvm_configure => "#{@llvm_configure}",
:compiler => "#{@compiler}",
@@ -600,6 +614,11 @@ end
end
def run
+ unless which_ruby == :ruby or which_ruby == :rbx
+ STDERR.puts "Sorry, building Rubinius requires MRI or Rubinius"
+ exit 1
+ end
+
options
parse ARGV
process
View
12 lib/ext/dl/depend
@@ -3,15 +3,15 @@ LDSHARED_TEST = $(LDSHARED) $(LDFLAGS) test/test.o -o test/libtest.so $(LOCAL_LI
libtest.so: test/libtest.so
test/libtest.so: test/test.o $(srcdir)/test/libtest.def
- ruby -rftools -e 'ARGV.each do|d|File.mkpath(File.dirname(d))end' $@
+ $(BUILD_RUBY) -rftools -e 'ARGV.each do|d|File.mkpath(File.dirname(d))end' $@
$(LDSHARED_TEST:dl.def=test/libtest.def)
test/test.o: $(srcdir)/test/test.c
- @ruby -rftools -e 'File.mkpath(*ARGV)' test
+ @$(BUILD_RUBY) -rftools -e 'File.mkpath(*ARGV)' test
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/test/test.c -o $@
test:: dl.so libtest.so force
- ruby -I. -I$(srcdir)/lib $(srcdir)/test/test.rb
+ $(BUILD_RUBY) -I. -I$(srcdir)/lib $(srcdir)/test/test.rb
force:
@@ -32,15 +32,15 @@ handle.o: ruby.h dl.h
call.func: $(srcdir)/mkcall.rb ./dlconfig.rb
@echo "Generating call.func"
- @ruby $(srcdir)/mkcall.rb > $@
+ @$(BUILD_RUBY) $(srcdir)/mkcall.rb > $@
callback.func: $(srcdir)/mkcallback.rb ./dlconfig.rb
@echo "Generating callback.func"
- @ruby $(srcdir)/mkcallback.rb > $@
+ @$(BUILD_RUBY) $(srcdir)/mkcallback.rb > $@
cbtable.func: $(srcdir)/mkcbtable.rb ./dlconfig.rb
@echo "Generating cbtable.func"
- @ruby $(srcdir)/mkcbtable.rb > $@
+ @$(BUILD_RUBY) $(srcdir)/mkcbtable.rb > $@
debug:
$(MAKE) CPPFLAGS="$(CPPFLAGS) -DDEBUG"
View
8 rakelib/extensions.rake
@@ -44,8 +44,10 @@ def compile_ext(name, opts={})
dep_grapher = File.expand_path "../dependency_grapher.rb", __FILE__
Dir.chdir ext_dir do
if File.exists? "Rakefile"
- ruby "-S rake #{'-t' if $verbose} -r #{ext_helper} -r #{dep_grapher} #{ext_task_name}"
+ sh "#{BUILD_CONFIG[:build_ruby]} -S rake #{'-t' if $verbose} -r #{ext_helper} -r #{dep_grapher} #{ext_task_name}"
else
+ ENV["BUILD_RUBY"] = BUILD_CONFIG[:build_ruby]
+
unless File.directory? BUILD_CONFIG[:runtime]
ENV["CFLAGS"] = "-Ivm/capi/include"
end
@@ -73,7 +75,9 @@ compile_ext "digest:sha2"
compile_ext "digest:bubblebabble"
compile_ext "syck"
compile_ext "melbourne", :task => "rbx", :doc => "for Rubinius"
-compile_ext "melbourne", :task => "mri", :doc => "for MRI"
+if BUILD_CONFIG[:which_ruby] == :ruby
+ compile_ext "melbourne", :task => "mri", :doc => "for MRI"
+end
compile_ext "nkf"
# rbx must be able to run to build these because they use
View
6 lib/ffi/generator_task.rb → rakelib/generator_task.rb
@@ -2,9 +2,9 @@
require 'rake/tasklib'
require 'tempfile'
-require 'ffi/struct_generator'
-require 'ffi/const_generator'
-require 'ffi/generator'
+require 'lib/ffi/struct_generator'
+require 'lib/ffi/const_generator'
+require 'lib/ffi/generator'
##
View
16 rakelib/kernel.rake
@@ -131,13 +131,19 @@ file compiler_signature => compiler_files + parser_ext_files do |t|
end
namespace :compiler do
- melbourne = "lib/ext/melbourne/ruby/melbourne.#{$dlext}"
+ if BUILD_CONFIG[:which_ruby] == :ruby
+ melbourne = "lib/ext/melbourne/ruby/melbourne.#{$dlext}"
- file melbourne => "extensions:melbourne_mri"
+ file melbourne => "extensions:melbourne_mri"
- task :load => [compiler_signature, melbourne] + compiler_files do
- require File.expand_path("../../lib/compiler", __FILE__)
- require File.expand_path("../../kernel/signature", __FILE__)
+ task :load => [compiler_signature, melbourne] + compiler_files do
+ require File.expand_path("../../lib/compiler", __FILE__)
+ require File.expand_path("../../kernel/signature", __FILE__)
+ end
+ else
+ task :load => compiler_signature do
+ require File.expand_path("../../kernel/signature", __FILE__)
+ end
end
end
View
6 rakelib/platform.rake
@@ -1,6 +1,6 @@
-require 'ffi/struct_generator'
-require 'ffi/const_generator'
-require 'ffi/types_generator'
+require 'lib/ffi/struct_generator'
+require 'lib/ffi/const_generator'
+require 'lib/ffi/types_generator'
deps = %w[Rakefile rakelib/platform.rake] + Dir['lib/ffi/*rb']
View
3  rakelib/vm.rake
@@ -1,12 +1,11 @@
require 'rakelib/rubinius'
require 'rakelib/build'
require 'rakelib/instruction_parser'
+require 'rakelib/generator_task'
require 'tmpdir'
require 'ostruct'
-require 'lib/ffi/generator_task.rb'
-
config = OpenStruct.new
config.use_jit = true
config.compile_with_llvm = false
Please sign in to comment.
Something went wrong with that request. Please try again.