diff --git a/patches/ruby/2.7/thread-memory-allocations-2.7.patch b/patches/ruby/2.7/thread-memory-allocations.patch similarity index 100% rename from patches/ruby/2.7/thread-memory-allocations-2.7.patch rename to patches/ruby/2.7/thread-memory-allocations.patch diff --git a/patches/ruby/3.0/thread-memory-allocations-3.0.patch b/patches/ruby/3.0/thread-memory-allocations.patch similarity index 100% rename from patches/ruby/3.0/thread-memory-allocations-3.0.patch rename to patches/ruby/3.0/thread-memory-allocations.patch diff --git a/patches/ruby/mandatory_patches b/patches/ruby/mandatory_patches new file mode 100644 index 0000000..fb13254 --- /dev/null +++ b/patches/ruby/mandatory_patches @@ -0,0 +1 @@ +thread-memory-allocations diff --git a/scripts/install-ruby b/scripts/install-ruby index b04c9dd..eef6293 100755 --- a/scripts/install-ruby +++ b/scripts/install-ruby @@ -46,10 +46,23 @@ function build_common() { rm ruby.tar.gz cd /usr/src/ruby + # Process patch files + local ruby_version=$(cut -d '.' -f 1,2 <<< $RUBY_VERSION) + local patchdir="/patches/ruby/${ruby_version}" + + # Verify mandatory patches + while read -r patchname; do + local patchfile="${patchdir}/${patchname}.patch" + if [[ ! -f "${patchfile}" ]]; then + echo "!! Missing mandatory patch ${patchname}" + echo "!! Make sure ${patchfile} exists before proceeding." + exit 1 + fi + done < "/patches/ruby/mandatory_patches" + # Apply patches - ruby_version=`cut -d '.' -f 1,2 <<< $RUBY_VERSION` - if [[ -d "/patches/ruby/$ruby_version" ]]; then - for i in "/patches/ruby/$ruby_version"/*.patch; do + if [[ -d "${patchdir}" ]]; then + for i in "${patchdir}"/*.patch; do echo "$i..." patch -p1 -i "$i" done