mirror of
https://github.com/rbenv/ruby-build.git
synced 2026-05-15 00:46:53 -04:00
Ruby >= 4.0 requires OpenSSL >= 1.1.1, but the script hardcoded needs_openssl:1.0.2-3.x.x for all versions. Add version-based condition to use needs_openssl:1.1.1-3.x.x for Ruby 4.x and later. Ref: https://github.com/rbenv/ruby-build/pull/2608 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
49 lines
1.6 KiB
Bash
Executable file
49 lines
1.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
set -o pipefail
|
|
|
|
if [ $# -ne 3 ]; then
|
|
echo "usage: $0 VERSION OPENSSL_VERSION RELEASE_DIRECTORY"
|
|
exit 1
|
|
fi
|
|
|
|
version="$1"
|
|
openssl_version="$2"
|
|
release_directory="$3"
|
|
file="share/ruby-build/${version}"
|
|
|
|
basename="ruby-${version}.tar.gz"
|
|
openssl_basename="openssl-${openssl_version}.tar.gz"
|
|
major_minor_version=$(echo ${version} | cut -d '.' -f 1,2)
|
|
url="https://cache.ruby-lang.org/pub/ruby/${major_minor_version}/${basename}"
|
|
if command -v sha256sum >/dev/null; then
|
|
sha256=$(sha256sum "$release_directory/$basename" | cut -d ' ' -f 1)
|
|
elif command -v shasum >/dev/null; then
|
|
sha256=$(shasum -a 256 "$release_directory/$basename" | cut -d ' ' -f 1)
|
|
else
|
|
echo "$0 requires sha256sum or shasum to be installed on the system."
|
|
exit 1
|
|
fi
|
|
|
|
openssl_url="https://github.com/openssl/openssl/releases/download/openssl-${openssl_version}/openssl-${openssl_version}.tar.gz"
|
|
if command -v sha256sum >/dev/null; then
|
|
openssl_sha256=$(sha256sum "$release_directory/$openssl_basename" | cut -d ' ' -f 1)
|
|
elif command -v shasum >/dev/null; then
|
|
openssl_sha256=$(shasum -a 256 "$release_directory/$openssl_basename" | cut -d ' ' -f 1)
|
|
else
|
|
echo "$0 requires sha256sum or shasum to be installed on the system."
|
|
exit 1
|
|
fi
|
|
|
|
major_version=$(echo ${version} | cut -d '.' -f 1)
|
|
if [ "$major_version" -ge 4 ]; then
|
|
needs_openssl="needs_openssl:1.1.1-3.x.x"
|
|
else
|
|
needs_openssl="needs_openssl:1.0.2-3.x.x"
|
|
fi
|
|
|
|
cat > "$file" <<EOS
|
|
install_package "openssl-${openssl_version}" "${openssl_url}#${openssl_sha256}" openssl --if ${needs_openssl}
|
|
install_package "ruby-${version}" "${url}#${sha256}" enable_shared standard
|
|
EOS
|