Skip to content

Commit 2f8dcaf

Browse files
committed
Merge pull request rbenv#351 from jeremy/restore-o3-cflags
Restore -O3 default when we build with clang
2 parents 28b9bcb + b219192 commit 2f8dcaf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bin/ruby-build

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,12 @@ fi
730730

731731
# Work around warnings building Ruby 2.0 on Clang 2.x:
732732
# pass -Wno-error=shorten-64-to-32 if the compiler accepts it.
733+
#
734+
# When we set CFLAGS, Ruby won't apply its default flags, though. Since clang
735+
# builds 1.9.x and 2.x only, where -O3 is default, we can safely set that flag.
736+
# Ensure it's the first flag since later flags take precedence.
733737
if "${CC:-cc}" -x c /dev/null -E -Wno-error=shorten-64-to-32 &>/dev/null; then
734-
RUBY_CFLAGS="$RUBY_CFLAGS -Wno-error=shorten-64-to-32"
738+
RUBY_CFLAGS="-O3 -Wno-error=shorten-64-to-32 $RUBY_CFLAGS"
735739
fi
736740

737741
if [ -z "$MAKE" ]; then

0 commit comments

Comments
 (0)