Skip to content

Instantly share code, notes, and snippets.

@jmervine
Forked from futuremill-ltd/gist:2318876
Created October 24, 2012 00:56
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 jmervine/3943059 to your computer and use it in GitHub Desktop.
Save jmervine/3943059 to your computer and use it in GitHub Desktop.
Building Ruby 1.9.3 package for Debian Squeeze
# From a fresh install of squeeze
test "$DEBUG" && set -x
set -ue
if test "$1"; then
SOURCE_VERSION="$1"
else
SOURCE_VERSION="1.9.3-p286"
fi
echo -n "Using ruby version: "
if ! test "$(echo $SOURCE_VERSION | sed '/^([0-9]{1})\.([0-9]{1})\.([0-9]{1})-p([0-9]+)$/g')"; then
echo " "
echo "$SOURCE_VERSION is not a valid ruby source version"
exit 1
fi
if ! which ruby; then
apt-get -y install ruby rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
fi
apt-get -y install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-$SOURCE_VERSION.tar.gz
tar -zxvf ruby-$SOURCE_VERSION.tar.gz
cd ruby-$SOURCE_VERSION
rm -rf /tmp/ruby_source
time (./configure --prefix=/usr && make && make install DESTDIR=/tmp/ruby_source)
/var/lib/gems/1.8/bin/fpm -s dir -t deb -n ruby_source -v $SOURCE_VERSION --description "Self-packaged Ruby $SOURCE_VERSION" -C /tmp/ruby_source \
-p ruby-$SOURCE_VERSION-VERSION_ARCH.deb -d "libstdc++6 (>= 4.4.3)" \
-d "libc6 (>= 2.6)" -d "libffi5 (>= 3.0.4)" -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)" \
-d "libyaml-0-2 (>= 0.1.3)" \
usr/bin usr/lib usr/share/man usr/include
# Post installation test
apt-get -y remove ruby rubygems
apt-get -y install libffi5 libyaml-0-2
dpkg -i ruby*.deb
ruby -ropenssl -rzlib -rreadline -ryaml -e "puts :success"
@jmervine
Copy link
Author

This is not tested. FYI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment