guix_mirror_bot pushed a commit to branch gnome-team
in repository guix.

commit 7c926413462e4659fa0e5cfb04316a196d4b975e
Author: Hilton Chain <[email protected]>
AuthorDate: Sat Apr 5 12:29:53 2025 +0800

    gnu: rust-ring-0.17: Add to (gnu packages rust-sources).
    
    * gnu/packages/rust-sources.scm (rust-ring-0.17): New variable.
    * gnu/packages/rust-crates.scm (lookup-cargo-inputs)[rust-ring-0.17]: New 
entry.
    
    Change-Id: I5f01995b2570c4bbb2ecf9d11f081359f39141bc
---
 gnu/packages/rust-crates.scm  | 213 ++++++++++++++++++++++++++++++++++++++++++
 gnu/packages/rust-sources.scm | 186 +++++++++++++++++++++++++++++++++++-
 2 files changed, 398 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/rust-crates.scm b/gnu/packages/rust-crates.scm
index a2c7fcd27d..65f0c92da9 100644
--- a/gnu/packages/rust-crates.scm
+++ b/gnu/packages/rust-crates.scm
@@ -36,9 +36,222 @@
 
 (define qqqq-separator 'begin-of-crates)
 
+(define rust-bumpalo-3.17.0
+  (crate-source "bumpalo" "3.17.0"
+                "1gxxsn2fsjmv03g8p3m749mczv2k4m8xspifs5l7bcx0vx3gna0n"))
+
+(define rust-cc-1.2.18
+  (crate-source "cc" "1.2.18"
+                "0p6d2pfyrjgqpf2w399wzj4hmyffj6g0gyzg3pdy6xl3gmhlcl2j"))
+
+(define rust-cfg-if-1.0.0
+  (crate-source "cfg-if" "1.0.0"
+                "1za0vb97n4brpzpv8lsbnzmq5r8f2b0cpqqr0sy8h5bn751xxwds"))
+
+(define rust-getrandom-0.2.15
+  (crate-source "getrandom" "0.2.15"
+                "1mzlnrb3dgyd1fb84gvw10pyr8wdqdl4ry4sr64i1s8an66pqmn4"))
+
+(define rust-js-sys-0.3.77
+  (crate-source "js-sys" "0.3.77"
+                "13x2qcky5l22z4xgivi59xhjjx4kxir1zg7gcj0f1ijzd4yg7yhw"))
+
+(define rust-libc-0.2.171
+  (crate-source "libc" "0.2.171"
+                "1mipla3dy3l59pfa9xy4iw2vdgn8n30dzf4vdnasjflxdqhkg6f1"))
+
+(define rust-log-0.4.27
+  (crate-source "log" "0.4.27"
+                "150x589dqil307rv0rwj0jsgz5bjbwvl83gyl61jf873a7rjvp0k"))
+
+(define rust-minicov-0.3.7
+  (crate-source "minicov" "0.3.7"
+                "0jsvi62lklfyvdmsiizipkqcfpsc7h4c4illgxlf28iwrkqyjzzj"))
+
+(define rust-once-cell-1.21.3
+  (crate-source "once_cell" "1.21.3"
+                "0b9x77lb9f1j6nqgf5aka4s2qj0nly176bpbrv6f9iakk5ff3xa2"))
+
+(define rust-proc-macro2-1.0.94
+  (crate-source "proc-macro2" "1.0.94"
+                "114wxb56gdj9vy44q0ll3l2x9niqzcbyqikydmlb5f3h5rsp26d3"))
+
+(define rust-quote-1.0.40
+  (crate-source "quote" "1.0.40"
+                "1394cxjg6nwld82pzp2d4fp6pmaz32gai1zh9z5hvh0dawww118q"))
+
+(define rust-same-file-1.0.6
+  (crate-source "same-file" "1.0.6"
+                "00h5j1w87dmhnvbv9l8bic3y7xxsnjmssvifw2ayvgx9mb1ivz4k"))
+
+(define rust-shlex-1.3.0
+  (crate-source "shlex" "1.3.0"
+                "0r1y6bv26c1scpxvhg2cabimrmwgbp4p3wy6syj9n0c4s3q2znhg"))
+
+(define rust-spin-0.9.8
+  (crate-source "spin" "0.9.8"
+                "0rvam5r0p3a6qhc18scqpvpgb3ckzyqxpgdfyjnghh8ja7byi039"))
+
+(define rust-syn-2.0.100
+  (crate-source "syn" "2.0.100"
+                "18623wdkns03blpv65xsjn8fipl9p9hj98vlrnhin7nqran496mh"))
+
+(define rust-unicode-ident-1.0.18
+  (crate-source "unicode-ident" "1.0.18"
+                "04k5r6sijkafzljykdq26mhjpmhdx4jwzvn1lh90g9ax9903jpss"))
+
+(define rust-untrusted-0.9.0
+  (crate-source "untrusted" "0.9.0"
+                "1ha7ib98vkc538x0z60gfn0fc5whqdd85mb87dvisdcaifi6vjwf"
+                #:snippet '(delete-file-recursively "mk")))
+
+(define rust-walkdir-2.5.0
+  (crate-source "walkdir" "2.5.0"
+                "0jsy7a710qv8gld5957ybrnc07gavppp963gs32xk4ag8130jy99"
+                #:snippet '(for-each delete-file-recursively '("compare" 
"src/tests"))))
+
+(define rust-wasi-0.11.0+wasi-snapshot-preview1
+  (crate-source "wasi" "0.11.0+wasi-snapshot-preview1"
+                "08z4hxwkpdpalxjps1ai9y7ihin26y9f476i53dv98v45gkqg3cw"))
+
+(define rust-wasm-bindgen-0.2.100
+  (crate-source "wasm-bindgen" "0.2.100"
+                "1x8ymcm6yi3i1rwj78myl1agqv2m86i648myy3lc97s9swlqkp0y"))
+
+(define rust-wasm-bindgen-backend-0.2.100
+  (crate-source "wasm-bindgen-backend" "0.2.100"
+                "1ihbf1hq3y81c4md9lyh6lcwbx6a5j0fw4fygd423g62lm8hc2ig"))
+
+(define rust-wasm-bindgen-futures-0.4.50
+  (crate-source "wasm-bindgen-futures" "0.4.50"
+                "0q8ymi6i9r3vxly551dhxcyai7nc491mspj0j1wbafxwq074fpam"))
+
+(define rust-wasm-bindgen-macro-0.2.100
+  (crate-source "wasm-bindgen-macro" "0.2.100"
+                "01xls2dvzh38yj17jgrbiib1d3nyad7k2yw9s0mpklwys333zrkz"))
+
+(define rust-wasm-bindgen-macro-support-0.2.100
+  (crate-source "wasm-bindgen-macro-support" "0.2.100"
+                "1plm8dh20jg2id0320pbmrlsv6cazfv6b6907z19ys4z1jj7xs4a"))
+
+(define rust-wasm-bindgen-shared-0.2.100
+  (crate-source "wasm-bindgen-shared" "0.2.100"
+                "0gffxvqgbh9r9xl36gprkfnh3w9gl8wgia6xrin7v11sjcxxf18s"))
+
+(define rust-wasm-bindgen-test-0.3.50
+  (crate-source "wasm-bindgen-test" "0.3.50"
+                "1hsjc60wynlhgw02p32pgb93303pqmsdfxj67gxdkdm37kixbj36"))
+
+(define rust-wasm-bindgen-test-macro-0.3.50
+  (crate-source "wasm-bindgen-test-macro" "0.3.50"
+                "16znd6wz79v2i3b2sf5n4ld2kcci8br3wcx7z5c9c07sqln09m8p"))
+
+(define rust-web-sys-0.3.77
+  (crate-source "web-sys" "0.3.77"
+                "1lnmc1ffbq34qw91nndklqqm75rasaffj2g4f8h1yvqqz4pdvdik"))
+
+(define rust-winapi-util-0.1.9
+  (crate-source "winapi-util" "0.1.9"
+                "1fqhkcl9scd230cnfj8apfficpf5c9vhwnk4yy9xfc1sw69iq8ng"))
+
+(define rust-windows-aarch64-gnullvm-0.52.6
+  (crate-source "windows_aarch64_gnullvm" "0.52.6"
+                "1lrcq38cr2arvmz19v32qaggvj8bh1640mdm9c2fr877h0hn591j"
+                #:snippet '(delete-file-recursively "lib")))
+
+(define rust-windows-aarch64-msvc-0.52.6
+  (crate-source "windows_aarch64_msvc" "0.52.6"
+                "0sfl0nysnz32yyfh773hpi49b1q700ah6y7sacmjbqjjn5xjmv09"
+                #:snippet '(delete-file-recursively "lib")))
+
+(define rust-windows-i686-gnu-0.52.6
+  (crate-source "windows_i686_gnu" "0.52.6"
+                "02zspglbykh1jh9pi7gn8g1f97jh1rrccni9ivmrfbl0mgamm6wf"
+                #:snippet '(delete-file-recursively "lib")))
+
+(define rust-windows-i686-gnullvm-0.52.6
+  (crate-source "windows_i686_gnullvm" "0.52.6"
+                "0rpdx1537mw6slcpqa0rm3qixmsb79nbhqy5fsm3q2q9ik9m5vhf"
+                #:snippet '(delete-file-recursively "lib")))
+
+(define rust-windows-i686-msvc-0.52.6
+  (crate-source "windows_i686_msvc" "0.52.6"
+                "0rkcqmp4zzmfvrrrx01260q3xkpzi6fzi2x2pgdcdry50ny4h294"
+                #:snippet '(delete-file-recursively "lib")))
+
+(define rust-windows-sys-0.52.0
+  (crate-source "windows-sys" "0.52.0"
+                "0gd3v4ji88490zgb6b5mq5zgbvwv7zx1ibn8v3x83rwcdbryaar8"))
+
+(define rust-windows-sys-0.59.0
+  (crate-source "windows-sys" "0.59.0"
+                "0fw5672ziw8b3zpmnbp9pdv1famk74f1l9fcbc3zsrzdg56vqf0y"))
+
+(define rust-windows-targets-0.52.6
+  (crate-source "windows-targets" "0.52.6"
+                "0wwrx625nwlfp7k93r2rra568gad1mwd888h1jwnl0vfg5r4ywlv"))
+
+(define rust-windows-x86-64-gnu-0.52.6
+  (crate-source "windows_x86_64_gnu" "0.52.6"
+                "0y0sifqcb56a56mvn7xjgs8g43p33mfqkd8wj1yhrgxzma05qyhl"
+                #:snippet '(delete-file-recursively "lib")))
+
+(define rust-windows-x86-64-gnullvm-0.52.6
+  (crate-source "windows_x86_64_gnullvm" "0.52.6"
+                "03gda7zjx1qh8k9nnlgb7m3w3s1xkysg55hkd1wjch8pqhyv5m94"
+                #:snippet '(delete-file-recursively "lib")))
+
+(define rust-windows-x86-64-msvc-0.52.6
+  (crate-source "windows_x86_64_msvc" "0.52.6"
+                "1v7rb5cibyzx8vak29pdrk8nx9hycsjs4w0jgms08qk49jl6v7sq"
+                #:snippet '(delete-file-recursively "lib")))
+
 (define ssss-separator 'end-of-crates)
 
 
 ;;;
 ;;; Cargo inputs.
 ;;;
+
+(define-cargo-inputs lookup-cargo-inputs
+                     (rust-ring-0.17 =>
+                                     (list rust-bumpalo-3.17.0
+                                      rust-cc-1.2.18
+                                      rust-cfg-if-1.0.0
+                                      rust-getrandom-0.2.15
+                                      rust-js-sys-0.3.77
+                                      rust-libc-0.2.171
+                                      rust-log-0.4.27
+                                      rust-minicov-0.3.7
+                                      rust-once-cell-1.21.3
+                                      rust-proc-macro2-1.0.94
+                                      rust-quote-1.0.40
+                                      rust-same-file-1.0.6
+                                      rust-shlex-1.3.0
+                                      rust-spin-0.9.8
+                                      rust-syn-2.0.100
+                                      rust-unicode-ident-1.0.18
+                                      rust-untrusted-0.9.0
+                                      rust-walkdir-2.5.0
+                                      rust-wasi-0.11.0+wasi-snapshot-preview1
+                                      rust-wasm-bindgen-0.2.100
+                                      rust-wasm-bindgen-backend-0.2.100
+                                      rust-wasm-bindgen-futures-0.4.50
+                                      rust-wasm-bindgen-macro-0.2.100
+                                      rust-wasm-bindgen-macro-support-0.2.100
+                                      rust-wasm-bindgen-shared-0.2.100
+                                      rust-wasm-bindgen-test-0.3.50
+                                      rust-wasm-bindgen-test-macro-0.3.50
+                                      rust-web-sys-0.3.77
+                                      rust-winapi-util-0.1.9
+                                      rust-windows-sys-0.52.0
+                                      rust-windows-sys-0.59.0
+                                      rust-windows-targets-0.52.6
+                                      rust-windows-aarch64-gnullvm-0.52.6
+                                      rust-windows-aarch64-msvc-0.52.6
+                                      rust-windows-i686-gnu-0.52.6
+                                      rust-windows-i686-gnullvm-0.52.6
+                                      rust-windows-i686-msvc-0.52.6
+                                      rust-windows-x86-64-gnu-0.52.6
+                                      rust-windows-x86-64-gnullvm-0.52.6
+                                      rust-windows-x86-64-msvc-0.52.6)))
diff --git a/gnu/packages/rust-sources.scm b/gnu/packages/rust-sources.scm
index f8d25bbc2c..1b0cb7ab41 100644
--- a/gnu/packages/rust-sources.scm
+++ b/gnu/packages/rust-sources.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2025 Hilton Chain <[email protected]>
+;;; Copyright © 2023-2025 Efraim Flashner <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -17,13 +18,196 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages rust-sources)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
-  #:use-module (guix build-system cargo))
+  #:use-module (guix build-system cargo)
+  #:use-module (guix build-system trivial)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages assembly)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages golang)
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages python))
 
 ;;;
 ;;; Cargo workspaces and Rust libraries requiring external inputs to unbundle.
 ;;; These packages are hidden, as they are not interesting to users.
 ;;;
+
+(define-public rust-ring-0.17
+  (hidden-package
+   (package
+     (name "rust-ring")
+     (version "0.17.8")                 ;Not tagged.
+     (source (origin
+               (method git-fetch)
+               (uri (git-reference
+                     (url "https://github.com/briansmith/ring";)
+                     (commit "fa98b490bcbc99a01ff150896ec74c1813242d7f")))
+               (file-name (git-file-name "rust-ring" version))
+               (sha256
+                (base32 
"0rqfal81bf4l3dja98cajfjq2jbz1rcx7xdp2r33cxrm5y5psr28"))
+               (patches (search-patches "rust-ring-0.17-ring-core.patch"))
+               (modules '((guix build utils)))
+               (snippet
+                #~(begin
+                    ;; It turns out Guix's nasm works just fine here.
+                    (substitute* "build.rs"
+                      (("./target/tools/windows/nasm/nasm") "nasm"))
+                    ;; These files are pregenerated:
+                    (delete-file "crypto/curve25519/curve25519_tables.h")
+                    (delete-file "crypto/fipsmodule/ec/p256-nistz-table.h")
+                    (delete-file "crypto/fipsmodule/ec/p256_table.h")
+                    ;; As seen in git between 0.17.0 and 0.17.1.
+                    (substitute* "crypto/curve25519/make_curve25519_tables.py"
+                      (("static const uint8_t k25519Precomp")
+                       "const uint8_t k25519Precomp"))
+                    ;; This file causes problems during the 'package phase and
+                    ;; is not distributed with the packaged crate.
+                    (delete-file-recursively "bench")
+                    (substitute* "Cargo.toml"
+                      (("\"bench\",") ""))))))
+     (build-system cargo-build-system)
+     (arguments
+      (list
+       #:skip-build? #t
+       #:cargo-package-crates ''("ring")
+       #:phases
+       #~(modify-phases %standard-phases
+           (add-after 'unpack 'regenerate
+             (lambda _
+               (setenv "HOME" (getcwd))
+               (with-directory-excursion "crypto/curve25519"
+                 (with-output-to-file "curve25519_tables.h"
+                   (lambda _ (invoke "python3" "make_curve25519_tables.py"))))
+               (with-directory-excursion "crypto/fipsmodule/ec"
+                 (invoke "go" "run" "make_tables.go")
+                 (invoke "go" "run" "make_ec_scalar_base_mult_tests.go"))
+               (format #t "Generating the pregenerated files ...~%")
+               (force-output)
+               (mkdir-p "pregenerated/tmp/ring_core_generated")
+
+               ;; We generate all the files which upstream would normally be
+               ;; generate by using 'RING_PREGENERATE_ASM=1 cargo build
+               ;; --target-dir=target/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)))
+
+               (for-each
+                (lambda (script)
+                  (invoke "perl" script "ios64"
+                          (string-append (prefix script) "-ios64.S"))
+                  (invoke "perl" script "linux64"
+                          (string-append (prefix script) "-linux64.S"))
+                  (invoke "perl" script "win64"
+                          (string-append (prefix script) "-win64.S")))
+                '("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
+                  "crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
+                  "crypto/chacha/asm/chacha-armv8.pl"
+                  "crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl"
+                  "crypto/fipsmodule/aes/asm/vpaes-armv8.pl"
+                  "crypto/fipsmodule/bn/asm/armv8-mont.pl"
+                  "crypto/fipsmodule/ec/asm/p256-armv8-asm.pl"
+                  "crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl"
+                  "crypto/fipsmodule/modes/asm/aesv8-gcm-armv8.pl"
+                  "crypto/fipsmodule/sha/asm/sha512-armv8.pl"))
+
+               (for-each
+                (lambda (arch)
+                  (invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
+                          arch (string-append
+                                "pregenerated/sha256-armv8-" arch ".S")))
+                '("ios64" "linux64" "win64"))
+
+               (for-each
+                (lambda (script)
+                  (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/modes/asm/ghash-armv4.pl"
+                  "crypto/fipsmodule/sha/asm/sha256-armv4.pl"
+                  "crypto/fipsmodule/sha/asm/sha512-armv4.pl"))
+
+               (for-each
+                (lambda (script)
+                  (invoke "perl" script "elf"
+                          "-fPIC" "-DOPENSSL_IA32_SSE2"
+                          (string-append (prefix script) "-elf.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/modes/asm/ghash-x86.pl"))
+
+               (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/chacha/asm/chacha-x86_64.pl"
+                  "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/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"
+                       "elf" "pregenerated/sha256-x86_64-elf.S")
+
+               (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"
+                       "nasm" "pregenerated/tmp/sha256-x86_64-nasm.asm")
+
+               ;; TODO: Extract ring_core_generated/prefix_symbols_nasm.inc
+               ;; and ring_core_generated/prefix_symbols_asm.h from build.rs.
+
+               (for-each
+                (lambda (script)
+                  (invoke "nasm" "-o" (string-append (prefix script) "o")
+                          "-f" "win32" "-i" "include/" "-i" "pregenerated/tmp/"
+                          "-Xgnu" "-gcv8" script))
+                (find-files "pregenerated/tmp" "win32n\\.asm"))
+
+               (for-each
+                (lambda (script)
+                  (invoke "nasm" "-o" (string-append (prefix script) "o")
+                          "-f" "win64" "-i" "include/" "-i" "pregenerated/tmp/"
+                          "-Xgnu" "-gcv8" script))
+                (find-files "pregenerated/tmp" "nasm\\.asm")))))))
+     (native-inputs (list clang go gzip nasm perl python-minimal tar))
+     (propagated-inputs (cargo-inputs 'rust-ring-0.17))
+     (home-page "https://github.com/briansmith/ring";)
+     (synopsis "Safe, fast, small crypto using Rust")
+     (description "This package provided safe, fast, small crypto using Rust.")
+     (license (list license:isc license:openssl)))))

Reply via email to