Updated MSpec source to 46e80081.
[rbx.git] / spec / subtend / subtend_helper.rb
blob1bad14cd85e58e6485cc4d8f58f0486928cbfc6e
1 # Compiles the extension used in the subtend specs
2 require 'rbconfig'
3 def compile_extension(name)
4   path = File.dirname(__FILE__) + '/ext/'
5   ext = "#{path}#{name}.#{Config::CONFIG['DLEXT']}"
6   ext_source = "#{path}#{name}.c"
7   if !File.exists?(ext) or File.mtime(ext) < File.mtime(ext_source)
8     if Object.constants.include? 'Rubinius'
9       system "./shotgun/rubinius compile #{ext_source} -g > /dev/null"
10     else
11       c = Config::CONFIG
12       system "#{c['LDSHARED']} -g #{ext_source} -I #{c['archdir']} #{c['SOLIBS']} #{c['LIBRUBYARG_SHARED']} -o #{ext} > /dev/null"
13     end
14   end
15 end