mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Default --with-universal-archs to universal2 on Apple Silicon (#2122)
Don't override a user-supplied value
This commit is contained in:
parent
a015760854
commit
8db91d5516
2 changed files with 39 additions and 3 deletions
|
@ -2137,13 +2137,21 @@ if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-framework"* ]]; the
|
||||||
package_option python configure --enable-framework="${PREFIX_PATH}/Library/Frameworks"
|
package_option python configure --enable-framework="${PREFIX_PATH}/Library/Frameworks"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build against universal SDK (#219, #220)
|
# Build against universal SDK
|
||||||
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then
|
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" == *"--enable-universalsdk"* ]]; then
|
||||||
if ! is_mac; then
|
if ! is_mac; then
|
||||||
echo "python-build: universal installation is not supported." >&2
|
echo "python-build: universal installation is not supported." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
package_option python configure --enable-universalsdk=/ --with-universal-archs=intel
|
package_option python configure --enable-universalsdk=/
|
||||||
|
if [[ "$CONFIGURE_OPTS $PYTHON_CONFIGURE_OPTS" != *"--enable-universal-archs"* ]]; then
|
||||||
|
# in CPython's configure.ac, --with-universal-archs defaults to 'intel' which means i386 + x86_64
|
||||||
|
# since 2.7.5 and 3.3.0 -- i.e. in all non-EOL versions
|
||||||
|
# Apple Silicon cannot build these, in it, it rather makes sense to default to Universal2 binaries
|
||||||
|
if [[ $(arch) == "arm64" ]]; then
|
||||||
|
package_option python configure --with-universal-archs=universal2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compile with `--enable-unicode=ucs4` by default (#257)
|
# Compile with `--enable-unicode=ucs4` by default (#257)
|
||||||
|
|
|
@ -273,13 +273,41 @@ EOS
|
||||||
@test "enable universalsdk" {
|
@test "enable universalsdk" {
|
||||||
|
|
||||||
for i in {1..3}; do stub uname '-s : echo Darwin'; done
|
for i in {1..3}; do stub uname '-s : echo Darwin'; done
|
||||||
|
stub arch "echo x86_64"
|
||||||
|
|
||||||
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
|
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
|
||||||
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
|
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
|
||||||
OUT
|
OUT
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-universalsdk=/ --with-universal-archs=intel)
|
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-universalsdk=/)
|
||||||
|
EOS
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "enable universalsdk on Apple Silicon" {
|
||||||
|
|
||||||
|
for i in {1..3}; do stub uname '-s : echo Darwin'; done
|
||||||
|
stub arch "echo arm64"
|
||||||
|
|
||||||
|
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
|
||||||
|
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
|
||||||
|
OUT
|
||||||
|
assert_success
|
||||||
|
assert_output <<EOS
|
||||||
|
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-universalsdk=/ --with-universal-archs=universal2)
|
||||||
|
EOS
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "enable universalsdk with explicit archs argument" {
|
||||||
|
|
||||||
|
for i in {1..3}; do stub uname '-s : echo Darwin'; done
|
||||||
|
|
||||||
|
PYTHON_CONFIGURE_OPTS="--enable-universalsdk --with-universal-archs=foo" TMPDIR="$TMP" run_inline_definition <<OUT
|
||||||
|
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
|
||||||
|
OUT
|
||||||
|
assert_success
|
||||||
|
assert_output <<EOS
|
||||||
|
PYTHON_CONFIGURE_OPTS_ARRAY=(--libdir=${TMP}/install/lib --enable-universalsdk=/)
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue