Add unittest
[platform/upstream/rust-seahash.git] / packaging / rust-seahash.spec
1 # Generated by rust2rpm 23
2 %global _rpm_strip_disable 1
3 %global debug_package %{nil}
4
5 %global crate seahash
6 %global real_crate_name seahash
7 %global rustc_edition 2015
8
9 Name:           rust-seahash
10 Version:        4.1.0
11 Release:        1
12 Summary:        Blazingly fast, portable hash function with proven statistical guarantees
13
14 License:        MIT
15 URL:            https://crates.io/crates/seahash
16 Source:         %{crate}-%{version}.tar.gz
17 Source1:        %{name}.manifest
18 Source2:        LICENSE-MIT
19
20 # ==========================================================
21 # BuildRequires
22 # specifies build-time dependencies for the package
23 # ==========================================================
24 BuildRequires:  rust
25
26 # ==========================================================
27 # dev-dependencies
28 # ==========================================================
29 # BuildRequires:  rust-criterion 
30 # BuildRequires:  rust-quickcheck 
31
32
33 %description
34 Blazingly fast, portable hash function with proven statistical guarantees.
35
36 %prep
37 %setup -q
38 cp %{SOURCE1} .
39 cp %{SOURCE2} .
40
41 # ==========================================================
42 # build section
43 # crate-type : dylib, proc-macro, cdylib, bin, etc.
44 # ==========================================================
45 %build
46 %{rustc_std_build} --crate-type=dylib \
47         --crate-name=%{real_crate_name} \
48         %{?rustc_edition:--edition=%{rustc_edition}} \
49         --cfg='feature="use_std"' \
50         ./src/lib.rs
51
52 # ==========================================================
53 # install section
54 # ==========================================================
55 %install
56 install -d -m 0755 %{buildroot}%{_rust_dylibdir}
57 install -m 0644 lib%{real_crate_name}.so %{buildroot}/%{_rust_dylibdir}/lib%{real_crate_name}.so
58
59 %check
60 %if 0%{?run_tests}
61 %{rustc_std_build} --test --crate-type=dylib \
62         --crate-name=%{real_crate_name} \
63         %{?rustc_edition:--edition=%{rustc_edition}} \
64         --cfg='feature="use_std"' \
65         ./src/lib.rs
66
67 ./%{real_crate_name}
68 %endif
69
70 %clean
71
72 %post -p /sbin/ldconfig
73
74 %postun -p /sbin/ldconfig
75
76 # ==========================================================
77 # files section
78 # ==========================================================
79 %files
80 %manifest %{name}.manifest
81 %license LICENSE-MIT
82 %{_rust_dylibdir}/lib%{real_crate_name}.so