|
| 1 | +# autodetect ruby headers |
| 2 | +unless ARGV.any? {|arg| arg.include?('--with-ruby-include') } |
| 3 | + require 'rbconfig' |
| 4 | + bindir = RbConfig::CONFIG['bindir'] |
| 5 | + if bindir =~ %r{(^.*/\.rbenv/versions)/([^/]+)/bin$} |
| 6 | + ruby_include = "#{$1}/#{$2}/include/ruby-1.9.1/ruby-#{$2}" |
| 7 | + ARGV << "--with-ruby-include=#{ruby_include}" |
| 8 | + elsif bindir =~ %r{(^.*/\.rvm/rubies)/([^/]+)/bin$} |
| 9 | + ruby_include = "#{$1}/#{$2}/include/ruby-1.9.1/#{$2}" |
| 10 | + ruby_include = "#{ENV['rvm_path']}/src/#{$2}" unless File.exist?(ruby_include) |
| 11 | + ARGV << "--with-ruby-include=#{ruby_include}" |
| 12 | + end |
| 13 | +end |
| 14 | + |
1 | 15 | require "mkmf"
|
2 |
| -require "ruby_core_source" |
| 16 | +require "debugger/ruby_core_source" |
3 | 17 |
|
4 | 18 | hdrs = proc {
|
5 | 19 | begin
|
|
24 | 38 | }
|
25 | 39 |
|
26 | 40 | dir_config("ruby")
|
27 |
| -name = "ruby_debug" |
28 |
| -if (ENV['rvm_ruby_string']) |
29 |
| - dest_dir = RbConfig::CONFIG["rubyhdrdir"] |
30 |
| - with_cppflags("-I" + dest_dir) { |
31 |
| - if hdrs.call |
32 |
| - create_makefile(name) |
33 |
| - exit 0 |
34 |
| - end |
35 |
| - } |
36 |
| -end |
37 |
| -if !Ruby_core_source::create_makefile_with_core(hdrs, name) |
| 41 | +if !Debugger::RubyCoreSource.create_makefile_with_core(hdrs, "ruby_debug") |
38 | 42 | STDERR.print("Makefile creation failed\n")
|
39 | 43 | STDERR.print("*************************************************************\n\n")
|
40 |
| - STDERR.print(" NOTE: For Ruby 1.9 installation instructions, please see:\n\n") |
41 |
| - STDERR.print(" http://wiki.github.com/mark-moseley/ruby-debug\n\n") |
| 44 | + STDERR.print(" NOTE: If your headers were not found, try passing\n") |
| 45 | + STDERR.print(" --with-ruby-include=PATH_TO_HEADERS \n\n") |
42 | 46 | STDERR.print("*************************************************************\n\n")
|
43 | 47 | exit(1)
|
44 | 48 | end
|
0 commit comments