Fix support for Ruby versions

This commit is contained in:
Kamil Trzciński 2021-02-01 14:20:08 +01:00
parent 0b0a3b745a
commit f0bf9d8f0c
4 changed files with 274 additions and 9 deletions

View file

@ -230,18 +230,25 @@ function print_pgbouncer_args() {
function print_ruby_args() {
case "$1" in
2.6.*)
2.6|2.6.*)
CUSTOM_IMAGE_NAME=debian
CUSTOM_IMAGE_VERSION=stretch
RUBY_VERSION="2.6.6"
RUBY_DOWNLOAD_SHA256="5db187882b7ac34016cd48d7032e197f07e4968f406b0690e20193b9b424841f"
RUBY_DOWNLOAD_SHA256="364b143def360bac1b74eb56ed60b1a0dca6439b00157ae11ff77d5cd2e92291"
;;
2.7.*)
2.7|2.7.*)
CUSTOM_IMAGE_NAME=debian
CUSTOM_IMAGE_VERSION=buster
RUBY_VERSION="2.7.2"
RUBY_DOWNLOAD_SHA256="1b95ab193cc8f5b5e59d2686cb3d5dcf1ddf2a86cb6950e0b4bdaae5040ec0d6"
RUBY_DOWNLOAD_SHA256="6e5706d0d4ee4e1e2f883db9d768586b4d06567debea353c796ec45e8321c3d4"
;;
3.0|3.0.*)
CUSTOM_IMAGE_NAME=debian
CUSTOM_IMAGE_VERSION=buster
RUBY_VERSION="3.0.0"
RUBY_DOWNLOAD_SHA256="a13ed141a1c18eb967aac1e33f4d6ad5f21be1ac543c344e0d6feeee54af8e28"
;;
*) echo "Unknown ruby version $1"; exit 1;

View file

@ -8,11 +8,11 @@ RUBY_VERSION=${1}
RUBY_MAJOR=${1%.*} # strip last component
RUBY_DOWNLOAD_SHA256=${2}
RUBY_DOWNLOAD_URL="https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz"
RUBY_DOWNLOAD_URL="https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.gz"
# Download Ruby
curl -fsSL "$RUBY_DOWNLOAD_URL" -o ruby.tar.xz
echo "${RUBY_DOWNLOAD_SHA256} ruby.tar.xz" | sha256sum -c -
curl -fsSL "$RUBY_DOWNLOAD_URL" -o ruby.tar.gz
echo "${RUBY_DOWNLOAD_SHA256} ruby.tar.gz" | sha256sum -c -
# Skip installing Gem docs
mkdir -p /usr/local/etc
@ -25,12 +25,12 @@ apt-get install -y --no-install-recommends bison dpkg-dev libgdbm-dev ruby
# Unpack Ruby
mkdir -p /usr/src/ruby
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1
tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1
rm ruby.tar.xz
cd /usr/src/ruby
# Apply patches
find /patches/ruby/$RUBY_VERSION -name '*.patch' -print0 | xargs -0 -n1 patch -p1 -i
find "/patches/ruby/$RUBY_VERSION" -name '*.patch' | xargs -rpn1 patch -p1 -i
./configure --enable-shared --disable-install-doc --disable-install-rdoc --disable-install-capi
make install -j $(nproc)