Skip to content

Instantly share code, notes, and snippets.

@bmarini
Created November 25, 2008 04:32
Show Gist options
  • Save bmarini/28784 to your computer and use it in GitHub Desktop.
Save bmarini/28784 to your computer and use it in GitHub Desktop.
#/bin/bash
# Builds a gc patched ruby according to:
# http://guides.rubyonrails.org/benchmarking_and_profiling.html#_performance_test_cases
mkdir ${HOME}/rubygc
mkdir -p ${HOME}/src
# 1. Compile
echo "-- compiling ruby from source with gc patch --"
cd ${HOME}/src
curl -OL ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz
tar -xzvf ruby-1.8.6-p111.tar.gz
cd ruby-1.8.6-p111
curl http://rubyforge.org/tracker/download.php/1814/7062/17676/3291/ruby186gc.patch | patch -p0
./configure --prefix=${HOME}/rubygc
make && make install
# 2. Prepare aliases
echo "-- appending aliases to the end of your .bash_login file --"
BASH_LOGIN="${HOME}/.bash_login"
echo "alias gcruby='${HOME}/rubygc/bin/ruby'" >> ${BASH_LOGIN}
echo "alias gcrake='${HOME}/rubygc/bin/rake'" >> ${BASH_LOGIN}
echo "alias gcgem='${HOME}/rubygc/bin/gem'" >> ${BASH_LOGIN}
echo "alias gcirb='${HOME}/rubygc/bin/irb'" >> ${BASH_LOGIN}
echo "alias gcrails='${HOME}/rubygc/bin/rails'" >> ${BASH_LOGIN}
# 3. Install rubygems and some basic gems
echo "-- installing rubygems and rails gem with dependencies --"
cd ${HOME}/src
curl -OL http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar -xzvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
${HOME}/rubygc/bin/ruby setup.rb
${HOME}/rubygc/bin/gem install rails
# 4. Install MySQL gem
echo "-- installing mysql gem --"
if ${HOME}/rubygc/bin/gem install mysql; then
echo "mysql gem successfully installed"
else
cd ${HOME}/rubygc/lib/ruby/gems/1.8/gems/mysql-2.7
${HOME}/rubygc/bin/ruby extconf.rb --with-mysql-config
make && make install
fi
# 5. Installing Jeremy Kemper's ruby-prof
echo "-- installing jeremy kemper's ruby prof --"
cd ${HOME}/src
git clone git://github.com/jeremy/ruby-prof.git
cd ruby-prof
${HOME}/rubygc/bin/rake gem
${HOME}/rubygc/bin/gem install pkg/ruby-prof-0.6.1.gem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment