all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#60849] [PATCH core-updates 0/4] Enable cross-Compilation for python-pycryptodome
@ 2023-01-16  5:09 Maxim Cournoyer
  2023-01-16  5:13 ` [bug#60849] [PATCH core-updates 1/4] gnu: libtommath: Update to 1.2.0-0.03de03d Maxim Cournoyer
  0 siblings, 1 reply; 5+ messages in thread
From: Maxim Cournoyer @ 2023-01-16  5:09 UTC (permalink / raw)
  To: 60849; +Cc: Maxim Cournoyer

This is an example making use of the recent changes proposed for pyproject,
enabling cross compilation for the pyproject-build-system packages (see:
https://issues.guix.gnu.org/60847).  You can test it like:

./pre-inst-env guix build --target=aarch64-linux-gnu python-pycryptodome

And inspect the produced C libraries part of the package match the expected
architecture.


Maxim Cournoyer (4):
  gnu: libtommath: Update to 1.2.0-0.03de03d.
  gnu: libtomcrypt: Update to 1.18.2-0.29986d0.
  gnu: python-pycryptodome: Fix build and enable cross-compilation.
  gnu: python-coverage: Switch to pyproject-build-system.

 gnu/packages/check.scm          |   2 +-
 gnu/packages/multiprecision.scm | 179 +++++++++++---------------------
 gnu/packages/python-crypto.scm  |  20 +++-
 3 files changed, 78 insertions(+), 123 deletions(-)


base-commit: 5c921977179489caef4a9e54ada6696fc86d2f0b
-- 
2.38.1





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#60849] [PATCH core-updates 1/4] gnu: libtommath: Update to 1.2.0-0.03de03d.
  2023-01-16  5:09 [bug#60849] [PATCH core-updates 0/4] Enable cross-Compilation for python-pycryptodome Maxim Cournoyer
@ 2023-01-16  5:13 ` Maxim Cournoyer
  2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 2/4] gnu: libtomcrypt: Update to 1.18.2-0.29986d0 Maxim Cournoyer
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2023-01-16  5:13 UTC (permalink / raw)
  To: 60849; +Cc: Maxim Cournoyer

This change makes it possible to cross-compile libtommath.

* gnu/packages/multiprecision.scm (libtommath): Update to 1.2.0-0.03de03d.
[outputs]: Delete field.
[source]: Fetch from git.
[build-system]: Switch to cmake-build-system.
[arguments]: Delete prepare-build, remove-static-library, check and
install-static-library phases.  Delete #:test-target and #:make-flags
arguments.  Add #:configure-flags argument.
[native-inputs]: Delete field.
---

 gnu/packages/multiprecision.scm | 73 +++++++++++----------------------
 1 file changed, 25 insertions(+), 48 deletions(-)

diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index b96efed843..c8b4639ed7 100644
--- a/gnu/packages/multiprecision.scm
+++ b/gnu/packages/multiprecision.scm
@@ -8,7 +8,7 @@
 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
-;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,6 +39,7 @@ (define-module (gnu packages multiprecision)
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix utils)
+  #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu))
 
 (define-public gmp
@@ -439,56 +440,32 @@ (define-public libtomcrypt
     (license unlicense)))
 
 (define-public libtommath
-  (package
-    (name "libtommath")
-    (version "1.2.0")
-    (outputs '("out" "static"))
-    (source
-      (origin
-        (method url-fetch)
-        (uri (string-append "https://github.com/libtom/libtommath/releases/"
-                            "download/v" version "/ltm-" version ".tar.xz"))
-        (sha256
-         (base32
-          "1c8q1qy88cjhdjlk3g24mra94h34c1ldvkjz0n2988c0yvn5xixp"))))
-    (build-system gnu-build-system)
-    (arguments
-     '(#:phases
-       (modify-phases %standard-phases
-         (delete 'configure) ; no configure
-         (add-after 'unpack 'prepare-build
-           (lambda _
-             ;; We want the shared library by default so force it to be the
-             ;; default makefile target.
-             (delete-file "makefile")
-             (symlink "makefile.shared" "makefile")
-             #t))
-         (add-after 'install 'remove-static-library
-           (lambda* (#:key outputs #:allow-other-keys)
-             (delete-file (string-append (assoc-ref outputs "out")
-                                         "/lib/libtommath.a"))
-             #t))
-         (replace 'check
-           (lambda* (#:key test-target make-flags #:allow-other-keys)
-             (apply invoke "make" test-target make-flags)
-             (invoke "sh" "test")))
-         (add-after 'install 'install-static-library
-           (lambda* (#:key outputs #:allow-other-keys)
-             (invoke "make" "-f" "makefile.unix" "install"
-                     (string-append "PREFIX=" (assoc-ref outputs "static"))
-                     (string-append "CC=" (which "gcc"))))))
-       #:test-target "test"
-       #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
-                          "CC=gcc")))
-    (native-inputs
-     (list libtool))
-    (home-page "https://www.libtom.net/LibTomMath/")
-    (synopsis "Portable number theoretic multiple-precision integer library")
-    (description "LibTomMath is a portable number theoretic multiple-precision
+  ;; Use the latest commit, as it contains a new CMake build system capable of
+  ;; cross-compilation.
+  (let ((revision "0")
+        (commit "03de03dee753442d4b23166982514639c4ccbc39"))
+    (package
+      (name "libtommath")
+      (version (git-version "1.2.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/libtom/libtommath")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0maqzpc3f4l9b3bps8dj49b3schj3dfzvf2xcpilg8q3p1sxgrbl"))))
+      (build-system cmake-build-system)
+      (arguments (list #:configure-flags #~(list "-DBUILD_TESTING=ON"
+                                                 "-DBUILD_SHARED_LIBS=ON")))
+      (home-page "https://www.libtom.net/LibTomMath/")
+      (synopsis "Portable number theoretic multiple-precision integer library")
+      (description "LibTomMath is a portable number theoretic multiple-precision
 integer library written entirely in C.  It's designed to provide an API that is
 simple to work with that provides fairly efficient routines that build out of
 the box without configuration.")
-    (license unlicense)))
+      (license unlicense))))
 
 (define-public libtommath-1.1
   (package
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#60849] [PATCH core-updates 2/4] gnu: libtomcrypt: Update to 1.18.2-0.29986d0.
  2023-01-16  5:13 ` [bug#60849] [PATCH core-updates 1/4] gnu: libtommath: Update to 1.2.0-0.03de03d Maxim Cournoyer
@ 2023-01-16  5:13   ` Maxim Cournoyer
  2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 3/4] gnu: python-pycryptodome: Fix build and enable cross-compilation Maxim Cournoyer
  2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 4/4] gnu: python-coverage: Switch to pyproject-build-system Maxim Cournoyer
  2 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2023-01-16  5:13 UTC (permalink / raw)
  To: 60849; +Cc: Maxim Cournoyer

This change makes it possible to cross-compile libtomcrypt.

* gnu/packages/multiprecision.scm (libtomcrypt): Update to 1.18.2-0.29986d0.
[outputs]: Delete field.
[source]: Fetch from git.  Delete snippet and modules field.
[build-system]: Switch to cmake-build-system.
[phases]: Delete all phase.  Add patch-libtomcrypt.pc.in phase.
[native-inputs]: Delete field.
---

 gnu/packages/multiprecision.scm | 106 +++++++++++---------------------
 1 file changed, 35 insertions(+), 71 deletions(-)

diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index c8b4639ed7..6acf22c6d6 100644
--- a/gnu/packages/multiprecision.scm
+++ b/gnu/packages/multiprecision.scm
@@ -364,80 +364,44 @@ (define-public tomsfastmath
     (license public-domain)))
 
 (define-public libtomcrypt
-  (package
-    (name "libtomcrypt")
-    (version "1.18.2")
-    (outputs '("out" "static"))
-    (source
-      (origin
-        (method url-fetch)
-        (uri (string-append "https://github.com/libtom/libtomcrypt"
-                            "/releases/download/v" version
-                            "/crypt-" version ".tar.xz"))
-        (sha256
-         (base32
-          "113vfrgapyv72lalhd3nkw7jnks8az0gcb5wqn9hj19nhcxlrbcn"))
-        (modules '((guix build utils)))
-        (snippet
-         '(begin
-            ;; Patch CVE-2019-17362
-            ;; https://github.com/libtom/libtomcrypt/commit/25c26a3b7a9ad8192ccc923e15cf62bf0108ef94
-            (substitute* "src/pk/asn1/der/utf8/der_decode_utf8_string.c"
-              (("z > 4") "z == 1 || z > 4"))
-            #t))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (delete 'configure) ; no configure
-         (add-after 'unpack 'prepare-build
-           (lambda _
-             ;; We want the shared library by default so force it to be the
-             ;; default makefile target.
-             (delete-file "makefile")
-             (symlink "makefile.shared" "makefile")
-             ;; We link to libtommath, so we need to add it to the pc file
-             (substitute* "libtomcrypt.pc.in"
-               (("-ltomcrypt") "-ltomcrypt -ltommath"))
-             #t))
-         (add-after 'build 'build-static
-           (lambda* (#:key make-flags #:allow-other-keys)
-             (apply invoke "make" "-f" "makefile.unix" make-flags)))
-         (replace 'check
-           (lambda* (#:key test-target make-flags #:allow-other-keys)
-             (apply invoke "make" "-f" "makefile.unix" test-target make-flags)
-             (invoke "./test")))
-         (add-after 'install 'install-static-library
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (static (assoc-ref outputs "static")))
-               (mkdir-p (string-append static "/lib"))
-               (mkdir-p (string-append static "/include"))
-               (rename-file (string-append out "/lib/libtomcrypt.a")
-                            (string-append static "/lib/libtomcrypt.a"))
-               (copy-recursively (string-append out "/include")
-                                 (string-append static "/include"))
-               #t))))
-       #:test-target "test"
-       #:make-flags
-       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
-             "CFLAGS += -DLTM_DESC -DUSE_LTM"
-             (string-append "EXTRALIBS="
-                            (search-input-file %build-inputs
-                                               "/lib/libtommath.so"))
-             (string-append "CC=" ,(cc-for-target)))))
-    (native-inputs
-     (list libtool))
-    (inputs
-     (list libtommath))
-    (home-page "https://www.libtom.net/LibTomCrypt/")
-    (synopsis "Cryptographic toolkit")
-    (description "LibTomCrypt is a fairly comprehensive, modular and portable
+  ;; Use the latest commit, as it contains a new CMake build system capable of
+  ;; cross-compilation.
+  (let ((revision "0")
+        (commit "29986d04f2dca985ee64fbca1c7431ea3e3422f4"))
+    (package
+      (name "libtomcrypt")
+      (version (git-version "1.18.2" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/libtom/libtomcrypt")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "02x0h3lcl2s4zykiqwdccj8cxsbilg0lspxn8r1gmhxc3k9bgk88"))))
+      (build-system cmake-build-system)
+      (arguments
+       (list
+        #:configure-flags #~(list "-DBUILD_TESTING=ON"
+                                  "-DBUILD_SHARED_LIBS=ON")
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'patch-libtomcrypt.pc.in
+              (lambda _
+                ;; We link to libtommath, so we need to add it to the pc file
+                ;; (see: https://github.com/libtom/libtomcrypt/issues/610).
+                (substitute* "libtomcrypt.pc.in"
+                  (("-ltomcrypt") "-ltomcrypt -ltommath")))))))
+      (inputs (list libtommath))
+      (home-page "https://www.libtom.net/LibTomCrypt/")
+      (synopsis "Cryptographic toolkit")
+      (description "LibTomCrypt is a fairly comprehensive, modular and portable
 cryptographic toolkit that provides developers with a vast array of well known
 published block ciphers, one-way hash functions, chaining modes, pseudo-random
 number generators, public key cryptography and a plethora of other routines.")
-    (properties `((lint-hidden-cve . ("CVE-2019-17362"))))
-    (license unlicense)))
+      (properties `((lint-hidden-cve . ("CVE-2019-17362"))))
+      (license unlicense))))
 
 (define-public libtommath
   ;; Use the latest commit, as it contains a new CMake build system capable of
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#60849] [PATCH core-updates 3/4] gnu: python-pycryptodome: Fix build and enable cross-compilation.
  2023-01-16  5:13 ` [bug#60849] [PATCH core-updates 1/4] gnu: libtommath: Update to 1.2.0-0.03de03d Maxim Cournoyer
  2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 2/4] gnu: libtomcrypt: Update to 1.18.2-0.29986d0 Maxim Cournoyer
@ 2023-01-16  5:13   ` Maxim Cournoyer
  2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 4/4] gnu: python-coverage: Switch to pyproject-build-system Maxim Cournoyer
  2 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2023-01-16  5:13 UTC (permalink / raw)
  To: 60849; +Cc: jgart, Lars-Dominik Braun, Maxim Cournoyer

* 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





^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#60849] [PATCH core-updates 4/4] gnu: python-coverage: Switch to pyproject-build-system.
  2023-01-16  5:13 ` [bug#60849] [PATCH core-updates 1/4] gnu: libtommath: Update to 1.2.0-0.03de03d Maxim Cournoyer
  2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 2/4] gnu: libtomcrypt: Update to 1.18.2-0.29986d0 Maxim Cournoyer
  2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 3/4] gnu: python-pycryptodome: Fix build and enable cross-compilation Maxim Cournoyer
@ 2023-01-16  5:13   ` Maxim Cournoyer
  2 siblings, 0 replies; 5+ messages in thread
From: Maxim Cournoyer @ 2023-01-16  5:13 UTC (permalink / raw)
  To: 60849; +Cc: Maxim Cournoyer

* gnu/packages/check.scm (python-coverage) [build-system]: Use
pyproject-build-system.

---

 gnu/packages/check.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index aaa41777dc..3a6a0687e3 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -2004,7 +2004,7 @@ (define-public python-coverage
        (sha256
         (base32
          "16z8i18msgs8k74n73dj9x49wzkl0vk4vq8k5pl1bsj70y7b4k53"))))
-    (build-system python-build-system)
+    (build-system pyproject-build-system)
     (arguments
      ;; FIXME: 95 tests failed, 539 passed, 6 skipped, 2 errors.
      '(#:tests? #f))
-- 
2.38.1





^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-16  6:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16  5:09 [bug#60849] [PATCH core-updates 0/4] Enable cross-Compilation for python-pycryptodome Maxim Cournoyer
2023-01-16  5:13 ` [bug#60849] [PATCH core-updates 1/4] gnu: libtommath: Update to 1.2.0-0.03de03d Maxim Cournoyer
2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 2/4] gnu: libtomcrypt: Update to 1.18.2-0.29986d0 Maxim Cournoyer
2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 3/4] gnu: python-pycryptodome: Fix build and enable cross-compilation Maxim Cournoyer
2023-01-16  5:13   ` [bug#60849] [PATCH core-updates 4/4] gnu: python-coverage: Switch to pyproject-build-system Maxim Cournoyer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.