Find zlib from Xcode or brew on Mojave (#1353)

fixes #1219, #1333
This commit is contained in:
Mikhail Bulash 2019-06-11 17:12:00 +03:00 committed by Josh Friend
parent 2350e57b00
commit 4157973301
4 changed files with 39 additions and 13 deletions

View file

@ -23,6 +23,7 @@ dist:
osx_image: osx_image:
- xcode9.4 - xcode9.4
- xcode10 - xcode10
- xcode10.2
env: env:
- PYTHON_BUILD_VERSION=3.8-dev - PYTHON_BUILD_VERSION=3.8-dev
@ -55,6 +56,8 @@ jobs:
# list, to prevent duplicate Linux builds. # list, to prevent duplicate Linux builds.
- os: linux - os: linux
osx_image: xcode9.4 osx_image: xcode9.4
- os: linux
osx_image: xcode10
allow_failures: allow_failures:
- env: PYTHON_BUILD_VERSION=3.8-dev - env: PYTHON_BUILD_VERSION=3.8-dev

View file

@ -759,7 +759,10 @@ build_package_standard_build() {
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS" local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
if [ "$package_var_name" = "PYTHON" ]; then if [ "$package_var_name" = "PYTHON" ]; then
use_homebrew_readline || use_freebsd_pkg ||true use_homebrew_readline || use_freebsd_pkg || true
if is_mac -ge 1014; then
use_xcode_sdk_zlib || use_homebrew_zlib || true
fi
fi fi
( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then
@ -1628,6 +1631,22 @@ build_package_verify_openssl() {
' "$(basename "$(type -p yum apt-get | head -1)")" >&4 2>&1 ' "$(basename "$(type -p yum apt-get | head -1)")" >&4 2>&1
} }
use_homebrew_zlib() {
local brew_zlib="$(brew --prefix zlib 2>/dev/null || true)"
if [ -d "$brew_zlib" ]; then
echo "python-build: use zlib from homebrew"
export CFLAGS="-I${brew_zlib} ${CFLAGS}"
fi
}
use_xcode_sdk_zlib() {
local xc_sdk_path="$(xcrun --show-sdk-path 2>/dev/null || true)"
if [ -d "$xc_sdk_path" ]; then
echo "python-build: use zlib from xcode sdk"
export CFLAGS="-I${xc_sdk_path}/usr/include ${CFLAGS}"
fi
}
# Ensure that directories listed in LDFLAGS exist # Ensure that directories listed in LDFLAGS exist
build_package_ldflags_dirs() { build_package_ldflags_dirs() {
local arg dir local arg dir

View file

@ -65,7 +65,7 @@ assert_build_log() {
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false
stub uname '-s : echo Linux' stub uname '-s : echo Linux' '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@ -95,7 +95,7 @@ OUT
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false
stub uname '-s : echo Linux' stub uname '-s : echo Linux' '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@ -125,7 +125,7 @@ OUT
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname '-s : echo Linux' stub uname '-s : echo Linux' '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@ -164,6 +164,7 @@ OUT
stub uname false false stub uname false false
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub uname '-s : echo Darwin'
stub brew "--prefix libyaml : echo '$brew_libdir'" false stub brew "--prefix libyaml : echo '$brew_libdir'" false
stub_make_install stub_make_install
@ -251,7 +252,7 @@ OUT
# yyuu/pyenv#257 # yyuu/pyenv#257
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub uname '-s : echo Darwin' false stub uname '-s : echo Darwin' false '-s : echo Darwin'
stub sysctl false stub sysctl false
stub_make_install stub_make_install
@ -282,7 +283,7 @@ OUT
# yyuu/pyenv#257 # yyuu/pyenv#257
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub uname '-s : echo Darwin' false stub uname '-s : echo Darwin' false '-s : echo Darwin'
stub sysctl '-n hw.ncpu : echo 4' stub sysctl '-n hw.ncpu : echo 4'
stub_make_install stub_make_install
@ -310,7 +311,7 @@ OUT
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false
stub uname '-s : echo FreeBSD' false stub uname '-s : echo FreeBSD' false false
stub sysctl '-n hw.ncpu : echo 1' stub sysctl '-n hw.ncpu : echo 1'
stub_make_install stub_make_install
@ -336,7 +337,7 @@ OUT
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false false
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub_make_install stub_make_install
@ -362,7 +363,7 @@ OUT
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false false
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub_make_install stub_make_install
@ -399,7 +400,7 @@ OUT
stub uname "-s : echo FreeBSD" "-r : echo 9.1" false stub uname "-s : echo FreeBSD" "-r : echo 9.1" false
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false false
MAKE=gmake stub_make_install MAKE=gmake stub_make_install
@ -416,7 +417,7 @@ OUT
stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE" false stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE" false
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false false
stub_make_install stub_make_install
@ -432,7 +433,7 @@ OUT
stub uname "-s : echo FreeBSD" "-r : echo 11.0-RELEASE" false stub uname "-s : echo FreeBSD" "-r : echo 11.0-RELEASE" false
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false false stub uname false false false
stub_make_install stub_make_install
@ -458,6 +459,7 @@ CONF
# yyuu/pyenv#257 # yyuu/pyenv#257
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub uname '-s : echo Linux' stub uname '-s : echo Linux'
stub uname '-s : echo Linux'
export PYTHON_CONFIGURE="${TMP}/custom-configure" export PYTHON_CONFIGURE="${TMP}/custom-configure"
run_inline_definition <<DEF run_inline_definition <<DEF

View file

@ -64,9 +64,11 @@ DEF
cd "$INSTALL_ROOT" cd "$INSTALL_ROOT"
# pyenv/pyenv#1026 # pyenv/pyenv#1026
stub uname false '-s : echo Darwin' false '-s : echo Darwin' stub uname false '-s : echo Darwin' false '-s : echo Darwin' '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
stub sw_vers '-productVersion : echo 10.10'
stub sw_vers '-productVersion : echo 10.10'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
stub cc 'false' stub cc 'false'
stub brew 'false' stub brew 'false'