mirror of
https://github.com/rbenv/ruby-build.git
synced 2026-01-07 07:21:52 +01:00
Fix Yosemite builds that use gcc-4.2 through require_gcc
The definitions that use `require_gcc` are not compatible with Apple's
clang-powered `gcc` and need gcc-4.2 from Homebrew. However, builds
using gcc-4.2 fail on Yosemite with a warning:
couldn't understand kern.osversion `14.0.0'
Although the warning is non-fatal, the build goes to shit from there. It
seems that setting the magical value `MACOSX_DEPLOYMENT_TARGET=10.9`
makes the build work and doesn't seem to have negative consequences.
This commit is contained in:
parent
e7810a61eb
commit
10fd04909d
2 changed files with 51 additions and 0 deletions
|
|
@ -85,6 +85,16 @@ os_information() {
|
|||
fi
|
||||
}
|
||||
|
||||
# 9.1 -> 901
|
||||
# 10.9 -> 1009
|
||||
# 10.10 -> 1010
|
||||
osx_version() {
|
||||
local ver="$(sw_vers -productVersion)"
|
||||
local major="${ver%.*}"
|
||||
local minor="${ver#*.}"
|
||||
echo $(( major*100 + minor ))
|
||||
}
|
||||
|
||||
build_failed() {
|
||||
{ echo
|
||||
colorize 1 "BUILD FAILED"
|
||||
|
|
@ -715,6 +725,9 @@ require_gcc() {
|
|||
fi
|
||||
|
||||
export CC="$gcc"
|
||||
if [ "$(uname -s)" = "Darwin" ] && [ "$(osx_version)" -ge 1010 ]; then
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.9
|
||||
fi
|
||||
}
|
||||
|
||||
locate_gcc() {
|
||||
|
|
|
|||
38
test/compiler.bats
Normal file
38
test/compiler.bats
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
export MAKE=make
|
||||
|
||||
@test "require_gcc on OS X 10.9" {
|
||||
stub uname '-s : echo Darwin'
|
||||
stub sw_vers '-productVersion : echo 10.9'
|
||||
stub gcc '--version : echo 4.2.1'
|
||||
|
||||
run_inline_definition <<DEF
|
||||
require_gcc
|
||||
echo CC=\$CC
|
||||
echo MACOSX_DEPLOYMENT_TARGET=\${MACOSX_DEPLOYMENT_TARGET-no}
|
||||
DEF
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
CC=${TMP}/bin/gcc
|
||||
MACOSX_DEPLOYMENT_TARGET=no
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "require_gcc on OS X 10.10" {
|
||||
stub uname '-s : echo Darwin'
|
||||
stub sw_vers '-productVersion : echo 10.10'
|
||||
stub gcc '--version : echo 4.2.1'
|
||||
|
||||
run_inline_definition <<DEF
|
||||
require_gcc
|
||||
echo CC=\$CC
|
||||
echo MACOSX_DEPLOYMENT_TARGET=\${MACOSX_DEPLOYMENT_TARGET-no}
|
||||
DEF
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
CC=${TMP}/bin/gcc
|
||||
MACOSX_DEPLOYMENT_TARGET=10.9
|
||||
OUT
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue