summaryrefslogtreecommitdiff
path: root/packaging/rust-const-random.spec
blob: 3998bb7e9e9e3e26f54a765af20d99323a742f2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Generated by rust2rpm 23
%global _rpm_strip_disable 1
%global debug_package %{nil}

%global crate const-random
%global real_crate_name const_random
%global rustc_edition 2018

Name:           rust-const-random
Version:        0.1.15
Release:        1
Summary:        Provides compile time random number generation

License:        MIT OR Apache-2.0
URL:            https://crates.io/crates/const-random
Source:         %{crate}-%{version}.tar.gz
Source1:        %{name}.manifest
Source2:        extern.patch

# ==========================================================
# BuildRequires
# specifies build-time dependencies for the package
# ==========================================================
BuildRequires:  rust
BuildRequires:  rust-const-random-macro
BuildRequires:  rust-proc-macro-hack

Requires:       rust-const-random-macro
Requires:       rust-proc-macro-hack

%description
Provides compile time random number generation.

%prep
%setup -q
cp %{SOURCE1} .
%{__patch} -p1 < %{SOURCE2}

# ==========================================================
# build section
# crate-type : dylib, proc-macro, cdylib, bin, etc.
# ==========================================================
%build
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:%{_rust_dylibdir}
%{rustc_std_build} --crate-type=dylib \
        --crate-name=%{real_crate_name} \
        %{?rustc_edition:--edition=%{rustc_edition}} \
        ./src/lib.rs

# ==========================================================
# install section
# ==========================================================
%install
install -d -m 0755 %{buildroot}%{_rust_dylibdir}
install -m 0644 lib%{real_crate_name}.so %{buildroot}/%{_rust_dylibdir}/lib%{real_crate_name}.so

%check
%if 0%{?run_tests}
%{rustc_std_build} --test --crate-type=dylib \
        --crate-name=%{real_crate_name} \
        %{?rustc_edition:--edition=%{rustc_edition}} \
        --extern %{real_crate_name}=./lib%{real_crate_name}.so \
        ./tests/tests.rs

./%{real_crate_name}
%endif

%clean

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

# ==========================================================
# files section
# ==========================================================
%files
%manifest %{name}.manifest
%license LICENSE-APACHE
%license LICENSE-MIT
%{_rust_dylibdir}/lib%{real_crate_name}.so