From 36c12e77803b514c1124ed3be64c9a200959a687 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 13 Mar 2023 13:32:21 +0200 Subject: [PATCH] gnu: rust-ring-0.13: Remove pregenerated files. * gnu/packages/crates-io.scm (rust-ring-0.13)[source]: Add snippet to remove pregenerated files and add a fake .git directory. [inherit]: Inherit from rust-ring-0.14. [arguments]: Add a phase to generate the curve25519 tables. --- gnu/packages/crates-io.scm | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index 1f9e261a27..3746444036 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -49174,7 +49174,7 @@ (define-public rust-ring-0.14 (define-public rust-ring-0.13 (package - (inherit rust-ring-0.16) + (inherit rust-ring-0.14) (name "rust-ring") (version "0.13.5") (source @@ -49183,15 +49183,36 @@ (define-public rust-ring-0.13 (uri (crate-uri "ring" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 - (base32 "12j580by6a438i5mw3136cj3lxylywymdr5p8rqlkwrm5s5bck9c")))) - (build-system cargo-build-system) + (base32 "12j580by6a438i5mw3136cj3lxylywymdr5p8rqlkwrm5s5bck9c")) + (modules '((guix build utils))) + (snippet + '(begin + ;; error: `...` range patterns are deprecated + (substitute* "src/digest/sha1.rs" + (("0\\.\\.\\.") "0..=")) + ;; Remove some generated files. + (delete-file-recursively "pregenerated") + ;; Regenerating the curve25519_tables requires python2 and clang-format. + (delete-file "third_party/fiat/curve25519_tables.h") + ;; Pretend this isn't a relase tarball. + (with-output-to-file ".git" + (lambda _ + (format #t ""))))))) (arguments `(#:cargo-inputs (("rust-lazy-static" ,rust-lazy-static-1) ("rust-libc" ,rust-libc-0.2) ("rust-untrusted" ,rust-untrusted-0.6) ;; build dependencies - ("rust-cc" ,rust-cc-1)))))) + ("rust-cc" ,rust-cc-1)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'generate-curve25519-tables + (lambda _ + (with-directory-excursion "third_party/fiat" + (with-output-to-file "curve25519_tables.h" + (lambda _ + (invoke "python" "make_curve25519_tables.py"))))))))))) (define-public rust-riscv-0.7 (package