Skip to content

Instantly share code, notes, and snippets.

@bsstokes
Created November 27, 2012 19:47
Show Gist options
  • Save bsstokes/4156549 to your computer and use it in GitHub Desktop.
Save bsstokes/4156549 to your computer and use it in GitHub Desktop.
Build ruby-1.9.2-p180 patched with gcdata for rbenv
# Build ruby-1.9.2-p180 patched with gcdata for rbenv
# ===================================================
#
# This script will install a version of ruby-1.9.2-p180 for [rbenv][] that's
# patched with RVM's [gcdata][] patch.
#
# CAVEAT
# ------
#
# Keep in mind that this is for **ruby-1.9.2-p180**. Update the version numbers
# for whichever Ruby you're using. You'll also want to make sure the versions
# for the supporting libraries are correct, too. For guidance, take a look at
# the appropriate [ruby-build script][].
#
# [rbenv]: https://github.com/sstephenson/rbenv
# [gcdata]: https://raw.github.com/wayneeseguin/rvm/master/patches/ruby/1.9.2/p180/gcdata.patch
# [ruby-build script]: <https://github.com/sstephenson/ruby-build/blob/master/share/ruby-build/1.9.2-p180>
#
# THANKS
# ------
#
# Thanks to Nicolas Zermati for <http://www.synbioz.com/blog/2012/03/28/optimize_ruby_code>.
export DESTINATION=$HOME/.rbenv/versions/1.9.2-p180-gc
mkdir $DESTINATION
# Install lib yaml
cd /tmp
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure --prefix=$DESTINATION
make && make install
# Install a patched Ruby version
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
tar xzf ruby-1.9.2-p180.tar.gz
cd ruby-1.9.2-p180
curl https://raw.github.com/wayneeseguin/rvm/master/patches/ruby/1.9.2/p180/gcdata.patch | patch -p1
export CPPFLAGS=-I$DESTINATION/include
export LDFLAGS=-L$DESTINATION/lib
./configure --prefix=$DESTINATION --with-opt-dir=$DESTINATION/lib --enable-shared
make && make install
rbenv global 1.9.2-p180-gc
# Install RubyGems
cd /tmp
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.23.tgz
tar xzf rubygems-1.8.23.tgz
cd rubygems-1.8.23
ruby setup.rb
rbenv rehash
# Cleaning all sources and archives
rm -fr /tmp/yaml-0.1.4 /tmp/yaml-0.1.4.tar.gz /tmp/ruby-1.9.2-p180 /tmp/ruby-1.9.2-p180.tar.gz /tmp/rubygems-1.8.23.tgz /tmp/rubygems-1.8.23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment