guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

385/409: gnu: rust-ring-0.16: Build source using trivial-build-system.


From: guix-commits
Subject: 385/409: gnu: rust-ring-0.16: Build source using trivial-build-system.
Date: Thu, 19 Dec 2024 02:23:03 -0500 (EST)

efraim pushed a commit to branch rust-team
in repository guix.

commit 30898e8fcab578656f3322ecd4a676feda7c12c3
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Tue Dec 17 11:42:40 2024 +0200

    gnu: rust-ring-0.16: Build source using trivial-build-system.
    
    This removes this use of computed-origin-method.
    
    * gnu/packages/crates-crypto.scm (rust-ring-0.16-sources): Replace use
    of computed-origin-method with an actual package.
    
    Change-Id: I142daa76f3c312fa6e9b46a1ef50a88e98d392dd
---
 gnu/packages/crates-crypto.scm | 311 +++++++++++++++++++++--------------------
 1 file changed, 156 insertions(+), 155 deletions(-)

diff --git a/gnu/packages/crates-crypto.scm b/gnu/packages/crates-crypto.scm
index 0cf0ecb4a4..d2dd3f8ec7 100644
--- a/gnu/packages/crates-crypto.scm
+++ b/gnu/packages/crates-crypto.scm
@@ -4417,181 +4417,181 @@ Digital Signature Algorithm} (ECDSA).")
     (description "This package provided safe, fast, small crypto using Rust.")
     (license (list license:isc license:openssl))))
 
-(define computed-origin-method (@@ (guix packages) computed-origin-method))
 (define rust-ring-0.16-sources
-  (let* ((version "0.16.20")
-         (upstream-source
-           (origin
+  (package
+    (inherit rust-ring-0.17-sources)
+    (name "rust-ring")
+    (version "0.16.20.tar.gz")  ; Hack to adjust the output name.
+    (source (origin
              (method git-fetch)
              (uri (git-reference
                     (url "https://github.com/briansmith/ring";)
                     (commit "9cc0d45f4d8521f467bb3a621e74b1535e118188")))
              (file-name (git-file-name "rust-ring" version))
              (sha256
-              (base32 
"1aps05i5308ka03968glnnqr4kdkk2x4ghlg5vrqhl78jm6ivvby")))))
-    (origin
-      (method computed-origin-method)
-      (file-name (string-append "rust-ring-" version ".tar.gz"))
-      (sha256 #f)
-      (uri
-        (delay
-          (with-imported-modules '((guix build utils))
-            #~(begin
-                (use-modules (guix build utils))
-                (set-path-environment-variable
-                  "PATH" '("bin")
-                  (list #+(canonical-package gzip)
-                        #+(canonical-package tar)
-                        #+perl
-                        #+nasm
-                        #+go
-                        #+clang             ; clang-format
-                        #+python2-minimal))
-                (setenv "HOME" (getcwd))
-                (copy-recursively #+upstream-source
-                                  (string-append "ring-" #$version))
-                (with-directory-excursion (string-append "ring-" #$version)
-                  (begin
-                    ;; It turns out Guix's nasm works just fine here.
-                    (substitute* "build.rs"
-                      (("./target/tools/nasm") "nasm"))
-                    ;; Files which would be deleted in a snippet:
-                    (delete-file "crypto/curve25519/curve25519_tables.h")
-                    (delete-file "crypto/fipsmodule/ec/ecp_nistz256_table.inl")
-                    ;; Files to be generated in the sources:
-                    (format #t "Generating the missing files ...~%")
-                    (force-output)
-                    (with-directory-excursion "crypto/curve25519"
-                      (with-output-to-file "curve25519_tables.h"
-                        (lambda _ (invoke "python" 
"make_curve25519_tables.py"))))
-                    (with-directory-excursion "crypto/fipsmodule/ec"
-                      (with-output-to-file "ecp_nistz256_table.inl"
-                        (lambda _ (invoke "go" "run" 
"make_p256-x86_64-table.go"))))
-                    (format #t "Generating the pregenerated files ...~%")
-                    (force-output)
-                    (mkdir-p "pregenerated/tmp")
+              (base32 "1aps05i5308ka03968glnnqr4kdkk2x4ghlg5vrqhl78jm6ivvby"))
+             (snippet
+              #~(begin (use-modules (guix build utils))
+                       ;; It turns out Guix's nasm works just fine here.
+                       (substitute* "build.rs"
+                         (("./target/tools/nasm") "nasm"))
+                       ;; These files are pregenerated:
+                       (delete-file "crypto/curve25519/curve25519_tables.h")
+                       (delete-file 
"crypto/fipsmodule/ec/ecp_nistz256_table.inl")))))
+    (arguments
+     (list
+       #:modules '((guix build utils))
+       #:builder
+       #~(begin
+           (use-modules (guix build utils))
+           (setenv "PATH"
+                   (string-join
+                     (list #+(this-package-native-input "clang") ; for 
clang-format
+                           #+(this-package-native-input "go")
+                           #+(this-package-native-input "gzip")
+                           #+(this-package-native-input "nasm")
+                           #+(this-package-native-input "perl")
+                           #+(this-package-native-input "python2-minimal")
+                           #+(this-package-native-input "tar"))
+                     "/bin:" 'suffix))
 
-                    ;; We generate all the files which upstream would normally 
be
-                    ;; generate by using '(cd pregenerate_asm && cargo clean &&
-                    ;; cargo build) 
./pregenerate_asm/target/debug/pregenerate_asm'
-                    ;; in order to not include a dependency on cargo when
-                    ;; generating the sources.
-                    (define (prefix script)
-                      (string-append
-                        "pregenerated/"
-                        (string-drop-right
-                          (string-drop script
-                                       (string-index-right script #\/)) 3)))
+           (setenv "HOME" (getcwd))
+           (copy-recursively #+source (string-append "ring-" #$version))
+           (with-directory-excursion (string-append "ring-" #$version)
+             (begin
+               (with-directory-excursion "crypto/curve25519"
+                 (with-output-to-file "curve25519_tables.h"
+                   (lambda _ (invoke "python" "make_curve25519_tables.py"))))
+               (with-directory-excursion "crypto/fipsmodule/ec"
+                 (with-output-to-file "ecp_nistz256_table.inl"
+                   (lambda _ (invoke "go" "run" "make_p256-x86_64-table.go"))))
+               (format #t "Generating the pregenerated files ...~%")
+               (force-output)
+               (mkdir-p "pregenerated/tmp")
 
-                    (for-each
-                      (lambda (script)
-                        (invoke "perl" script "elf"
-                                (string-append (prefix script) "-elf.S"))
-                        (invoke "perl" script "macosx"
-                                (string-append (prefix script) "-macosx.S"))
-                        (invoke "perl" script "nasm"
-                                (string-append
-                                  "pregenerated/tmp/"
-                                  (string-drop (prefix script) 13) 
"-nasm.asm")))
-                      '("crypto/fipsmodule/aes/asm/aesni-x86_64.pl"
-                        "crypto/fipsmodule/aes/asm/vpaes-x86_64.pl"
-                        "crypto/fipsmodule/bn/asm/x86_64-mont.pl"
-                        "crypto/fipsmodule/bn/asm/x86_64-mont5.pl"
-                        "crypto/chacha/asm/chacha-x86_64.pl"
-                        "crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl"
-                        "crypto/fipsmodule/modes/asm/aesni-gcm-x86_64.pl"
-                        "crypto/fipsmodule/modes/asm/ghash-x86_64.pl"
-                        "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
-                        "crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl"))
+               ;; We generate all the files which upstream would normally be
+               ;; generate by using '(cd pregenerate_asm && cargo clean &&
+               ;; cargo build) ./pregenerate_asm/target/debug/pregenerate_asm'
+               ;; in order to not include a dependency on cargo when
+               ;; generating the sources.
+               (define (prefix script)
+                 (string-append
+                   "pregenerated/"
+                   (string-drop-right
+                     (string-drop script
+                                  (string-index-right script #\/)) 3)))
 
-                    (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
-                            "elf" "pregenerated/sha256-x86_64-elf.S")
+               (for-each
+                 (lambda (script)
+                   (invoke "perl" script "elf"
+                           (string-append (prefix script) "-elf.S"))
+                   (invoke "perl" script "macosx"
+                           (string-append (prefix script) "-macosx.S"))
+                   (invoke "perl" script "nasm"
+                           (string-append
+                             "pregenerated/tmp/"
+                             (string-drop (prefix script) 13) "-nasm.asm")))
+                 '("crypto/fipsmodule/aes/asm/aesni-x86_64.pl"
+                   "crypto/fipsmodule/aes/asm/vpaes-x86_64.pl"
+                   "crypto/fipsmodule/bn/asm/x86_64-mont.pl"
+                   "crypto/fipsmodule/bn/asm/x86_64-mont5.pl"
+                   "crypto/chacha/asm/chacha-x86_64.pl"
+                   "crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl"
+                   "crypto/fipsmodule/modes/asm/aesni-gcm-x86_64.pl"
+                   "crypto/fipsmodule/modes/asm/ghash-x86_64.pl"
+                   "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
+                   "crypto/cipher_extra/asm/chacha20_poly1305_x86_64.pl"))
 
-                    (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
-                            "macosx" "pregenerated/sha256-x86_64-macosx.S")
+               (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
+                       "elf" "pregenerated/sha256-x86_64-elf.S")
 
-                    (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
-                            "nasm" "pregenerated/tmp/sha256-x86_64-nasm.asm")
+               (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
+                       "macosx" "pregenerated/sha256-x86_64-macosx.S")
 
-                    (for-each
-                      (lambda (script)
-                        (invoke "nasm" "-o" (string-append (prefix script) 
"obj")
-                                "-f" "win64" "-Xgnu" "-gcv8" script))
-                    (find-files "pregenerated/tmp" "\\.asm"))
+               (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
+                       "nasm" "pregenerated/tmp/sha256-x86_64-nasm.asm")
 
-                    (for-each
-                      (lambda (script)
-                        (invoke "perl" script "ios64"
-                                (string-append (prefix script) "-ios64.S"))
-                        (invoke "perl" script "linux64"
-                                (string-append (prefix script) "-linux64.S")))
-                      '("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
-                        "crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
-                        "crypto/fipsmodule/aes/asm/vpaes-armv8.pl"
-                        "crypto/fipsmodule/bn/asm/armv8-mont.pl"
-                        "crypto/chacha/asm/chacha-armv8.pl"
-                        "crypto/fipsmodule/ec/asm/ecp_nistz256-armv8.pl"
-                        "crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl"
-                        "crypto/fipsmodule/sha/asm/sha512-armv8.pl"))
+               (for-each
+                 (lambda (script)
+                   (invoke "nasm" "-o" (string-append (prefix script) "obj")
+                           "-f" "win64" "-Xgnu" "-gcv8" script))
+               (find-files "pregenerated/tmp" "\\.asm"))
 
-                    (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
-                            "ios64" "pregenerated/sha256-armv8-ios64.S")
+               (for-each
+                 (lambda (script)
+                   (invoke "perl" script "ios64"
+                           (string-append (prefix script) "-ios64.S"))
+                   (invoke "perl" script "linux64"
+                           (string-append (prefix script) "-linux64.S")))
+                 '("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
+                   "crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
+                   "crypto/fipsmodule/aes/asm/vpaes-armv8.pl"
+                   "crypto/fipsmodule/bn/asm/armv8-mont.pl"
+                   "crypto/chacha/asm/chacha-armv8.pl"
+                   "crypto/fipsmodule/ec/asm/ecp_nistz256-armv8.pl"
+                   "crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl"
+                   "crypto/fipsmodule/sha/asm/sha512-armv8.pl"))
 
-                    (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
-                            "linux64" "pregenerated/sha256-armv8-linux64.S")
+               (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
+                       "ios64" "pregenerated/sha256-armv8-ios64.S")
 
-                    (for-each
-                      (lambda (script)
-                        (invoke "perl" script "elf"
-                                "-fPIC" "-DOPENSSL_IA32_SSE2"
-                                (string-append (prefix script) "-elf.S"))
-                        (invoke "perl" script "macosx"
-                                "-fPIC" "-DOPENSSL_IA32_SSE2"
-                                (string-append (prefix script) "-macosx.S"))
-                        (invoke "perl" script "win32n"
-                                "-fPIC" "-DOPENSSL_IA32_SSE2"
-                                (string-append
-                                  "pregenerated/tmp/"
-                                  (string-drop (prefix script) 13) 
"-win32n.asm")))
-                      '("crypto/fipsmodule/aes/asm/aesni-x86.pl"
-                        "crypto/fipsmodule/aes/asm/vpaes-x86.pl"
-                        "crypto/fipsmodule/bn/asm/x86-mont.pl"
-                        "crypto/chacha/asm/chacha-x86.pl"
-                        "crypto/fipsmodule/ec/asm/ecp_nistz256-x86.pl"
-                        "crypto/fipsmodule/modes/asm/ghash-x86.pl"))
+               (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
+                       "linux64" "pregenerated/sha256-armv8-linux64.S")
 
-                    (for-each
-                      (lambda (script)
-                        (invoke "nasm" "-o" (string-append (prefix script) 
"obj")
-                                "-f" "win32" "-Xgnu" "-gcv8" script))
-                    (find-files "pregenerated/tmp" "-win32n\\.asm"))
+               (for-each
+                 (lambda (script)
+                   (invoke "perl" script "elf"
+                           "-fPIC" "-DOPENSSL_IA32_SSE2"
+                           (string-append (prefix script) "-elf.S"))
+                   (invoke "perl" script "macosx"
+                           "-fPIC" "-DOPENSSL_IA32_SSE2"
+                           (string-append (prefix script) "-macosx.S"))
+                   (invoke "perl" script "win32n"
+                           "-fPIC" "-DOPENSSL_IA32_SSE2"
+                           (string-append
+                             "pregenerated/tmp/"
+                             (string-drop (prefix script) 13) "-win32n.asm")))
+                 '("crypto/fipsmodule/aes/asm/aesni-x86.pl"
+                   "crypto/fipsmodule/aes/asm/vpaes-x86.pl"
+                   "crypto/fipsmodule/bn/asm/x86-mont.pl"
+                   "crypto/chacha/asm/chacha-x86.pl"
+                   "crypto/fipsmodule/ec/asm/ecp_nistz256-x86.pl"
+                   "crypto/fipsmodule/modes/asm/ghash-x86.pl"))
 
-                    (for-each
-                      (lambda (script)
-                        (invoke "perl" script "ios32"
-                                (string-append (prefix script) "-ios32.S"))
-                        (invoke "perl" script "linux32"
-                                (string-append (prefix script) "-linux32.S")))
-                      '("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
-                        "crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
-                        "crypto/fipsmodule/aes/asm/bsaes-armv7.pl"
-                        "crypto/fipsmodule/aes/asm/vpaes-armv7.pl"
-                        "crypto/fipsmodule/bn/asm/armv4-mont.pl"
-                        "crypto/chacha/asm/chacha-armv4.pl"
-                        "crypto/fipsmodule/ec/asm/ecp_nistz256-armv4.pl"
-                        "crypto/fipsmodule/modes/asm/ghash-armv4.pl"
-                        "crypto/fipsmodule/sha/asm/sha256-armv4.pl"
-                        "crypto/fipsmodule/sha/asm/sha512-armv4.pl"))
+               (for-each
+                 (lambda (script)
+                   (invoke "nasm" "-o" (string-append (prefix script) "obj")
+                           "-f" "win32" "-Xgnu" "-gcv8" script))
+               (find-files "pregenerated/tmp" "-win32n\\.asm"))
 
-                    (format #t "Creating the tarball ...~%")
-                    (force-output)
-                    ;; The other option is to use cargo package --allow-dirty
-                    (with-directory-excursion "../"
-                      (invoke "tar" "czf" #$output
-                              ;; avoid non-determinism in the archive
-                              "--sort=name" "--mtime=@0"
-                              "--owner=root:0" "--group=root:0"
-                              (string-append "ring-" #$version))))))))))))
+               (for-each
+                 (lambda (script)
+                   (invoke "perl" script "ios32"
+                           (string-append (prefix script) "-ios32.S"))
+                   (invoke "perl" script "linux32"
+                           (string-append (prefix script) "-linux32.S")))
+                 '("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
+                   "crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
+                   "crypto/fipsmodule/aes/asm/bsaes-armv7.pl"
+                   "crypto/fipsmodule/aes/asm/vpaes-armv7.pl"
+                   "crypto/fipsmodule/bn/asm/armv4-mont.pl"
+                   "crypto/chacha/asm/chacha-armv4.pl"
+                   "crypto/fipsmodule/ec/asm/ecp_nistz256-armv4.pl"
+                   "crypto/fipsmodule/modes/asm/ghash-armv4.pl"
+                   "crypto/fipsmodule/sha/asm/sha256-armv4.pl"
+                   "crypto/fipsmodule/sha/asm/sha512-armv4.pl"))
+
+               (format #t "Creating the tarball ...~%")
+               (force-output)
+               ;; The other option is to use cargo package --allow-dirty
+               (with-directory-excursion "../"
+                 (invoke "tar" "czf" #$output
+                         ;; avoid non-determinism in the archive
+                         "--sort=name" "--mtime=@0"
+                         "--owner=root:0" "--group=root:0"
+                         (string-append "ring-" #$version))))))))
+    (native-inputs
+     (list clang go gzip nasm perl python2-minimal tar))))
 
 (define-public rust-ring-0.16
   (package
@@ -4617,6 +4617,7 @@ Digital Signature Algorithm} (ECDSA).")
     (supported-systems (list "aarch64-linux" "armhf-linux"
                              "i686-linux" "x86_64-linux"))))
 
+(define computed-origin-method (@@ (guix packages) computed-origin-method))
 (define rust-ring-0.14-sources
   (let* ((version "0.14.6")
          (upstream-source



reply via email to

[Prev in Thread] Current Thread [Next in Thread]