Subject: [PATCH core-updates 3/4] gnu: python-pycryptodome: Fix build and enable cross-compilation.

From: Maxim Cournoyer <[email-masked]>
Date: Mon, 16 Jan 2023 00:13:38 -0500

* gnu/packages/python-crypto.scm (python-pycryptodome) [build-system]: Use
pyproject-build-system.
[arguments]: New field.
[inputs]: Re-indent.
---

 gnu/packages/python-crypto.scm | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm
index c9071c4cf6..9023a5e054 100644
--- a/gnu/packages/python-crypto.scm
+++ b/gnu/packages/python-crypto.scm
@@ -1012,9 +1012,23 @@ (define-public python-pycryptodome
          "1f0qc0ns3ppybkr7wi66gsl5wfkcx1fdklmh3362nn84spddsdci"))
        (modules '((guix build utils)))
        (snippet pycryptodome-unbundle-tomcrypt-snippet)))
-    (build-system python-build-system)
-    (inputs
-     (list libtomcrypt libtommath))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'build 'extend-C_INCLUDE_PATH
+            (lambda* (#:key inputs target #:allow-other-keys)
+              (if target
+                  (setenv "CROSS_C_INCLUDE_PATH"
+                          (string-append (search-input-directory
+                                          inputs "include/libtomcrypt")
+                                         ":" (getenv "CROSS_C_INCLUDE_PATH")))
+                  (setenv "C_INCLUDE_PATH"
+                          (string-append (search-input-directory
+                                          inputs "include/libtomcrypt")
+                                         ":" (getenv "C_INCLUDE_PATH")))))))))
+    (inputs (list libtomcrypt libtommath))
     (home-page "https://www.pycryptodome.org")
     (synopsis "Low-level cryptographic Python library")
     (description
-- 
2.38.1