lib/rconf/configurators/ruby_configurator.rb in rconf-1.0.6 vs lib/rconf/configurators/ruby_configurator.rb in rconf-1.0.7
- old
+ new
@@ -141,25 +141,31 @@
# true:: Always return true
def install_ruby_darwin(ruby)
Platform.dispatch(ruby) { :install_ruby_prerequisites }
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 = {}
+
+ # Ensure we're using a sane GCC 4.2, not Apple's LLVM-based lookalike.
gcc42 = ['/usr/local/bin/gcc-4.2', '/usr/bin/gcc-4.2'].detect { |p| File.executable?(p) }
if c_version =~ /^4\.2\.[0-9]+/
- if !gcc42
+ if gcc42.nil?
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'] = gcc42
end
end
+
+ # Ruby 1.8 force-installs the Tk stdlib extension, no way to opt out.
+ # Ensure XQuartz is installed and its headers are on the path.
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