From 96b4c0f7e7c2979c13a11d7aba59440b9250b000 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Thu, 21 Aug 2014 11:58:50 +0900 Subject: [PATCH 1/4] Set MACOSX_DEPLOYMENT_TARGET from the product version of OS X (#219, #220) --- plugins/python-build/bin/python-build | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index cf95e35d..706fe9d1 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1642,6 +1642,19 @@ if [ -n "${PIP_VERSION}" ]; then GET_PIP_URL="https://raw.githubusercontent.com/pypa/pip/${PIP_VERSION}/contrib/get-pip.py" 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]}" + else + { colorize 1 "WARNING" + echo ": Could not detect the product version of OS X for MACOSX_DEPLOYMENT_TARGET. Use default setting." + } >&2 + fi +fi + SEED="$(date "+%Y%m%d%H%M%S").$$" LOG_PATH="${TMP}/python-build.${SEED}.log" PYTHON_BIN="${PREFIX_PATH}/bin/python" From 29d3df661e6a9d79a9c14499aab50e838d4f9bc7 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Thu, 21 Aug 2014 12:11:20 +0900 Subject: [PATCH 2/4] Fix broken tests --- plugins/python-build/test/build.bats | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index 99349937..c63367ce 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -216,6 +216,7 @@ OUT @test "number of CPU cores defaults to 2" { cached_tarball "Python-3.2.1" + stub uname '-s : echo Darwin' stub uname '-s : echo Darwin' stub sysctl false stub_make_install @@ -240,6 +241,7 @@ OUT @test "number of CPU cores is detected on Mac" { cached_tarball "Python-3.2.1" + stub uname '-s : echo Darwin' stub uname '-s : echo Darwin' stub sysctl '-n hw.ncpu : echo 4' stub_make_install @@ -316,6 +318,7 @@ OUT @test "make on FreeBSD defaults to gmake" { cached_tarball "Python-3.2.1" + stub uname "-s : echo FreeBSD" stub uname "-s : echo FreeBSD" MAKE=gmake stub_make_install From f76309d419ce9b714f80e3e0de2016cb8f8db8a3 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Thu, 21 Aug 2014 12:32:36 +0900 Subject: [PATCH 3/4] Add tests for MACOSX_DEPLOYMENT_TARGET (#219, #220) --- plugins/python-build/test/build.bats | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index c63367ce..5cab04b1 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -392,3 +392,37 @@ OUT run python-build "${TMP}/build-definition" "$INSTALL_ROOT" assert_failure "python-build: TMPDIR=$TMPDIR is set to a non-accessible location" } + +@test "setting MACOSX_DEPLOYMENT_TARGET from the product version of OS X" { + stub uname '-s : echo Darwin' + stub sw_vers '-productVersion : echo 10.9.4' + + run_inline_definition < "$INSTALL_ROOT/build.log" +DEF + assert_success + + assert_build_log < "$INSTALL_ROOT/build.log" +DEF + assert_success + + assert_build_log < Date: Thu, 21 Aug 2014 13:58:49 +0900 Subject: [PATCH 4/4] Setup configure options to build against universal SDK on Darwin --- plugins/python-build/bin/python-build | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 706fe9d1..4c2817f3 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1603,6 +1603,10 @@ fi # Add support for framework installation (`--enable-framework`) of CPython (#55, #99) if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then + if [[ "Darwin" != "$(uname -s)" ]]; then + echo "python-build: framework installation is not supported." >&2 + exit 1 + fi create_framework_dirs() { local version="$(echo "$1" | sed -E 's/^[^0-9]*([0-9]+\.[0-9]+).*$/\1/')" mkdir -p "${PREFIX_PATH}/Python.framework/Versions/${version}" @@ -1617,6 +1621,15 @@ if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; then package_option python configure --enable-framework="${PREFIX_PATH}" fi +# Build against universal SDK (#219, #220) +if [[ "$PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then + if [[ "Darwin" != "$(uname -s)" ]]; then + echo "python-build: universal installation is not supported." >&2 + exit 1 + fi + package_option python configure --enable-universalsdk=/ --with-universal-archs=intel +fi + # SSL Certificate error with older wget that does not support Server Name Indication (#60) if ! command -v curl 1>/dev/null 2>&1 && [[ "$(wget --version 2>/dev/null || true)" = "GNU Wget 1.1"[0-3]* ]]; then echo "python-build: wget (< 1.14) doesn't support Server Name Indication. Please install curl (>= 7.18.1) and try again" >&2