summary refs log tree commit diff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-03-13 13:32:21 +0200
committerEfraim Flashner <efraim@flashner.co.il>2023-05-07 19:29:24 +0300
commit36c12e77803b514c1124ed3be64c9a200959a687 (patch)
tree7df52f408249431ea7ce7c4889a4c19dc70cae63
parent0c0d8889c37c6ef33e0fc6945dad73173b6aab2d (diff)
downloadguix-36c12e77803b514c1124ed3be64c9a200959a687.tar.gz
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.
-rw-r--r--gnu/packages/crates-io.scm29
1 files 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 @@ functionality as retain but gives mutable borrow to the predicate.")
 
 (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 @@ functionality as retain but gives mutable borrow to the predicate.")
        (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