Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions bin/ruby-build
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,21 @@ is_freebsd() {
[ "$(uname -s)" = "FreeBSD" ]
}

is_fedora() {
if [ -r /etc/os-release ]; then
# shellcheck disable=SC1091
source /etc/os-release
# This will treat Aurora, Bazzite, BlueFin, uCore, and other Fedora variants as `fedora`.
# shellcheck disable=SC2153
local os_id
od_id="${ID_LIKE:-$ID}"
local os_version
os_version=$VERSION_ID
[ "${od_id}" = "fedora" ] || return 1
[ $# -eq 0 ] || [ "${os_version}" -ge "$1" ]
fi
}

freebsd_package_prefix() {
local package="$1"
pkg info --prefix "$package" 2>/dev/null | cut -wf2
Expand Down Expand Up @@ -712,6 +727,15 @@ build_package_standard() {
fi
if [ -z "$CC" ] && is_mac 1010; then
export CC=clang
elif [ "$ruby_semver" -lt 300200 ]; then
# GCC v15 changed the default mode from gnu17 to gnu23.
# See: https://gcc.gnu.org/gcc-15/changes.html#c
# Ruby older than 3.2 can't compile on GCC v15 in the default mode of gnu23.
# See: https://github.com/rbenv/ruby-build/discussions/2529
if is_fedora && is_fedora 42; then
# Fedora 42+ uses GCC v15 with mode gnu23 as default, so we configure for mode gnu17
export CFLAGS="$CFLAGS -std=gnu17"
fi
fi
# ./configure --prefix=/path/to/ruby
# shellcheck disable=SC2086,SC2153
Expand Down