mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 10:02:56 +01:00
Apply thread allocations patch to Ruby 2.7
This makes us to compile Ruby 2.7 manually and apply relevant patch.
This commit is contained in:
parent
28db6ad94c
commit
d25cb10067
4 changed files with 78 additions and 26 deletions
|
|
@ -1,14 +1,50 @@
|
|||
#!/bin/bash
|
||||
set -xeuo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
cd /tmp
|
||||
wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
|
||||
tar -xvzf ruby-2.2.2.tar.gz
|
||||
set -xeou pipefail
|
||||
|
||||
cd ruby-2.2.2
|
||||
# Based on https://github.com/docker-library/ruby/blob/master/2.7/buster/Dockerfile
|
||||
|
||||
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"
|
||||
|
||||
# Download Ruby
|
||||
curl -fsSL "$RUBY_DOWNLOAD_URL" -o ruby.tar.xz
|
||||
echo "${RUBY_DOWNLOAD_SHA256} ruby.tar.xz" | sha256sum -c -
|
||||
|
||||
# Skip installing Gem docs
|
||||
mkdir -p /usr/local/etc
|
||||
echo 'install: --no-document' >> /usr/local/etc/gemrc
|
||||
echo 'update: --no-document' >> /usr/local/etc/gemrc
|
||||
|
||||
# Install needed packages
|
||||
apt-get update
|
||||
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
|
||||
rm ruby.tar.xz
|
||||
cd /usr/src/ruby
|
||||
|
||||
# Apply patches
|
||||
find /patches/ruby/$RUBY_VERSION -name '*.patch' -print0 | xargs -0 -n1 patch -p1 -i
|
||||
./configure --enable-shared --disable-install-doc --disable-install-rdoc --disable-install-capi
|
||||
make install -j 3
|
||||
make install -j $(nproc)
|
||||
|
||||
# Cleanup
|
||||
cd /
|
||||
rm -rf /tmp/*
|
||||
rm -rf /usr/src/ruby
|
||||
apt-get purge -y --auto-remove ruby
|
||||
|
||||
# Verify
|
||||
# verify we have no "ruby" packages installed
|
||||
! dpkg -l | grep -i ruby
|
||||
[ "$(command -v ruby)" = '/usr/local/bin/ruby' ]
|
||||
|
||||
# rough smoke test
|
||||
ruby --version
|
||||
gem --version
|
||||
bundle --version
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue