Use custom MACOSX_DEPLOYMENT_TARGET if defined (fixes #312)

This commit is contained in:
Yamashita Yuu 2015-06-28 13:49:53 +09:00
parent abae52ae20
commit 22ecefd572
2 changed files with 27 additions and 4 deletions

View file

@ -1815,10 +1815,12 @@ fi
# Set MACOSX_DEPLOYMENT_TARGET from the product version of OS X (#219, #220)
if [[ "Darwin" == "$(uname -s)" ]]; then
MACOS_VERSION="$(sw_vers -productVersion 2>/dev/null || true)"
MACOS_VERSION_ARRAY=(${MACOS_VERSION//\./ })
if [ "${#MACOS_VERSION_ARRAY[@]}" -ge 2 ]; then
export MACOSX_DEPLOYMENT_TARGET="${MACOS_VERSION_ARRAY[0]}.${MACOS_VERSION_ARRAY[1]}"
if [ -z "${MACOSX_DEPLOYMENT_TARGET}" ]; then
MACOS_VERSION="$(sw_vers -productVersion 2>/dev/null || true)"
MACOS_VERSION_ARRAY=(${MACOS_VERSION//\./ })
if [ "${#MACOS_VERSION_ARRAY[@]}" -ge 2 ]; then
export MACOSX_DEPLOYMENT_TARGET="${MACOS_VERSION_ARRAY[0]}.${MACOS_VERSION_ARRAY[1]}"
fi
fi
fi

View file

@ -259,3 +259,24 @@ OUT
PYTHON_CONFIGURE_OPTS_ARRAY=(--enable-universalsdk=/ --with-universal-archs=intel)
EOS
}
@test "default MACOSX_DEPLOYMENT_TARGET" {
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
TMPDIR="$TMP" run_inline_definition <<OUT
echo "\${MACOSX_DEPLOYMENT_TARGET}"
OUT
assert_success
assert_output "10.10"
}
@test "use custom MACOSX_DEPLOYMENT_TARGET if defined" {
stub uname '-s : echo Darwin'
MACOSX_DEPLOYMENT_TARGET="10.4" TMPDIR="$TMP" run_inline_definition <<OUT
echo "\${MACOSX_DEPLOYMENT_TARGET}"
OUT
assert_success
assert_output "10.4"
}