python{311,312,313}: use system libmpdec again

Override the configure check not to do a universal build. Using the system libmpdec is required to enable LTO on Darwin.
This commit is contained in:
Randy Eckenrode 2024-07-18 00:31:46 -04:00
parent 637b531dcf
commit 0d7d9280d3
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9

View File

@ -406,9 +406,6 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
configureFlags = [
"--without-ensurepip"
"--with-system-expat"
] ++ optionals (!(stdenv.isDarwin && pythonAtLeast "3.12")) [
# ./Modules/_decimal/_decimal.c:4673:6: error: "No valid combination of CONFIG_64, CONFIG_32 and _PyHASH_BITS"
# https://hydra.nixos.org/build/248410479/nixlog/2/tail
"--with-system-libmpdec"
] ++ optionals (openssl != null) [
"--with-openssl=${openssl.dev}"
@ -480,6 +477,10 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
export PYTHON_DECIMAL_WITH_MACHINE=${if stdenv.isAarch64 then "uint128" else "x64"}
# Ensure that modern platform features are enabled on Darwin in spite of having no version suffix.
sed -E -i -e 's|Darwin/\[12\]\[0-9\]\.\*|Darwin/*|' configure
'' + optionalString (pythonAtLeast "3.11") ''
# Also override the auto-detection in `configure`.
substituteInPlace configure \
--replace-fail 'libmpdec_machine=universal' 'libmpdec_machine=${if stdenv.isAarch64 then "uint128" else "x64"}'
'' + optionalString (stdenv.isDarwin && x11Support && pythonAtLeast "3.11") ''
export TCLTK_LIBS="-L${tcl}/lib -L${tk}/lib -l${tcl.libPrefix} -l${tk.libPrefix}"
export TCLTK_CFLAGS="-I${tcl}/include -I${tk}/include"