Skip to content

Instantly share code, notes, and snippets.

@senid231
Forked from barcus/ruby-pkg.sh
Created July 18, 2018 12:04
Show Gist options
  • Save senid231/74407789abc198d9b1a6ad98160c2b24 to your computer and use it in GitHub Desktop.
Save senid231/74407789abc198d9b1a6ad98160c2b24 to your computer and use it in GitHub Desktop.
Building Ruby package for Debian Wheezy
#!/usr/bin/env bash
#VERSION='2.0.0-p353'
VERSION='2.1.0'
PKGNAME='ruby2.1'
CONFIGURE_OPTS='--disable-install-rdoc'
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 ruby-${VERSION}.tar.gz ]; then
wget http://ftp.ruby-lang.org/pub/ruby/ruby-${VERSION}.tar.gz \
-O ruby-${VERSION}.tar.gz
fi
tar -zxvf ruby-${VERSION}.tar.gz
cd ruby-${VERSION}
jobs=$(grep core /proc/cpuinfo | wc -l)
if [ "${jobs}" -eq 0 ]; then
jobs=$(grep processor /proc/cpuinfo | wc -l)
fi
rm -rf /tmp/ruby-${VERSION}
time( ./configure --prefix=/usr && make -j ${jobs} && make install DESTDIR="/tmp/ruby-${VERSION}" )
fpm -s dir -t deb -n ${PKGNAME} -v ${VERSION} -C /tmp/ruby-${VERSION} \
-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 "libssl1.0.0 (>= 1.0.0)" -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