Skip to content

Instantly share code, notes, and snippets.

@lgmkr
Created July 10, 2012 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgmkr/3082258 to your computer and use it in GitHub Desktop.
Save lgmkr/3082258 to your computer and use it in GitHub Desktop.
ruby 1.9.3-p194 with performance patches built into a .deb package with fpm
# AMI: ubuntu/images/ebs/ubuntu-precise-12.04-amd64-server-20120424 (ami-a29943cb)
#
# Part 1: Make a deb package of ruby:
# Get our deps
sudo apt-get install python-setuptools python-dev build-essential dpkg-dev libopenssl-ruby ruby1.8-dev rubygems bison autoconf zlib1g zlib1g-dev libreadline6 libreadline6-dev libssl0.9.8 libssl-dev
# Get ruby
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -zxvf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
# applied patches:
# 1. fix ruby-debug19
curl https://github.com/ruby/ruby/pull/47.diff | patch -p1
# 2. performance and backport gc (aka the falcon patch)
curl https://raw.github.com/gist/1859082/performance_and_backport_gc.patch | patch -p1
# 3. OPTIONAL: yaml.rb should not warn about using Syck instead of Pysch (libyaml). I don't parse a bajillion yaml documents, I don't need the awesome c speed of libyaml, however I do like &defaults more
curl https://raw.github.com/gist/2502451/46c9fbc07abf7ea5670ba0e23a11ff93d6e3c9db/yaml.rb.diff | patch -p1
# Install fpm
sudo gem install fpm
# Compile it to a tempory dir
time (./configure --prefix=/usr && make -j 8 && make install DESTDIR=/tmp/installdir)
# Package it
# Note: You should copy the .deb file to somewhere safe, I use s3.
fpm -s dir -t deb -n ruby -v 1.9.3-p194-perf -C /tmp/installdir \
-p ruby-VERSION_ARCH.deb -d "libstdc++6 (>= 4.4.3)" \
-d "libc6 (>= 2.6)" -d "libffi6 (>= 3.0.10)" -d "libgdbm3 (>= 1.8.3)" \
-d "libncurses5 (>= 5.7)" -d "libreadline6 (>= 6.1)" \
-d "libssl0.9.8 (>= 0.9.8)" -d "zlib1g (>= 1:1.2.2)" \
usr/bin usr/lib usr/share/man usr/include
# Part 2: Installing your deb package of ruby
#
# Love it, by Installing it on Ubuntu 12.04 LTS:
# Deps:
sudo apt-get install libffi6 libssl0.9.8
# Get the pre-package deb or yours
wget https://s3.amazonaws.com/dev.ops/ruby-1.9.3-p194-perf_without_psych_no_warnings_amd64.deb
# Add this to your ~/.bashrc
LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 export LC_CTYPE LANG
# Install it!
sudo dpkg -i ruby-1.9.3-p194-perf_without_psych_no_warnings_amd64.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment