lib/rconf/configurators/ruby_configurator.rb in rconf-1.0.0 vs lib/rconf/configurators/ruby_configurator.rb in rconf-1.0.1
- old
+ new
@@ -148,17 +148,26 @@
# === Return
# true:: Always return true
def install_ruby_darwin(ruby)
c_version = `system_profiler SPDeveloperToolsDataType -xml | xpath "//*[text()='_items']/following-sibling::array/dict/child::key[text()='spdevtools_version']/following-sibling::string/text()" 2> /dev/null`
env = {}
+ gcc42 = ['/usr/bin/gcc-4.2', '/usr/local/bin/gcc-4.2'].detect { |p| File.executable?(p) }
if c_version =~ /^4\.2\.[0-9]+/
- if !File.executable?('/usr/bin/gcc-4.2')
+ if !gcc42
report_fatal("The C compiler included with Xcode #{c_version} produces buggy ruby interpreters, please install the C compilers from https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg or update your version of Xcode and re-run rconf")
else
- env['CC'] = '/usr/bin/gcc-4.2'
+ env['CC'] = gcc42
end
end
+ if ruby =~ /1\.8/
+ if File.directory?('/opt/X11/include')
+ env['CC'] = gcc42
+ env['CPPFLAGS'] = '-I/opt/X11/include'
+ else
+ report_fatal("Installing ruby 1.8 (or ree 1.8) on Mac OS X requires that XQuartz be installed on the machine first, please go to http://xquartz.macosforge.org/landing/, install XQuartz and try again")
+ end
+ end
Command.execute('rbenv', 'install', ruby, :abort_on_failure => 'Failed to install ruby', :env => env)
report_success
end
# Make sure to install all required linux packages first
@@ -196,9 +205,15 @@
# No pre-requesites to install ree or Matz ruby on Mac (TBD others)
#
# === Return
# true:: Always return true
def install_ruby_prerequisites_darwin(ruby)
+ if ruby =~ /1\.8/
+ report_check("Detected ruby 1.8 install, making sure gcc 4.2 is available")
+ PackageInstaller.install('https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb', :abort_on_failure => "Could not install gcc 4.2")
+ report_success
+ end
+
true
end
# Produce abort on failure option