mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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:
parent
7db675130f
commit
57be7a0184
1 changed files with 173 additions and 172 deletions
|
@ -4617,198 +4617,198 @@ 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"))
|
;; It turns out Guix's yasm works just fine here.
|
||||||
(sha256 #f)
|
(substitute* "build.rs"
|
||||||
(uri
|
(("yasm.exe") "yasm"))
|
||||||
(delay
|
;; These files are pregenerated:
|
||||||
(with-imported-modules '((guix build utils))
|
(delete-file "third_party/fiat/curve25519_tables.h")
|
||||||
#~(begin
|
(delete-file "crypto/fipsmodule/ec/ecp_nistz256_table.inl")
|
||||||
(use-modules (guix build utils))
|
(delete-file "util/ar/testdata/linux/libsample.a")
|
||||||
(set-path-environment-variable
|
(delete-file "util/ar/testdata/mac/libsample.a")
|
||||||
"PATH" '("bin")
|
(delete-file "util/ar/testdata/windows/sample.lib")
|
||||||
(list #+(canonical-package gzip)
|
;; Fix the doc tests.
|
||||||
#+(canonical-package tar)
|
(substitute* "src/ec/curve25519/ed25519/verification.rs"
|
||||||
#+perl
|
((";;") ";"))))))
|
||||||
#+yasm
|
(arguments
|
||||||
#+go
|
(list
|
||||||
#+clang ; clang-format
|
#:modules '((guix build utils))
|
||||||
#+python2-minimal))
|
#:builder
|
||||||
(setenv "HOME" (getcwd))
|
#~(begin
|
||||||
(copy-recursively #+upstream-source
|
(use-modules (guix build utils))
|
||||||
(string-append "ring-" #$version))
|
(setenv "PATH"
|
||||||
(with-directory-excursion (string-append "ring-" #$version)
|
(string-join
|
||||||
(begin
|
(list #+(this-package-native-input "clang") ; for clang-format
|
||||||
;; It turns out Guix's yasm works just fine here.
|
#+(this-package-native-input "go")
|
||||||
(substitute* "build.rs"
|
#+(this-package-native-input "gzip")
|
||||||
(("yasm.exe") "yasm"))
|
#+(this-package-native-input "perl")
|
||||||
;; Files which would be deleted in a snippet:
|
#+(this-package-native-input "python2-minimal")
|
||||||
(delete-file "third_party/fiat/curve25519_tables.h")
|
#+(this-package-native-input "tar")
|
||||||
(delete-file "crypto/fipsmodule/ec/ecp_nistz256_table.inl")
|
#+(this-package-native-input "yasm"))
|
||||||
(delete-file "util/ar/testdata/linux/libsample.a")
|
"/bin:" 'suffix))
|
||||||
(delete-file "util/ar/testdata/mac/libsample.a")
|
|
||||||
(delete-file "util/ar/testdata/windows/sample.lib")
|
|
||||||
;; Fix the doc tests.
|
|
||||||
(substitute* "src/ec/curve25519/ed25519/verification.rs"
|
|
||||||
((";;") ";"))
|
|
||||||
;; Files to be generated in the sources:
|
|
||||||
(format #t "Generating the missing files ...~%")
|
|
||||||
(force-output)
|
|
||||||
(with-directory-excursion "third_party/fiat"
|
|
||||||
(with-output-to-file "curve25519_tables.h"
|
|
||||||
(lambda _ (invoke "python" "make_curve25519_tables.py"))))
|
|
||||||
(with-directory-excursion "crypto/fipsmodule/ec"
|
|
||||||
;; This one seems to have been changed elsewhere in the
|
|
||||||
;; sources but not in the script generating the definition.
|
|
||||||
(substitute* "make_p256-x86_64-table.go"
|
|
||||||
(("ecp_nistz256_precomputed") "GFp_nistz256_precomputed"))
|
|
||||||
(with-output-to-file "ecp_nistz256_table.inl"
|
|
||||||
(lambda _ (invoke "go" "run" "make_p256-x86_64-table.go"))))
|
|
||||||
(format #t "Generating the pregenerated files ...~%")
|
|
||||||
(force-output)
|
|
||||||
(mkdir-p "pregenerated/tmp")
|
|
||||||
|
|
||||||
;; We generate all the files which upstream would normally be
|
(setenv "HOME" (getcwd))
|
||||||
;; generate by using '(cd pregenerate_asm && cargo clean &&
|
(copy-recursively #+source (string-append "ring-" #$version))
|
||||||
;; cargo build) ./pregenerate_asm/target/debug/pregenerate_asm'
|
(with-directory-excursion (string-append "ring-" #$version)
|
||||||
;; in order to not include a dependency on cargo when
|
(begin
|
||||||
;; generating the sources.
|
(with-directory-excursion "third_party/fiat"
|
||||||
(define (prefix script)
|
(with-output-to-file "curve25519_tables.h"
|
||||||
(string-append
|
(lambda _ (invoke "python" "make_curve25519_tables.py"))))
|
||||||
"pregenerated/"
|
(with-directory-excursion "crypto/fipsmodule/ec"
|
||||||
(string-drop-right
|
;; This one seems to have been changed elsewhere in the
|
||||||
(string-drop script
|
;; sources but not in the script generating the definition.
|
||||||
(string-index-right script #\/)) 3)))
|
(substitute* "make_p256-x86_64-table.go"
|
||||||
|
(("ecp_nistz256_precomputed") "GFp_nistz256_precomputed"))
|
||||||
|
(with-output-to-file "ecp_nistz256_table.inl"
|
||||||
|
(lambda _ (invoke "go" "run" "make_p256-x86_64-table.go"))))
|
||||||
|
(format #t "Generating the pregenerated files ...~%")
|
||||||
|
(force-output)
|
||||||
|
(mkdir-p "pregenerated/tmp")
|
||||||
|
|
||||||
(for-each
|
;; We generate all the files which upstream would normally be
|
||||||
(lambda (script)
|
;; generate by using '(cd pregenerate_asm && cargo clean &&
|
||||||
(invoke "perl" script "elf"
|
;; cargo build) ./pregenerate_asm/target/debug/pregenerate_asm'
|
||||||
(string-append (prefix script) "-elf.S"))
|
;; in order to not include a dependency on cargo when
|
||||||
(invoke "perl" script "macosx"
|
;; generating the sources.
|
||||||
(string-append (prefix script) "-macosx.S"))
|
(define (prefix script)
|
||||||
(invoke "perl" script "nasm"
|
(string-append
|
||||||
(string-append
|
"pregenerated/"
|
||||||
"pregenerated/tmp/"
|
(string-drop-right
|
||||||
(string-drop (prefix script) 13) "-nasm.asm")))
|
(string-drop script (string-index-right script #\/)) 3)))
|
||||||
'("crypto/fipsmodule/aes/asm/aes-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/chacha/asm/chacha-x86_64.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/poly1305/asm/poly1305-x86_64.pl"
|
|
||||||
"crypto/fipsmodule/sha/asm/sha512-x86_64.pl"))
|
|
||||||
|
|
||||||
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
|
(for-each
|
||||||
"elf" "pregenerated/sha256-x86_64-elf.S")
|
(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/fipsmodule/aes/asm/aes-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/chacha/asm/chacha-x86_64.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/poly1305/asm/poly1305-x86_64.pl"
|
||||||
|
"crypto/fipsmodule/sha/asm/sha512-x86_64.pl"))
|
||||||
|
|
||||||
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
|
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
|
||||||
"macosx" "pregenerated/sha256-x86_64-macosx.S")
|
"elf" "pregenerated/sha256-x86_64-elf.S")
|
||||||
|
|
||||||
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
|
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
|
||||||
"nasm" "pregenerated/tmp/sha256-x86_64-nasm.asm")
|
"macosx" "pregenerated/sha256-x86_64-macosx.S")
|
||||||
|
|
||||||
(for-each
|
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-x86_64.pl"
|
||||||
(lambda (script)
|
"nasm" "pregenerated/tmp/sha256-x86_64-nasm.asm")
|
||||||
(invoke "yasm" "-X" "vc" "--dformat=cv8"
|
|
||||||
"--oformat=win64" "--machine=amd64" "-o"
|
|
||||||
(string-append (prefix script) "obj") script))
|
|
||||||
(find-files "pregenerated/tmp" "\\.asm"))
|
|
||||||
|
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (script)
|
(lambda (script)
|
||||||
(invoke "perl" script "ios64"
|
(invoke "yasm" "-X" "vc" "--dformat=cv8"
|
||||||
(string-append (prefix script) "-ios64.S"))
|
"--oformat=win64" "--machine=amd64" "-o"
|
||||||
(invoke "perl" script "linux64"
|
(string-append (prefix script) "obj") script))
|
||||||
(string-append (prefix script) "-linux64.S")))
|
(find-files "pregenerated/tmp" "\\.asm"))
|
||||||
'("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
|
|
||||||
"crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
|
|
||||||
"crypto/fipsmodule/bn/asm/armv8-mont.pl"
|
|
||||||
"crypto/chacha/asm/chacha-armv8.pl"
|
|
||||||
"crypto/fipsmodule/ec/asm/ecp_nistz256-armv8.pl"
|
|
||||||
"crypto/poly1305/asm/poly1305-armv8.pl"
|
|
||||||
"crypto/fipsmodule/sha/asm/sha512-armv8.pl"))
|
|
||||||
|
|
||||||
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
|
(for-each
|
||||||
"ios64" "pregenerated/sha256-armv8-ios64.S")
|
(lambda (script)
|
||||||
|
(invoke "perl" script "ios64"
|
||||||
|
(string-append (prefix script) "-ios64.S"))
|
||||||
|
(invoke "perl" script "linux64"
|
||||||
|
(string-append (prefix script) "-linux64.S")))
|
||||||
|
'("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
|
||||||
|
"crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
|
||||||
|
"crypto/fipsmodule/bn/asm/armv8-mont.pl"
|
||||||
|
"crypto/chacha/asm/chacha-armv8.pl"
|
||||||
|
"crypto/fipsmodule/ec/asm/ecp_nistz256-armv8.pl"
|
||||||
|
"crypto/poly1305/asm/poly1305-armv8.pl"
|
||||||
|
"crypto/fipsmodule/sha/asm/sha512-armv8.pl"))
|
||||||
|
|
||||||
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
|
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
|
||||||
"linux64" "pregenerated/sha256-armv8-linux64.S")
|
"ios64" "pregenerated/sha256-armv8-ios64.S")
|
||||||
|
|
||||||
(for-each
|
(invoke "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl"
|
||||||
(lambda (script)
|
"linux64" "pregenerated/sha256-armv8-linux64.S")
|
||||||
(invoke "perl" script "elf"
|
|
||||||
"-fPIC" "-DOPENSSL_IA32_SSE2"
|
|
||||||
(string-append (prefix script) "-elf.S"))
|
|
||||||
(invoke "perl" script "macosx"
|
|
||||||
"-fPIC" "-DOPENSSL_IA32_SSE2"
|
|
||||||
(string-append (prefix script) "-macosx.S"))
|
|
||||||
(invoke "perl" script "win32n"
|
|
||||||
"-fPIC" "-DOPENSSL_IA32_SSE2"
|
|
||||||
(string-append
|
|
||||||
"pregenerated/tmp/"
|
|
||||||
(string-drop (prefix script) 13) "-win32n.asm")))
|
|
||||||
'("crypto/fipsmodule/aes/asm/aes-586.pl"
|
|
||||||
"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/ec/asm/ecp_nistz256-x86.pl"
|
|
||||||
"crypto/fipsmodule/modes/asm/ghash-x86.pl"
|
|
||||||
"crypto/poly1305/asm/poly1305-x86.pl"
|
|
||||||
"crypto/fipsmodule/sha/asm/sha256-586.pl"
|
|
||||||
"crypto/fipsmodule/sha/asm/sha512-586.pl"))
|
|
||||||
|
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (script)
|
(lambda (script)
|
||||||
(invoke "yasm" "-X" "vc" "--dformat=cv8"
|
(invoke "perl" script "elf"
|
||||||
"--oformat=win32" "--machine=x86" "-o"
|
"-fPIC" "-DOPENSSL_IA32_SSE2"
|
||||||
(string-append (prefix script) "obj") script))
|
(string-append (prefix script) "-elf.S"))
|
||||||
(find-files "pregenerated/tmp" "-win32n\\.asm"))
|
(invoke "perl" script "macosx"
|
||||||
|
"-fPIC" "-DOPENSSL_IA32_SSE2"
|
||||||
|
(string-append (prefix script) "-macosx.S"))
|
||||||
|
(invoke "perl" script "win32n"
|
||||||
|
"-fPIC" "-DOPENSSL_IA32_SSE2"
|
||||||
|
(string-append
|
||||||
|
"pregenerated/tmp/"
|
||||||
|
(string-drop (prefix script) 13) "-win32n.asm")))
|
||||||
|
'("crypto/fipsmodule/aes/asm/aes-586.pl"
|
||||||
|
"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/ec/asm/ecp_nistz256-x86.pl"
|
||||||
|
"crypto/fipsmodule/modes/asm/ghash-x86.pl"
|
||||||
|
"crypto/poly1305/asm/poly1305-x86.pl"
|
||||||
|
"crypto/fipsmodule/sha/asm/sha256-586.pl"
|
||||||
|
"crypto/fipsmodule/sha/asm/sha512-586.pl"))
|
||||||
|
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (script)
|
(lambda (script)
|
||||||
(invoke "perl" script "ios32"
|
(invoke "yasm" "-X" "vc" "--dformat=cv8"
|
||||||
(string-append (prefix script) "-ios32.S"))
|
"--oformat=win32" "--machine=x86" "-o"
|
||||||
(invoke "perl" script "linux32"
|
(string-append (prefix script) "obj") script))
|
||||||
(string-append (prefix script) "-linux32.S")))
|
(find-files "pregenerated/tmp" "-win32n\\.asm"))
|
||||||
'("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
|
|
||||||
"crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
|
(for-each
|
||||||
"crypto/fipsmodule/aes/asm/aes-armv4.pl"
|
(lambda (script)
|
||||||
"crypto/fipsmodule/aes/asm/bsaes-armv7.pl"
|
(invoke "perl" script "ios32"
|
||||||
"crypto/fipsmodule/bn/asm/armv4-mont.pl"
|
(string-append (prefix script) "-ios32.S"))
|
||||||
"crypto/chacha/asm/chacha-armv4.pl"
|
(invoke "perl" script "linux32"
|
||||||
"crypto/fipsmodule/ec/asm/ecp_nistz256-armv4.pl"
|
(string-append (prefix script) "-linux32.S")))
|
||||||
"crypto/fipsmodule/modes/asm/ghash-armv4.pl"
|
'("crypto/fipsmodule/aes/asm/aesv8-armx.pl"
|
||||||
"crypto/poly1305/asm/poly1305-armv4.pl"
|
"crypto/fipsmodule/modes/asm/ghashv8-armx.pl"
|
||||||
"crypto/fipsmodule/sha/asm/sha256-armv4.pl"
|
"crypto/fipsmodule/aes/asm/aes-armv4.pl"
|
||||||
"crypto/fipsmodule/sha/asm/sha512-armv4.pl"))
|
"crypto/fipsmodule/aes/asm/bsaes-armv7.pl"
|
||||||
|
"crypto/fipsmodule/bn/asm/armv4-mont.pl"
|
||||||
|
"crypto/chacha/asm/chacha-armv4.pl"
|
||||||
|
"crypto/fipsmodule/ec/asm/ecp_nistz256-armv4.pl"
|
||||||
|
"crypto/fipsmodule/modes/asm/ghash-armv4.pl"
|
||||||
|
"crypto/poly1305/asm/poly1305-armv4.pl"
|
||||||
|
"crypto/fipsmodule/sha/asm/sha256-armv4.pl"
|
||||||
|
"crypto/fipsmodule/sha/asm/sha512-armv4.pl"))
|
||||||
|
|
||||||
|
(format #t "Creating the tarball ...~%")
|
||||||
|
(force-output)
|
||||||
|
;; The other option is to use cargo package --allow-dirty
|
||||||
|
(with-directory-excursion "../"
|
||||||
|
(invoke "tar" "czf" #$output
|
||||||
|
;; avoid non-determinism in the archive
|
||||||
|
"--sort=name" "--mtime=@0"
|
||||||
|
"--owner=root:0" "--group=root:0"
|
||||||
|
(string-append "ring-" #$version))))))))
|
||||||
|
(native-inputs
|
||||||
|
(list clang go gzip perl python2-minimal tar yasm))))
|
||||||
|
|
||||||
(format #t "Creating the tarball ...~%")
|
|
||||||
(force-output)
|
|
||||||
;; The other option is to use cargo package --allow-dirty
|
|
||||||
(with-directory-excursion "../"
|
|
||||||
(invoke "tar" "czf" #$output
|
|
||||||
;; avoid non-determinism in the archive
|
|
||||||
"--sort=name" "--mtime=@0"
|
|
||||||
"--owner=root:0" "--group=root:0"
|
|
||||||
(string-append "ring-" #$version))))))))))))
|
|
||||||
(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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue