gnu: rust-ring-0.14: Build source using trivial-build-system.

This removes this use of computed-origin-method.

* gnu/packages/crates-crypto.scm (rust-ring-0.14-sources): Replace use
of computed-origin-method with an actual package.

Change-Id: Ice40161411828b88321509a1cf5b07a6553f0ce7
This commit is contained in:
Efraim Flashner 2024-12-17 11:50:56 +02:00
parent 7db675130f
commit 57be7a0184
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351

View file

@ -4617,45 +4617,25 @@ Digital Signature Algorithm} (ECDSA).")
(supported-systems (list "aarch64-linux" "armhf-linux" (supported-systems (list "aarch64-linux" "armhf-linux"
"i686-linux" "x86_64-linux")))) "i686-linux" "x86_64-linux"))))
(define computed-origin-method (@@ (guix packages) computed-origin-method))
(define rust-ring-0.14-sources (define rust-ring-0.14-sources
(let* ((version "0.14.6") (package
(upstream-source (inherit rust-ring-0.17-sources)
(origin (name "rust-ring")
(version "0.14.6.tar.gz") ; Hack to adjust the output name.
(source (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://github.com/briansmith/ring") (url "https://github.com/briansmith/ring")
(commit "ef85df478152aa3fe06c811309379efa08f8a529"))) (commit "ef85df478152aa3fe06c811309379efa08f8a529")))
(file-name (git-file-name "rust-ring" version)) (file-name (git-file-name "rust-ring" version))
(sha256 (sha256
(base32 "12dgw2spvmkdypgzymw3bxpv4bbpnlq8s10sdggral31x597n6xx"))))) (base32 "12dgw2spvmkdypgzymw3bxpv4bbpnlq8s10sdggral31x597n6xx"))
(origin (snippet
(method computed-origin-method) #~(begin (use-modules (guix build utils))
(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
#+yasm
#+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 yasm works just fine here. ;; It turns out Guix's yasm works just fine here.
(substitute* "build.rs" (substitute* "build.rs"
(("yasm.exe") "yasm")) (("yasm.exe") "yasm"))
;; Files which would be deleted in a snippet: ;; These files are pregenerated:
(delete-file "third_party/fiat/curve25519_tables.h") (delete-file "third_party/fiat/curve25519_tables.h")
(delete-file "crypto/fipsmodule/ec/ecp_nistz256_table.inl") (delete-file "crypto/fipsmodule/ec/ecp_nistz256_table.inl")
(delete-file "util/ar/testdata/linux/libsample.a") (delete-file "util/ar/testdata/linux/libsample.a")
@ -4663,10 +4643,28 @@ Digital Signature Algorithm} (ECDSA).")
(delete-file "util/ar/testdata/windows/sample.lib") (delete-file "util/ar/testdata/windows/sample.lib")
;; Fix the doc tests. ;; Fix the doc tests.
(substitute* "src/ec/curve25519/ed25519/verification.rs" (substitute* "src/ec/curve25519/ed25519/verification.rs"
((";;") ";")) ((";;") ";"))))))
;; Files to be generated in the sources: (arguments
(format #t "Generating the missing files ...~%") (list
(force-output) #: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 "perl")
#+(this-package-native-input "python2-minimal")
#+(this-package-native-input "tar")
#+(this-package-native-input "yasm"))
"/bin:" 'suffix))
(setenv "HOME" (getcwd))
(copy-recursively #+source (string-append "ring-" #$version))
(with-directory-excursion (string-append "ring-" #$version)
(begin
(with-directory-excursion "third_party/fiat" (with-directory-excursion "third_party/fiat"
(with-output-to-file "curve25519_tables.h" (with-output-to-file "curve25519_tables.h"
(lambda _ (invoke "python" "make_curve25519_tables.py")))) (lambda _ (invoke "python" "make_curve25519_tables.py"))))
@ -4690,8 +4688,7 @@ Digital Signature Algorithm} (ECDSA).")
(string-append (string-append
"pregenerated/" "pregenerated/"
(string-drop-right (string-drop-right
(string-drop script (string-drop script (string-index-right script #\/)) 3)))
(string-index-right script #\/)) 3)))
(for-each (for-each
(lambda (script) (lambda (script)
@ -4808,7 +4805,10 @@ Digital Signature Algorithm} (ECDSA).")
;; avoid non-determinism in the archive ;; avoid non-determinism in the archive
"--sort=name" "--mtime=@0" "--sort=name" "--mtime=@0"
"--owner=root:0" "--group=root:0" "--owner=root:0" "--group=root:0"
(string-append "ring-" #$version)))))))))))) (string-append "ring-" #$version))))))))
(native-inputs
(list clang go gzip perl python2-minimal tar yasm))))
(define-public rust-ring-0.14 (define-public rust-ring-0.14
(package (package
(inherit rust-ring-0.16) (inherit rust-ring-0.16)
@ -4824,6 +4824,7 @@ Digital Signature Algorithm} (ECDSA).")
("rust-untrusted" ,rust-untrusted-0.6) ("rust-untrusted" ,rust-untrusted-0.6)
("rust-winapi" ,rust-winapi-0.3)))))) ("rust-winapi" ,rust-winapi-0.3))))))
(define computed-origin-method (@@ (guix packages) computed-origin-method))
(define rust-ring-0.13-sources (define rust-ring-0.13-sources
(let* ((version "0.13.5") (let* ((version "0.13.5")
(upstream-source (upstream-source