From 0c0d8889c37c6ef33e0fc6945dad73173b6aab2d Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 13 Mar 2023 13:27:08 +0200 Subject: [PATCH] gnu: rust-ring-0.14: Remove pregenerated files. * gnu/packages/crates-io.scm (rust-ring-0.14)[source]: Add snippet to remove pregenerated files and add a fake .git directory. [arguments]: Add a phase to generate curve25519 tables. [native-inputs]: Add clang, python-2. --- gnu/packages/crates-io.scm | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index 6433fa347e..1f9e261a27 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -49138,7 +49138,21 @@ functionality as retain but gives mutable borrow to the predicate.") (string-append name "-" version ".tar.gz")) (sha256 (base32 - "0g091akf4dpg9qj05z3gc4nlrs57mjj2bqab98gaqp79wf3c2ss2")))) + "0g091akf4dpg9qj05z3gc4nlrs57mjj2bqab98gaqp79wf3c2ss2")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Fix the doc tests. + (substitute* "src/ec/curve25519/ed25519/verification.rs" + ((";;") ";")) + ;; Remove some generated files. + ;; Regenerating the curve25519_tables requires python2 and clang-format. + (delete-file "third_party/fiat/curve25519_tables.h") + (delete-file-recursively "pregenerated") + ;; 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) @@ -49146,7 +49160,17 @@ functionality as retain but gives mutable borrow to the predicate.") ("rust-spin" ,rust-spin-0.5) ("rust-untrusted" ,rust-untrusted-0.6) ("rust-winapi" ,rust-winapi-0.3) - ("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"))))))))) + (native-inputs + (list clang perl python-2)))) (define-public rust-ring-0.13 (package