Skip to content

Instantly share code, notes, and snippets.

@johnbintz
Last active October 6, 2015 08:28
Show Gist options
  • Save johnbintz/2965472 to your computer and use it in GitHub Desktop.
Save johnbintz/2965472 to your computer and use it in GitHub Desktop.
ruby 1.9.3-p327 with performance patches built into a .deb package with fpm
# For Debian Squeeze + Backports + OpenSSL 1.0.0
# Part 1: Make a deb package of ruby:
# Get our deps
sudo su -c "echo deb http://backports.debian.org/debian-backports squeeze-backports main > /etc/apt/sources.list.d/squeeze-backports.list"
sudo apt-get update
sudo apt-get install -y python-setuptools python-dev build-essential dpkg-dev libopenssl-ruby ruby1.8-dev rubygems bison autoconf zlib1g zlib1g-dev libreadline6 libreadline6-dev libssl1.0.0 libssl-dev
# Get ruby
if [ ! -f ruby-1.9.3-p327.tar.gz ]; then
curl -O ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
fi
rm -Rf ruby-1.9.3-p327
tar zxvf ruby-1.9.3-p327.tar.gz
cd ruby-1.9.3-p327
# applied patches:
# 1. performance and backport gc (aka the falcon patch)
curl https://raw.github.com/gist/3721562/07-backport-gc.diff | patch -p1
# 2. 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 --no-ri --no-rdoc
# Compile it to a tempory dir
time (make clean ; make distclean ;./configure --prefix=/usr --disable-install-doc && make -j 8 && make install DESTDIR=/tmp/installdir)
rm -Rf *.deb
# everything we run is run through bundler
/tmp/installdir/usr/bin/gem install bundler -i /tmp/installdir/usr/lib/ruby/gems/1.9.1 -n /tmp/installdir/usr/bin --no-ri --no-rdoc
# Package it
# Note: You should copy the .deb file to somewhere safe, I use the Internet.
# This also totally takes over ruby18 and anything that Debian considers to be "ruby". You have been warned.
fpm -s dir -t deb -n ruby -v 10.0-1.9.3.327-perf+backports -C /tmp/installdir \
-p ruby-VERSION_ARCH.deb -d "libstdc++6 (>= 4.4.3)" \
-d "libc6 (>= 2.6)" -d "libffi5 (>= 3.0.9)" -d "libgdbm3 (>= 1.8.3)" \
-d "libncurses5 (>= 5.7)" -d "libreadline6 (>= 6.1)" \
-d "libssl1.0.0 (>= 1.0.0)" -d "zlib1g (>= 1:1.2.2)" \
--replaces ruby --replaces ruby18 --replaces ri --replaces rdoc --replaces libruby \
usr/bin usr/lib usr/share/man usr/include
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment