Skip to content

Instantly share code, notes, and snippets.

@bdossantos
Created November 27, 2013 11:43
Show Gist options
  • Save bdossantos/7674374 to your computer and use it in GitHub Desktop.
Save bdossantos/7674374 to your computer and use it in GitHub Desktop.
ruby_pkg.sh
#!/usr/bin/env bash
version='2.0.0'
patch='p247'
apt-get install ruby rubygems -y
gem install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g \
zlib1g-dev libssl-dev ncurses-dev libyaml-dev -y
if [ ! -f ${version}-${patch}.tar.gz ]; then
wget http://ftp.ruby-lang.org/pub/ruby/ruby-${version}-${patch}.tar.gz \
-O ${version}-${patch}.tar.gz
fi
if [ ! -d ${version}-{$patch} ]; then
tar -zxvf ${version}-${patch}.tar.gz
fi
cd ruby-${version}-${patch}
rm -rf /tmp/ruby-${version}-${patch}
jobs=$(grep core /proc/cpuinfo | wc -l)
if [ "${jobs}" -eq 0 ]; then
jobs=$(grep processor /proc/cpuinfo | wc -l)
fi
time( ./configure --prefix=/usr && make -j ${jobs} && make install DESTDIR="/tmp/${version}-${patch}" )
fpm -s dir -t deb -n ruby-$version-${patch} -v ${version}-${patch} -C /tmp/${version}-${patch} \
-p ruby-VERSION_ARCH.deb --url "https://www.ruby-lang.org" \
--description "Ruby is a dynamic, reflective, object-oriented, general-purpose programming language." \
--vendor "[email protected]" --license "Licence Ruby and GNU GPL" -m "https://www.ruby-lang.org" \
-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 remove ruby rubygems
#apt-get install libffi5 libyaml-0-2
#dpkg -i ruby193-p125_i386.deb
#ruby -ropenssl -rzlib -rreadline -ryaml -e "puts :success"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment