From 7c1452d7dc1069fee0e186034b71e464a25d9394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 24 Sep 2024 10:09:06 +0200 Subject: [PATCH] python3: add support for netbsd --- .../{freebsd-cross.patch => bsd-cross.patch} | 16 +++++++++++----- .../interpreters/python/cpython/default.nix | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-) rename pkgs/development/interpreters/python/cpython/{freebsd-cross.patch => bsd-cross.patch} (54%) diff --git a/pkgs/development/interpreters/python/cpython/freebsd-cross.patch b/pkgs/development/interpreters/python/cpython/bsd-cross.patch similarity index 54% rename from pkgs/development/interpreters/python/cpython/freebsd-cross.patch rename to pkgs/development/interpreters/python/cpython/bsd-cross.patch index 71b45bfead272..7de90505531fc 100644 --- a/pkgs/development/interpreters/python/cpython/freebsd-cross.patch +++ b/pkgs/development/interpreters/python/cpython/bsd-cross.patch @@ -1,22 +1,28 @@ ---- 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 @@ +diff --git a/configure.ac b/configure.ac +index d0d5405028..143e8ddfd5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -559,6 +559,12 @@ then *-*-wasi) ac_sys_system=WASI ;; + *-*-freebsd) + ac_sys_system=FreeBSD ++ ;; ++ *-*-netbsd) ++ ac_sys_system=NetBSD + ;; *) # for now, limit cross builds to known configurations MACHDEP="unknown" -@@ -614,6 +617,9 @@ +@@ -619,6 +625,9 @@ if test "$cross_compiling" = yes; then wasm32-*-* | wasm64-*-*) _host_cpu=$host_cpu ;; -+ x86_64-*-freebsd) ++ x86_64-*-freebsd|x86_64-*-netbsd) + _host_cpu=x86_64 + ;; *) # for now, limit cross builds to known configurations MACHDEP="unknown" + diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 56e0be3ea59cb..0bd2f20d9c625 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -307,11 +307,11 @@ 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) [ + ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && (stdenv.isFreeBSD || stdenv.hostPlatform.isNetBSD)) [ # 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 + ./bsd-cross.patch ] ++ optionals (pythonOlder "3.13") [ # Make sure that the virtualenv activation scripts are # owner-writable, so venvs can be recreated without permission @@ -684,7 +684,7 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { ''; license = licenses.psfl; pkgConfigModules = [ "python3" ]; - platforms = platforms.linux ++ platforms.darwin ++ platforms.windows ++ platforms.freebsd; + platforms = platforms.linux ++ platforms.darwin ++ platforms.windows ++ platforms.freebsd ++ platforms.netbsd; mainProgram = executable; }; })