Loading bin/ruby-build +17 −1 Original line number Diff line number Diff line Loading @@ -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" Loading Loading @@ -470,6 +480,9 @@ build_package_standard() { ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}" 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}" \ $CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" || return 1 ) >&4 2>&1 Loading Loading @@ -720,6 +733,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() { Loading Loading @@ -758,7 +774,7 @@ verify_gcc() { return 1 fi local version="$("$gcc" --version || true)" local version="$("$gcc" --version 2>/dev/null || true)" if [ -z "$version" ]; then return 1 fi Loading test/compiler.bats 0 → 100644 +85 −0 Original line number Diff line number Diff line #!/usr/bin/env bats load test_helper export MAKE=make export MAKE_OPTS='-j 2' export -n CFLAGS export -n CC @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 } @test "require_gcc silences warnings" { stub gcc '--version : echo warning >&2; echo 4.2.1' run_inline_definition <<DEF require_gcc echo \$CC DEF 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
bin/ruby-build +17 −1 Original line number Diff line number Diff line Loading @@ -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" Loading Loading @@ -470,6 +480,9 @@ build_package_standard() { ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}" 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}" \ $CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" || return 1 ) >&4 2>&1 Loading Loading @@ -720,6 +733,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() { Loading Loading @@ -758,7 +774,7 @@ verify_gcc() { return 1 fi local version="$("$gcc" --version || true)" local version="$("$gcc" --version 2>/dev/null || true)" if [ -z "$version" ]; then return 1 fi Loading
test/compiler.bats 0 → 100644 +85 −0 Original line number Diff line number Diff line #!/usr/bin/env bats load test_helper export MAKE=make export MAKE_OPTS='-j 2' export -n CFLAGS export -n CC @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 } @test "require_gcc silences warnings" { stub gcc '--version : echo warning >&2; echo 4.2.1' run_inline_definition <<DEF require_gcc echo \$CC DEF 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 }