Codebase list rust-stfu8 / 7f506e8
sha1-asm - allow crate to build on architectures where it is unsupported (building a dummy crate in that case) Peter Michael Green 1 year, 10 months ago
4 changed file(s) with 53 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
0 rust-sha1-asm (0.5.1-2) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Team upload.
3 * Package sha1-asm 0.5.1 from crates.io using debcargo 2.5.0
4 * Adjust upstream files to not fail build on unsupported architectures.
5 * Remove overridden debian/rules.
6
7 -- Peter Michael Green <plugwash@debian.org> Thu, 02 Jun 2022 18:18:32 +0000
8
09 rust-sha1-asm (0.5.1-1) unstable; urgency=medium
110
211 * Team upload.
0 Index: rust-sha1-asm-0.5.1/build.rs
1 ===================================================================
2 --- rust-sha1-asm-0.5.1.orig/build.rs
3 +++ rust-sha1-asm-0.5.1/build.rs
4 @@ -11,12 +11,14 @@ fn main() {
5 } else if target_arch == "aarch64" {
6 "src/aarch64.S"
7 } else {
8 - panic!("Unsupported target architecture");
9 + ""
10 };
11 let mut build = cc::Build::new();
12 if target_arch == "aarch64" {
13 build.flag("-march=armv8-a+crypto");
14 }
15 - build.flag("-c").file(asm_path).compile("libsha1.a");
16 + if asm_path != "" {
17 + build.flag("-c").file(asm_path).compile("libsha1.a");
18 + }
19 println!("dh-cargo:deb-built-using=sha1=0={}", std::env::var("CARGO_MANIFEST_DIR").unwrap());
20 }
21 Index: rust-sha1-asm-0.5.1/src/lib.rs
22 ===================================================================
23 --- rust-sha1-asm-0.5.1.orig/src/lib.rs
24 +++ rust-sha1-asm-0.5.1/src/lib.rs
25 @@ -9,15 +9,15 @@
26 //! [`sha-1`]: https://crates.io/crates/sha-1
27
28 #![no_std]
29 -#[cfg(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")))]
30 -compile_error!("crate can only be used on x86, x86_64 and AArch64 architectures");
31
32 +#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))]
33 #[link(name = "sha1", kind = "static")]
34 extern "C" {
35 fn sha1_compress(state: &mut [u32; 5], block: &[u8; 64]);
36 }
37
38 /// Safe wrapper around assembly implementation of SHA-1 compression function
39 +#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))]
40 #[inline]
41 pub fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
42 for block in blocks {
00 built-using.patch
11 relax-benches.diff
2 dont-fail-build-unsupported-architectures.patch
+0
-13
src/sha1-asm/debian/rules less more
0 #!/usr/bin/make -f
1 include /usr/share/rustc/architecture.mk
2 %:
3 dh $@ --buildsystem cargo
4
5 # Only x86 and x86_64 is supported
6 override_dh_auto_test:
7 case $(DEB_HOST_RUST_TYPE) in \
8 arm-*|x86-*|x86_64-*) \
9 dh_auto_test;; \
10 *) \
11 dh_auto_test || true;; \
12 esac