Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

106 lines (83 sloc) 2.489 kb
require 'rake/loaders/makefile'
# Special rule for putting .o files in the implementation-specific
# subdirectory so this single extension can be built for both MRI
# and Rubinius
rule ".o" do |t|
source = t.prerequisites.first
report_command "CXX #{source}"
qsh "#{$CXX} -c -o #{t.name} #{$CXXFLAGS} #{$DEBUGFLAGS} #{File.expand_path(source)}"
end
def set_ext_dir(dir)
Dir.mkdir(dir) unless File.exists?(dir)
@ext_dir = dir
end
def ext_dir
@ext_dir
end
def source_files
sources("grammar18.cpp", "grammar19.cpp")
end
# Setup project files
def add_objects(files, dir)
source_files.zip(objects(dir)).each do |source, obj|
file obj => source
file obj => __FILE__ # depend on the Rakefile, it might change
files << source << obj
end
end
project_files = common_headers + headers
# This is a horrid hack. It is temporary until we replace Rake
# as the build system.
case Rake.application.top_level_tasks
when ["build:rbx"]
puts "Building Melbourne for Rubinius"
add_rbx_capi
set_ext_dir "rbx"
when ["build:build"]
set_ext_dir "build"
if Rubinius::BUILD_CONFIG[:which_ruby] == :ruby
puts "Building bootstrap Melbourne for MRI"
add_mri_capi
add_link_dir RbConfig::CONFIG["libdir"]
# timezone and timespec are available in mingw-w64
if RbConfig::CONFIG['host_os'] =~ /mingw/
add_define "HAVE_STRUCT_TIMEZONE"
add_define "HAVE_STRUCT_TIMESPEC"
end
if RbConfig::CONFIG["ENABLE_SHARED"] == "yes"
add_ldflag RbConfig::CONFIG["LIBRUBYARG"]
end
else
puts "Building bootstrap Melbourne for Rubinius"
add_cflag "-g"
add_cxxflag "-g"
if ENV['DEV']
add_cflag "-O0"
add_cxxflag "-O0"
else
add_cflag "-O2"
add_cxxflag "-O2"
end
add_include_dir RbConfig::CONFIG["rubyhdrdir"]
end
end
add_objects project_files, ext_dir
# Build the Melbourne extension against Rubinius
directory "rbx"
melbourne_rbx = "rbx/melbourne20.#{$DLEXT}"
file melbourne_rbx => project_files
# Build the Melbourne extension against MRI
directory "build"
melbourne_build = "build/melbourne20.#{$DLEXT}"
file melbourne_build => project_files
graph_dependencies source_files, [], ext_dir
import dependency_file
# Build tasks
namespace :build do
desc "Build Melbourne for Rubinius"
task :rbx => melbourne_rbx
desc "Build bootstrap Melbourne"
task :build => melbourne_build
end
desc "Build Melbourne for both Rubinius and MRI"
task :build => %w[build:build build:rbx]
Jump to Line
Something went wrong with that request. Please try again.