mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-09-21 16:41:22 +02:00
Use CC=clang by default on Yosemite to avoid gcc-4.2
Newer MRIs will pick up gcc-4.2 from PATH and use that instead of `/usr/bin/gcc`. While this worked up till now, it will not work in Yosemite anymore since Homebrew's apple-gcc42 is generally not compatible with 10.10. So when CC has not explicitly been set, set it to `clang` to avoid searching the PATH for any other gcc versions. This fixes MRI builds on systems where apple-gcc42 is installed.
This commit is contained in:
parent
dafba300b1
commit
6e39eb52a8
2 changed files with 39 additions and 0 deletions
|
@ -479,6 +479,9 @@ build_package_standard() {
|
||||||
( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then
|
( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then
|
||||||
export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}"
|
export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}"
|
||||||
fi
|
fi
|
||||||
|
if [ -z "$CC" ] && [ "$(uname -s)" = "Darwin" ] && [ "$(osx_version)" -ge 1010 ]; then
|
||||||
|
export CC=clang
|
||||||
|
fi
|
||||||
${!PACKAGE_CONFIGURE:-./configure} --prefix="${!PACKAGE_PREFIX_PATH:-$PREFIX_PATH}" \
|
${!PACKAGE_CONFIGURE:-./configure} --prefix="${!PACKAGE_PREFIX_PATH:-$PREFIX_PATH}" \
|
||||||
$CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" || return 1
|
$CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" || return 1
|
||||||
) >&4 2>&1
|
) >&4 2>&1
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
load test_helper
|
load test_helper
|
||||||
export MAKE=make
|
export MAKE=make
|
||||||
|
export MAKE_OPTS='-j 2'
|
||||||
|
export -n CFLAGS
|
||||||
|
|
||||||
@test "require_gcc on OS X 10.9" {
|
@test "require_gcc on OS X 10.9" {
|
||||||
stub uname '-s : echo Darwin'
|
stub uname '-s : echo Darwin'
|
||||||
|
@ -46,3 +48,37 @@ echo \$CC
|
||||||
DEF
|
DEF
|
||||||
assert_success "${TMP}/bin/gcc"
|
assert_success "${TMP}/bin/gcc"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "CC=clang by default on OS X 10.10" {
|
||||||
|
mkdir -p "$INSTALL_ROOT"
|
||||||
|
cd "$INSTALL_ROOT"
|
||||||
|
|
||||||
|
stub uname '-s : echo Darwin'
|
||||||
|
stub sw_vers '-productVersion : echo 10.10'
|
||||||
|
stub cc 'false'
|
||||||
|
stub brew 'false'
|
||||||
|
stub make \
|
||||||
|
'echo make $@' \
|
||||||
|
'echo make $@'
|
||||||
|
|
||||||
|
cat > ./configure <<CON
|
||||||
|
#!${BASH}
|
||||||
|
echo ./configure "\$@"
|
||||||
|
echo CC=\$CC
|
||||||
|
echo CFLAGS=\${CFLAGS-no}
|
||||||
|
CON
|
||||||
|
chmod +x ./configure
|
||||||
|
|
||||||
|
run_inline_definition <<DEF
|
||||||
|
exec 4<&1
|
||||||
|
build_package_standard ruby
|
||||||
|
DEF
|
||||||
|
assert_success
|
||||||
|
assert_output <<OUT
|
||||||
|
./configure --prefix=$INSTALL_ROOT
|
||||||
|
CC=clang
|
||||||
|
CFLAGS=no
|
||||||
|
make -j 2
|
||||||
|
make install
|
||||||
|
OUT
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue