Skip to content
Snippets Groups Projects
Unverified Commit ce730b8e authored by Stan Hu's avatar Stan Hu
Browse files

Make CNG builds work with Ruby 3.1.4

https://gitlab.com/gitlab-org/build/CNG/-/merge_requests/1825 added a
patch specifically for Ruby 3.1.5, but this patch to the fiddle gem
doesn't work properly when applied to Ruby 3.1.0 to Ruby 3.1.4. Make
Ruby patch script to handle version-specific patches so that 3.1.4
take this patch.

This fixes a build error in
https://gitlab.com/gitlab-org/build/CNG-mirror/-/jobs/6821715942.
parent 32947528
Branches
Tags
No related merge requests found
......@@ -83,7 +83,7 @@ RUN buildDeps=' \
&& tar -xf ruby.tar.xz \
&& rm ruby.tar.xz \
&& cd ruby-${RUBY_VERSION} \
&& /build-scripts/apply_ruby_patches.sh ${BUILD_DIR}/patches ${RUBY_MAJOR_VERSION} \
&& /build-scripts/apply_ruby_patches.sh ${BUILD_DIR}/patches ${RUBY_VERSION} \
&& export LDFLAGS="-Wl,--no-as-needed" \
&& if printf "${RUBY_VERSION}" | grep -Eq '3.0.' ; then \
export CONFIGURE_ARGS="--with-openssl-dir=/usr/local/openssl_ruby"; \
......
......@@ -26,7 +26,7 @@ RUN mkdir /assets \
&& export RUBY_MAJOR_VERSION="${RUBY_VERSION%.*}" \
&& curl -f --retry 6 -s https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR_VERSION}/ruby-${RUBY_VERSION}.tar.gz | tar -xz \
&& cd ruby-${RUBY_VERSION} \
&& /build-scripts/apply_ruby_patches.sh ${BUILD_DIR}/patches ${RUBY_MAJOR_VERSION} \
&& /build-scripts/apply_ruby_patches.sh ${BUILD_DIR}/patches ${RUBY_VERSION} \
&& export LDFLAGS="-Wl,--no-as-needed" \
&& cflags="-fno-omit-frame-pointer" ./configure --prefix=/usr --libdir=${LIBDIR} --with-jemalloc --disable-dtrace --disable-install-doc --disable-install-rdoc --enable-shared --with-out-ext=dbm,readline --without-gmp --without-gdbm --without-tk \
&& make -j "$(nproc)" install \
......
......@@ -2,10 +2,11 @@
patchdir=$1
ruby_version=$2
ruby_major_version=${ruby_version%.*}
# Verify patches
while read -r patchname; do
patchfile="${patchdir}/${ruby_version}/${patchname}.patch"
patchfile="${patchdir}/${ruby_major_version}/${patchname}.patch"
if [[ ! -f "${patchfile}" ]]; then
echo "!! Missing mandatory patch ${patchname}"
echo "!! Make sure ${patchfile} exists before proceeding."
......@@ -13,7 +14,15 @@ while read -r patchname; do
fi
done < "${patchdir}/mandatory_patches"
# Apply patches
# Apply patches that apply to all Ruby major versions
if [[ -d "${patchdir}/${ruby_major_version}" ]]; then
for i in "${patchdir}/${ruby_major_version}"/*.patch; do
echo "$i..."
patch -p1 -i "$i"
done
fi
# Apply patches that apply to specific Ruby versions
if [[ -d "${patchdir}/${ruby_version}" ]]; then
for i in "${patchdir}/${ruby_version}"/*.patch; do
echo "$i..."
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment