]> git.pld-linux.org Git - projects/template-specs.git/blame - rust.spec
Add rust template with crate vendoring example
[projects/template-specs.git] / rust.spec
CommitLineData
90d6d73c
ER
1Summary: Template to show how to vendor crates
2Name: rust-crate-template
3Version: 1.0
4Release: 0.1
5License: Apache v2.0
6Group: Applications
7Source0: https://github.com/NAME/NAME/archive/v%{version}/%{name}-%{version}.tar.gz
8# Source0-md5: 959298871877c4a50e8e2789d23530c7
9# cd NAME-%{version}
10# cargo vendor
11# cd ..
12# tar cJf NAME-crates-%{version}.tar.xz NAME-%{version}/{vendor,Cargo.lock}
13Source1: %{name}-crates-%{version}.tar.xz
14# Source1-md5: -
15URL: -
16BuildRequires: cargo
17BuildRequires: rust
18BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
19
20%description
21
22%prep
23%setup -q
24
25# Use our offline registry
26export CARGO_HOME="$(pwd)/.cargo"
27
28mkdir -p "$CARGO_HOME"
29cat >.cargo/config <<EOF
30[source.crates-io]
31registry = 'https://github.com/rust-lang/crates.io-index'
32replace-with = 'vendored-sources'
33
34[source.vendored-sources]
35directory = '$PWD/vendor'
36EOF
37
38%build
39export CARGO_HOME="$(pwd)/.cargo"
40
41cargo -v build \
42%ifarch x32
43 --target x86_64-unknown-linux-gnux32 \
44%endif
45 --release \
46 --frozen
47
48%install
49rm -rf $RPM_BUILD_ROOT
50install -d $RPM_BUILD_ROOT%{_bindir}
51cp -p target/release/* $RPM_BUILD_ROOT%{_bindir}
52
53%clean
54rm -rf $RPM_BUILD_ROOT
55
56%files
57%defattr(644,root,root,755)
58%attr(755,root,root) %{_bindir}/*
This page took 0.214542 seconds and 4 git commands to generate.