about summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authorAudrey Dutcher <audrey@rhelmot.io>2024-06-07 09:48:27 -0700
committerAudrey Dutcher <audrey@rhelmot.io>2024-06-07 20:28:29 -0700
commit22913c86f155d9e670cb56b8f55493e4acfdbc96 (patch)
tree9b392f38cf24aea529e8df54dce6ebef6b65b60f /pkgs/development/interpreters
parent2542605888a650adf055af93f3d9a0dd0d2a93c0 (diff)
python3: Enable FreeBSD cross build
This only enables x86_64-unknown-freebsd, not any other FreeBSD, since I
do not have any other machines to tests on. If you're reading this, feel
free to try out other arches!
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/python/cpython/default.nix7
-rw-r--r--pkgs/development/interpreters/python/cpython/freebsd-cross.patch22
2 files changed, 28 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix
index 37b9d19fe88d9..f233afb2a8dca 100644
--- a/pkgs/development/interpreters/python/cpython/default.nix
+++ b/pkgs/development/interpreters/python/cpython/default.nix
@@ -303,10 +303,15 @@ in with passthru; stdenv.mkDerivation (finalAttrs: {
     # (since it will do a futile invocation of gcc (!) to find
     # libuuid, slowing down program startup a lot).
     noldconfigPatch
+  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && stdenv.isFreeBSD) [
+    # Cross compilation only supports a limited number of "known good"
+    # configurations. If you're reading this and it's been a long time
+    # since this diff, consider submitting this patch upstream!
+    ./freebsd-cross.patch
+  ] ++ optionals (pythonOlder "3.13") [
     # Make sure that the virtualenv activation scripts are
     # owner-writable, so venvs can be recreated without permission
     # errors.
-  ] ++ optionals (pythonOlder "3.13") [
     ./virtualenv-permissions.patch
   ] ++ optionals (pythonAtLeast "3.13") [
     ./3.13/virtualenv-permissions.patch
diff --git a/pkgs/development/interpreters/python/cpython/freebsd-cross.patch b/pkgs/development/interpreters/python/cpython/freebsd-cross.patch
new file mode 100644
index 0000000000000..71b45bfead272
--- /dev/null
+++ b/pkgs/development/interpreters/python/cpython/freebsd-cross.patch
@@ -0,0 +1,22 @@
+--- 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 @@
+ 	*-*-wasi)
+ 	    ac_sys_system=WASI
+ 	    ;;
++	*-*-freebsd)
++	    ac_sys_system=FreeBSD
++	    ;;
+ 	*)
+ 		# for now, limit cross builds to known configurations
+ 		MACHDEP="unknown"
+@@ -614,6 +617,9 @@
+ 	wasm32-*-* | wasm64-*-*)
+ 		_host_cpu=$host_cpu
+ 		;;
++	x86_64-*-freebsd)
++		_host_cpu=x86_64
++		;;
+ 	*)
+ 		# for now, limit cross builds to known configurations
+ 		MACHDEP="unknown"