1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-10 04:23:47 -05:00

Fix wrong libpython being linked to in MacOS (#2596)

Without rpath, python would link up to the system's libpython
This commit is contained in:
native-api
2023-01-19 00:21:10 +03:00
committed by GitHub
parent bd618ea9ef
commit 819e2b8f45
4 changed files with 84 additions and 79 deletions

View File

@@ -8,13 +8,11 @@ export -n CC
export -n PYTHON_CONFIGURE_OPTS
@test "require_gcc on OS X 10.9" {
# pyenv/pyenv#1026
stub uname false '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5'
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5'
stub gcc '--version : echo 4.2.1' '--version : echo 4.2.1'
for i in {1..3}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.9.5'; done
stub gcc '--version : echo 4.2.1'
run_inline_definition <<DEF
require_gcc
@@ -26,22 +24,28 @@ DEF
CC=${TMP}/bin/gcc
MACOSX_DEPLOYMENT_TARGET=10.9
OUT
unstub uname
unstub sw_vers
unstub gcc
}
@test "require_gcc on OS X 10.10" {
# pyenv/pyenv#1026
stub uname false '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
for i in {1..3}; do stub uname '-s : echo Darwin'; done
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
stub gcc '--version : echo 4.2.1' '--version : echo 4.2.1'
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
unstub uname
unstub sw_vers
unstub gcc
assert_success
assert_output <<OUT
CC=${TMP}/bin/gcc
@@ -50,20 +54,22 @@ OUT
}
@test "require_gcc silences warnings" {
stub gcc '--version : echo warning >&2; echo 4.2.1' '--version : echo warning >&2; echo 4.2.1'
stub gcc '--version : echo warning >&2; echo 4.2.1'
run_inline_definition <<DEF
require_gcc
echo \$CC
DEF
assert_success "${TMP}/bin/gcc"
unstub gcc
}
@test "CC=clang by default on OS X 10.10" {
mkdir -p "$INSTALL_ROOT"
cd "$INSTALL_ROOT"
for i in {1..10}; do stub uname '-s : echo Darwin'; done
for i in {1..9}; do stub uname '-s : echo Darwin'; done
for i in {1..3}; do stub sw_vers '-productVersion : echo 10.10'; done
stub cc 'false'
@@ -85,10 +91,6 @@ exec 4<&1
build_package_standard python
DEF
assert_success
unstub uname
unstub sw_vers
assert_output <<OUT
./configure --prefix=$INSTALL_ROOT --enable-shared --libdir=${TMP}/install/lib
CC=clang
@@ -96,13 +98,16 @@ CFLAGS=no
make -j 2
make install
OUT
unstub uname
unstub sw_vers
}
@test "passthrough CFLAGS_EXTRA to micropython compiler" {
mkdir -p "$INSTALL_ROOT/mpy-cross"
mkdir -p "$INSTALL_ROOT/ports/unix"
mkdir -p "$INSTALL_ROOT/bin"
# touch "$INSTALL_ROOT/bin/python"
cd "$INSTALL_ROOT"
stub make true true '(for a in "$@"; do echo $a; done)|grep -E "^CFLAGS_EXTRA="' true
@@ -113,7 +118,7 @@ exec 4<&1
CFLAGS_EXTRA='-Wno-floating-conversion' build_package_micropython
DEF
#assert_success
assert_success
assert_output <<OUT
CFLAGS_EXTRA=-DMICROPY_PY_SYS_PATH_DEFAULT='".frozen:${TMP}/install/lib/micropython"' -Wno-floating-conversion
OUT