From 5f12790a4c3a21aa7be4374ee6a0f401665eb4a4 Mon Sep 17 00:00:00 2001 From: Audrey Dutcher Date: Sat, 6 Dec 2025 15:18:45 -0700 Subject: [PATCH] python3: Fix cross compilation to FreeBSD - autoreconf needs to be run if we patch configure.ac - the patch lines need to be adjusted otherwise it applies wrong --- .../interpreters/python/cpython/default.nix | 14 ++++++++++---- .../python/cpython/freebsd-cross.patch | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 2c754ba43fc7..2f5342efd403 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -208,10 +208,16 @@ let nativeBuildInputs = [ nukeReferences ] - ++ optionals (!stdenv.hostPlatform.isDarwin && !withMinimalDeps) [ - autoconf-archive # needed for AX_CHECK_COMPILE_FLAG - autoreconfHook - ] + ++ + optionals + ( + (!stdenv.hostPlatform.isDarwin && !withMinimalDeps) + || (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.hostPlatform.isFreeBSD) + ) + [ + autoconf-archive # needed for AX_CHECK_COMPILE_FLAG + autoreconfHook + ] ++ optionals ((!stdenv.hostPlatform.isDarwin || passthru.pythonAtLeast "3.14") && !withMinimalDeps) [ diff --git a/pkgs/development/interpreters/python/cpython/freebsd-cross.patch b/pkgs/development/interpreters/python/cpython/freebsd-cross.patch index 71b45bfead27..9ad1d20899f0 100644 --- a/pkgs/development/interpreters/python/cpython/freebsd-cross.patch +++ b/pkgs/development/interpreters/python/cpython/freebsd-cross.patch @@ -1,6 +1,6 @@ --- a/configure.ac 2024-06-07 09:17:50.608162031 -0700 +++ b/configure.ac 2024-06-07 09:45:59.844518241 -0700 -@@ -554,6 +554,9 @@ +@@ -339,6 +339,9 @@ *-*-wasi) ac_sys_system=WASI ;; @@ -10,7 +10,7 @@ *) # for now, limit cross builds to known configurations MACHDEP="unknown" -@@ -614,6 +617,9 @@ +@@ -780,6 +783,9 @@ wasm32-*-* | wasm64-*-*) _host_cpu=$host_cpu ;;