Permalink
Browse files

Reworked compiling C extensions.

  • Loading branch information...
1 parent 68de861 commit 9ed0630d33746188f77f8479bd7a28232b88b922 Brian Ford committed Nov 10, 2009
View
2 Rakefile
@@ -75,7 +75,7 @@ task :clean => %w[
vm:clean
kernel:clean
clean:crap
- extension:clean
+ extensions:clean
configure:clean
]
View
13 lib/ext/bigdecimal/Rakefile
@@ -0,0 +1,13 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+add_define "BASE=10000UL", "BASE_FIG=4"
+
+bigdecimal = "bigdecimal.#{$DLEXT}"
+
+file bigdecimal => project_files
+
+desc "Build Bigdecimal extension"
+task :build => bigdecimal
View
6 lib/ext/bigdecimal/build.rb
@@ -1,6 +0,0 @@
-extension do |e|
- e.name 'bigdecimal'
- e.files '*.c'
- e.includes '.'
- e.flags '-DBASE=10000UL -DBASE_FIG=4'
-end
View
13 lib/ext/digest/Rakefile
@@ -0,0 +1,13 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+add_shared_lib "crypto"
+
+digest = "digest.#{$DLEXT}"
+
+file digest => project_files
+
+desc "Build Digest extension"
+task :build => digest
View
14 lib/ext/digest/bubblebabble/Rakefile
@@ -0,0 +1,14 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+add_include_dir ".."
+add_shared_lib "crypto"
+
+bubblebabble = "bubblebabble.#{$DLEXT}"
+
+file bubblebabble => project_files
+
+desc "Build Digest/bubblebabble extension"
+task :build => bubblebabble
View
5 lib/ext/digest/bubblebabble/build.rb
@@ -1,5 +0,0 @@
-extension do |e|
- e.name 'bubblebabble'
- e.files '*.c'
- e.includes '.', '..'
-end
View
6 lib/ext/digest/build.rb
@@ -1,6 +0,0 @@
-extension do |e|
- e.name 'digest'
- e.files '*.c'
- e.includes '.'
- e.libs 'crypto'
-end
View
14 lib/ext/digest/md5/Rakefile
@@ -0,0 +1,14 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+add_include_dir ".."
+add_shared_lib "crypto"
+
+md5 = "md5.#{$DLEXT}"
+
+file md5 => project_files
+
+desc "Build Digest/md5 extension"
+task :build => md5
View
6 lib/ext/digest/md5/build.rb
@@ -1,6 +0,0 @@
-extension do |e|
- e.name 'md5'
- e.files '*.c'
- e.includes '.', '..'
- e.libs 'crypto'
-end
View
14 lib/ext/digest/rmd160/Rakefile
@@ -0,0 +1,14 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+add_include_dir ".."
+add_shared_lib "crypto"
+
+rmd160 = "rmd160.#{$DLEXT}"
+
+file rmd160 => project_files
+
+desc "Build Digest/rmd160 extension"
+task :build => rmd160
View
6 lib/ext/digest/rmd160/build.rb
@@ -1,6 +0,0 @@
-extension do |e|
- e.name 'rmd160'
- e.files '*.c'
- e.includes '.', '..'
- e.libs 'crypto'
-end
View
14 lib/ext/digest/sha1/Rakefile
@@ -0,0 +1,14 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+add_include_dir ".."
+add_shared_lib "crypto"
+
+sha1 = "sha1.#{$DLEXT}"
+
+file sha1 => project_files
+
+desc "Build Digest/sha1 extension"
+task :build => sha1
View
6 lib/ext/digest/sha1/build.rb
@@ -1,6 +0,0 @@
-extension do |e|
- e.name 'sha1'
- e.files '*.c'
- e.includes '.', '..'
- e.libs 'crypto'
-end
View
14 lib/ext/digest/sha2/Rakefile
@@ -0,0 +1,14 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+add_include_dir ".."
+add_shared_lib "crypto"
+
+sha2 = "sha2.#{$DLEXT}"
+
+file sha2 => project_files
+
+desc "Build Digest/sha2 extension"
+task :build => sha2
View
6 lib/ext/digest/sha2/build.rb
@@ -1,6 +0,0 @@
-extension do |e|
- e.name 'sha2'
- e.files '*.c'
- e.includes '.', '..'
- e.libs 'crypto'
-end
View
47 lib/ext/melbourne/Rakefile
@@ -0,0 +1,47 @@
+# Setup project files
+project_files = common_headers + headers + sources("grammar.cpp") + objects
+
+add_include_dir "#{$ELIBSDIR}/libbstring",
+ "#{$ELIBSDIR}/libmquark",
+ "#{$ELIBSDIR}/libptr_array",
+ "#{$ELIBSDIR}/libcchash"
+
+add_external_lib "mquark", "bstring", "ptr_array", "cchash"
+
+task :clean do
+ rm_f FileList["./**/*.o"], :verbose => $verbose
+end
+
+# Build the Melbourne extension against Rubinius
+directory "rbx"
+melbourne_rbx = "rbx/melbourne.#{$DLEXT}"
+
+# Build the Melbourne extension against MRI
+directory "ruby"
+melbourne_mri = "ruby/melbourne.#{$DLEXT}"
+
+# Build tasks
+namespace :build do
+ task :pre_rbx do
+ puts "Building Melbourne for Rubinius"
+ add_rbx_capi
+ end
+
+ desc "Build Melbourne for Rubinius"
+ task :rbx => melbourne_rbx
+
+ task :pre_mri do
+ puts "Building Melbourne for MRI"
+ add_mri_capi
+ end
+
+ desc "Build Melbourne for MRI"
+ task :mri => melbourne_mri
+end
+
+file melbourne_rbx => %w[build:pre_rbx clean rbx] + project_files
+
+file melbourne_mri => %w[build:pre_mri clean ruby] + project_files
+
+desc "Build Melbourne for both Rubinius and MRI"
+task :build => %w[build:mri build:rbx]
View
14 lib/ext/melbourne/build.rb
@@ -1,14 +0,0 @@
-extension do |e|
- e.name 'rbx/melbourne'
- e.files '*.c', '*.cpp'
- e.includes '.', '../../../vm/external_libs/libbstring',
- '../../../vm/external_libs/libmquark',
- '../../../vm/external_libs/libptr_array',
- '../../../vm/external_libs/libcchash'
-
- e.pre_compile do
- if File.mtime("grammar.y") > File.mtime("grammar.cpp")
- system "bison -o grammar.cpp grammar.y"
- end
- end
-end
View
20 lib/ext/readline/Rakefile
@@ -0,0 +1,20 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+if ENV["READLINE_DIR"]
+ add_include_dir ENV["READLINE_DIR"]
+ add_link_dir "#{ENV["READLINE_DIR"]}/lib"
+else
+ add_include_dir "/usr/include"
+end
+
+add_shared_lib "readline", "ncurses"
+
+readline = "readline.#{$DLEXT}"
+
+file readline => project_files
+
+desc "Build Readline extension"
+task :build => readline
View
8 lib/ext/readline/build.rb
@@ -1,8 +0,0 @@
-extension do |e|
- e.name 'readline'
- e.files '*.c'
- e.includes '.', '..', (ENV['READLINE_DIR'] ? "#{ENV['READLINE_DIR']}/include" : '/usr/include')
- e.libs 'readline', 'ncurses'
- e.flags "-L#{ENV['READLINE_DIR']}/lib" if ENV['READLINE_DIR']
-end
-
View
11 lib/ext/syck/Rakefile
@@ -0,0 +1,11 @@
+# Setup project files
+project_files = common_headers + headers + sources + objects
+
+add_rbx_capi
+
+syck = "syck.#{$DLEXT}"
+
+file syck => project_files
+
+desc "Build Syck extension"
+task :build => syck
View
5 lib/ext/syck/build.rb
@@ -1,5 +0,0 @@
-extension do |e|
- e.name 'syck'
- e.files '*.c'
- e.includes '.'
-end
View
219 rakelib/ext_helper.rb
@@ -0,0 +1,219 @@
+require "rbconfig"
+
+$verbose = Rake.application.options.trace || ARGV.delete("-v")
+
+# Common settings. These can be augmented or overridden
+# by the particular extension Rakefile.
+#
+DEFAULT = Config::CONFIG
+
+# Don't like the globals? Too bad, they are simple and the
+# duration of this process is supposed to be short.
+
+$CC = ENV["CC"] || "gcc"
+$CXX = ENV["CXX"] || "g++"
+$LDSHARED = ENV["LDSHARED"] || $CXX
+$YACC = ENV["YACC"] || "bison"
+
+$CFLAGS = ENV["CFLAGS"] || ""
+$CXXFLAGS = ENV["CXXFLAGS"] || ""
+
+$ELIBSDIR = ENV["ELIBSDIR"] || File.expand_path("../../vm/external_libs", __FILE__)
+$LIBS = ENV["LIBS"] || ""
+$LDDIRS = ENV["LDDIRS"] || ""
+$LDFLAGS = ENV["LDFLAGS"] || ""
+
+$DLEXT = ENV["DLEXT"] || DEFAULT["DLEXT"]
+$LIBEXT = ENV["LIBEXT"] || DEFAULT["LIBEXT"]
+
+# Helper methods for manipulating constants
+#
+def add_define(*defines)
+ defines.each do |d|
+ define = "-D#{d}"
+ add_cflag define
+ add_cxxflag define
+ end
+end
+
+def add_include_dir(*dirs)
+ dirs.each do |f|
+ incl = "-I#{f}"
+ add_cflag incl
+ add_cxxflag incl
+ end
+end
+
+def add_cflag(*flags)
+ flags.each { |f| $CFLAGS << " #{f}" }
+end
+
+def add_cxxflag(*flags)
+ flags.each { |f| $CXXFLAGS << " #{f}" }
+end
+
+def add_ldflag(*flags)
+ flags.each { |f| $LDFLAGS << " #{f}" }
+end
+
+def add_link_dir(*dirs)
+ dirs.each { |d| $LDDIRS << " -L#{d}" }
+end
+
+def add_lib(*libs)
+ libs.each { |l| $LIBS << " lib#{l}.#{$LIBEXT}" }
+end
+
+def add_shared_lib(*libs)
+ libs.each { |l| $LIBS << " -l#{l}" }
+end
+
+def add_external_lib(*libs)
+ libs.each { |l| $LIBS << " #{$ELIBSDIR}/lib#{l}/lib#{l}.#{$LIBEXT}" }
+end
+
+def add_mri_capi
+ add_cflag DEFAULT["DEFS"]
+ add_cflag DEFAULT["CFLAGS"]
+
+ add_cxxflag DEFAULT["DEFS"]
+ add_cxxflag DEFAULT["CFLAGS"]
+
+ $LIBS << " #{DEFAULT["LIBS"]}"
+ $LIBS << " #{DEFAULT["DLDLIBS"]}"
+
+ add_ldflag DEFAULT["LDSHARED"].split[1..-1].join(' ')
+ add_ldflag DEFAULT["LDFLAGS"]
+ add_include_dir DEFAULT["archdir"]
+end
+
+def add_rbx_capi
+ add_include_dir File.expand_path("../../vm/capi", __FILE__)
+end
+
+# Setup some initial computed values
+#
+add_include_dir "."
+add_link_dir "."
+
+# Setup platform-specific values
+#
+# (Adapted from EventMachine. Thank you EventMachine and tmm1 !)
+#
+case RUBY_PLATFORM
+when /mswin32/, /mingw32/, /bccwin32/
+ # TODO: discovery helpers
+ #check_heads(%w[windows.h winsock.h], true)
+ #check_libs(%w[kernel32 rpcrt4 gdi32], true)
+
+ if GNU_CHAIN
+ $LDSHARED = "#{$CXX} -shared -lstdc++"
+ else
+ add_define "-EHs", "-GR"
+ end
+
+when /solaris/
+ add_define "OS_SOLARIS8"
+
+ if $CC == "cc" and `cc -flags 2>&1` =~ /Sun/ # detect SUNWspro compiler
+ # SUN CHAIN
+ add_define "CC_SUNWspro", "-KPIC"
+ $CXX = $CC
+ $LDSHARED = "#{$CXX} -G -KPIC -lCstd"
+ else
+ # GNU CHAIN
+ # on Unix we need a g++ link, not gcc.
+ $LDSHARED = "#{$CXX} -shared"
+ end
+
+when /openbsd/
+ # OpenBSD branch contributed by Guillaume Sellier.
+
+ # on Unix we need a g++ link, not gcc. On OpenBSD, linking against
+ # libstdc++ have to be explicitly done for shared libs
+ $LDSHARED = "#{$CXX} -shared -lstdc++ -fPIC"
+
+when /darwin/
+ # on Unix we need a g++ link, not gcc.
+ # Ff line contributed by Daniel Harple.
+ $LDSHARED = "#{$CXX} -dynamic -bundle -undefined suppress -flat_namespace"
+
+when /aix/
+ $LDSHARED = "#{$CXX} -shared -Wl,-G -Wl,-brtl"
+
+else
+ # on Unix we need a g++ link, not gcc.
+ $LDSHARED = "#{$CXX} -shared"
+end
+
+# To quiet MRI's warnings about ivars being uninitialized.
+# Doesn't need to be a method, but it's nicely encapsulated.
+def init
+ @common_headers = nil
+ @headers = nil
+ @sources = nil
+ @objects = nil
+ @noise_maker = nil
+end
+
+init
+
+# Helper methods to collect the project files according to category
+#
+def common_headers(*extra)
+ @common_headers ||= FileList[
+ File.expand_path("../../vm/capi/*.h", __FILE__),
+ *extra
+ ].existing
+end
+
+def headers(*extra)
+ @headers ||= FileList["*.{h,hpp}", *extra].existing
+end
+
+def sources(*extra)
+ @sources ||= FileList["*.{c,cpp}", *extra].uniq
+end
+
+def objects(*extra)
+ @objects ||= sources.ext(".o")
+end
+
+# Helper methods for invoking and reporting on commands
+#
+def report_command(notice)
+ puts notice unless $verbose
+end
+
+# Quiet the eff up already. Rakes barfing sh is maddening
+#
+def qsh(cmd)
+ cmd << " > /dev/null 2>&1" unless $verbose
+ puts cmd if $verbose
+ unless result = rake_system(cmd)
+ fail "Command failed with status (#{$?.exitstatus}): [#{cmd}]"
+ end
+ result
+end
+
+# Rules for building all files
+#
+rule ".cpp" => ".y" do |t|
+ report_command "YACC #{t.source}"
+ qsh "#{$YACC} -o #{t.name} #{t.source}"
+end
+
+rule ".o" => ".c" do |t|
+ report_command "CC #{t.source}"
+ qsh "#{$CC} -c -o #{t.name} #{$CFLAGS} #{t.source}"
+end
+
+rule ".o" => ".cpp" do |t|
+ report_command "CXX #{t.source}"
+ qsh "#{$CXX} -c -o #{t.name} #{$CXXFLAGS} #{t.source}"
+end
+
+rule ".#{$DLEXT}" do |t|
+ report_command "LDSHARED #{t.name}"
+ qsh "#{$LDSHARED} #{objects} #{$LDFLAGS} #{$LDDIRS} #{$LIBS} -o #{t.name}"
+end
View
188 rakelib/extensions.rake
@@ -1,160 +1,62 @@
-desc "Build extensions from lib/ext"
-task :extensions => %w[
- extension:melbourne
- extension:readline
- extension:digest
- extension:bigdecimal
- extension:syck
-]
-
-# lib/etc.rb
-# lib/fcntl.rb
-# lib/openssl/digest.rb
-# lib/syslog.rb
-# lib/zlib.rb
-
+# Tasks for building C extensions used mainly by Rubinius, but also by MRI in
+# the case of the Melbourne parser extension. The task names are defined to
+# permit running the tasks directly, eg
#
-# Ask the VM to build an extension from source.
+# rake compile:melbourne_rbx
#
-def compile_extension(path, flags = "-p -I#{Dir.pwd}/vm/capi")
- cflags = BASIC_FLAGS.reject {|f| f =~ /-Wno-deprecated|-Weffc\+\+/ }
-
- cflags.each {|flag| flags << " -C,#{flag}" }
-
- # @todo: this is a hack because the change from FLAGS above to
- # BASIC_FLAGS means the debug flags don't come through. this
- # all needs to be sorted out with a build system rewrite.
- flags << " -C,-ggdb3"
-
- verbose = $verbose ? "-d" : ""
+# See rakelib/ext_helper.rb for the helper methods and Rake rules.
- #command = "./bin/rbx compile #{verbose} #{flags} #{path}"
-
- puts "Building extension #{path}"
- ruby "lib/bin/compile.rb #{verbose} #{flags} #{path}"
-end
-
-namespace :extension do
+desc "Build extensions from lib/ext"
+task :extensions
- desc "Cleans all C extension libraries and build products."
+namespace :extensions do
+ desc "Clean all lib/ext files"
task :clean do
- Dir["lib/ext/**/*.{o,#{$dlext}}"].each do |f|
- rm_f f, :verbose => $verbose
- end
- end
-
- desc "Build the bigdecimal extension"
- task :bigdecimal => %W[kernel:build lib/ext/bigdecimal/bigdecimal.#{$dlext}]
- file "lib/ext/bigdecimal/bigdecimal.#{$dlext}" => FileList[
- "lib/ext/bigdecimal/build.rb",
- "lib/ext/bigdecimal/bigdecimal.c",
- "lib/ext/bigdecimal/bigdecimal.h",
- "vm/capi/ruby.h"
- ] do
- compile_extension 'lib/ext/bigdecimal'
+ rm_f FileList["lib/ext/**/*.{o,#{$dlext}}"], :verbose => $verbose
end
+end
- desc "Build the readline extension"
- task :readline => %W[kernel:build lib/ext/readline/readline.#{$dlext}]
+def compile_ext(name, opts={})
+ names = name.split ":"
+ name = names.last
+ ext_dir = File.join "lib/ext", names
- file "lib/ext/readline/readline.#{$dlext}" => FileList[
- "lib/ext/readline/build.rb",
- "lib/ext/readline/readline.c",
- "vm/capi/ruby.h"
- ] do
- compile_extension 'lib/ext/readline'
+ if t = opts[:task]
+ task_name = "build:#{t}"
+ else
+ task_name = "build"
end
- desc "Build the Digest extensions"
- task :digest => %w[extension:digest:digest
- extension:digest:md5
- extension:digest:rmd160
- extension:digest:sha1
- extension:digest:sha2
- extension:digest:bubblebabble]
-
- namespace :digest do
- def digest_task name
- desc "Build Digest's #{name} extension."
- task name => %W[kernel:build lib/ext/digest/#{name}/#{name}.#{$dlext}]
- file "lib/ext/digest/#{name}/#{name}.#{$dlext}" =>
- FileList["lib/ext/digest/#{name}/build.rb",
- "lib/ext/digest/#{name}/{#{name},#{name}init}.c",
- "lib/ext/digest/#{name}/#{name}.h",
- "lib/ext/digest/defs.h",
- "vm/capi/ruby.h"
- ] do
- compile_extension "lib/ext/digest/#{name}"
- end
- end
-
- desc "Build Digest extension."
- task :digest => %W[kernel:build lib/ext/digest/digest.#{$dlext}]
- file "lib/ext/digest/digest.#{$dlext}" =>
- FileList["lib/ext/digest/build.rb",
- "lib/ext/digest/digest.c",
- "lib/ext/digest/digest.h",
- "lib/ext/digest/defs.h",
- "vm/capi/ruby.h"
- ] do
- compile_extension "lib/ext/digest"
- end
-
- digest_task "md5"
- digest_task "rmd160"
- digest_task "sha1"
- digest_task "sha2"
- digest_task "bubblebabble"
+ if dir = opts[:dir]
+ target_dir = File.join ext_dir, dir
+ else
+ target_dir = ext_dir
end
- desc "Build the syck extension"
- task :syck => %W[kernel:build lib/ext/syck/syck.#{$dlext}]
- file "lib/ext/syck/syck.#{$dlext}" => FileList[
- "lib/ext/syck/build.rb",
- "lib/ext/syck/bytecode.c",
- "lib/ext/syck/emitter.c",
- "lib/ext/syck/gram.c",
- "lib/ext/syck/gram.h",
- "lib/ext/syck/handler.c",
- "lib/ext/syck/implicit.c",
- "lib/ext/syck/node.c",
- "lib/ext/syck/rubyext.c",
- "lib/ext/syck/syck.h",
- "lib/ext/syck/syck.c",
- "lib/ext/syck/token.c",
- "lib/ext/syck/yaml2byte.c",
- "lib/ext/syck/yamlbyte.h",
- "lib/ext/syck/st.h",
- "lib/ext/syck/st.c",
- "vm/capi/ruby.h"
- ] do
- compile_extension 'lib/ext/syck'
+ target = "#{target_dir}/#{name}.#{$dlext}"
+ file target do
+ ext_helper = File.expand_path "../ext_helper.rb", __FILE__
+ Dir.chdir ext_dir do
+ ruby "-S rake #{'-t' if $verbose} -r #{ext_helper} #{task_name}"
+ end
end
- directory "lib/ext/melbourne/rbx"
+ Rake::Task[:extensions].prerequisites << target
- desc "Build the melbourne extension"
- task :melbourne => %W[kernel:build lib/ext/melbourne/rbx/melbourne.#{$dlext}]
- file "lib/ext/melbourne/rbx/melbourne.#{$dlext}" => FileList[
- "lib/ext/melbourne/rbx",
- "lib/ext/melbourne/build.rb",
- "lib/ext/melbourne/grammar.y",
- "lib/ext/melbourne/grammar.hpp",
- "lib/ext/melbourne/grammar.cpp",
- "lib/ext/melbourne/internal.hpp",
- "lib/ext/melbourne/melbourne.cpp",
- "lib/ext/melbourne/node.hpp",
- "lib/ext/melbourne/visitor.hpp",
- "lib/ext/melbourne/visitor.cpp",
- "lib/ext/melbourne/local_state.hpp",
- "lib/ext/melbourne/node_types.hpp",
- "lib/ext/melbourne/node_types.cpp",
- "lib/ext/melbourne/symbols.hpp",
- "lib/ext/melbourne/symbols.cpp",
- "lib/ext/melbourne/var_table.hpp",
- "lib/ext/melbourne/var_table.cpp",
- "vm/capi/ruby.h"
- ] do
- compile_extension "lib/ext/melbourne"
+ namespace :extensions do
+ desc "Build #{name.capitalize} extension #{opts[:doc]}"
+ task task_name => target
end
end
+
+compile_ext "bigdecimal"
+compile_ext "readline"
+compile_ext "digest"
+compile_ext "digest:md5"
+compile_ext "digest:rmd160"
+compile_ext "digest:sha1"
+compile_ext "digest:sha2"
+compile_ext "digest:bubblebabble"
+compile_ext "syck"
+compile_ext "melbourne", :task => "rbx", :dir => "rbx", :doc => "for Rubinius"
+compile_ext "melbourne", :task => "mri", :dir => "ruby", :doc => "for MRI"
View
47 rakelib/kernel.rake
@@ -65,51 +65,7 @@ FileList[ "lib/compiler.rb",
end
namespace :compiler do
- directory(mri_ext_dir = "lib/ext/melbourne/ruby")
-
- mri_ext = "lib/ext/melbourne/ruby/melbourne.#{$dlext}"
- task :build => mri_ext
- file mri_ext => FileList[
- mri_ext_dir,
- "lib/ext/melbourne/extconf.rb",
- "lib/ext/melbourne/grammar.y",
- "lib/ext/melbourne/grammar.hpp",
- "lib/ext/melbourne/grammar.cpp",
- "lib/ext/melbourne/internal.hpp",
- "lib/ext/melbourne/melbourne.cpp",
- "lib/ext/melbourne/node.hpp",
- "lib/ext/melbourne/visitor.hpp",
- "lib/ext/melbourne/visitor.cpp",
- "lib/ext/melbourne/local_state.hpp",
- "lib/ext/melbourne/node_types.hpp",
- "lib/ext/melbourne/node_types.cpp",
- "lib/ext/melbourne/symbols.hpp",
- "lib/ext/melbourne/symbols.cpp",
- "lib/ext/melbourne/var_table.hpp",
- "lib/ext/melbourne/var_table.cpp",
- ] do
- Dir.chdir "lib/ext/melbourne" do
- puts "Building melbourne for MRI"
- redirect = $verbose ? "" : " > /dev/null 2>&1"
-
- libs = File.expand_path "../../vm/external_libs", __FILE__
- ruby "extconf.rb --with-bstring-include=#{libs}/libbstring" \
- " --with-mquark-include=#{libs}/libmquark" \
- " --with-ptr-array-include=#{libs}/libptr_array" \
- " --with-cchash-include=#{libs}/libcchash" \
- " --with-bstring-lib=#{libs}/libbstring" \
- " --with-mquark-lib=#{libs}/libmquark" \
- " --with-ptr_array-lib=#{libs}/libptr_array" \
- " --with-cchash-lib=#{libs}/libcchash" \
- " #{redirect}"
-
- sh "make clean #{redirect}"
- sh "make #{redirect}"
- mv "melbourne.#{$dlext}", "ruby", :verbose => $verbose
- end
- end
-
- task :load => [opcodes, :build] do
+ task :load => [opcodes, "lib/ext/melbourne/ruby/melbourne.#{$dlext}"] do
require File.expand_path("../../lib/compiler", __FILE__)
end
@@ -124,7 +80,6 @@ namespace :compiler do
kernel_clean if !kernel_mtime or compiler_mtime > kernel_mtime
end
end
-
end
desc "Build all kernel files"

0 comments on commit 9ed0630

Please sign in to comment.