From 0d7d9280d36ba0562cab76b60e2d750b2a1695a9 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 18 Jul 2024 00:31:46 -0400 Subject: [PATCH] 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. --- pkgs/development/interpreters/python/cpython/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index ac5d197ab3dd..9a155dd62b48 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -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"