1 Summary: Template to show how to vendor crates
2 Name: rust-crate-template
7 Source0: https://github.com/NAME/NAME/archive/v%{version}/%{name}-%{version}.tar.gz
8 # Source0-md5: 959298871877c4a50e8e2789d23530c7
12 # tar cJf NAME-crates-%{version}.tar.xz NAME-%{version}/{vendor,Cargo.lock}
13 Source1: %{name}-crates-%{version}.tar.xz
17 BuildRequires: rpmbuild(macros) >= 2.003
19 BuildRequires: tar >= 1:1.22
21 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
28 # Use our offline registry
29 export CARGO_HOME="$(pwd)/.cargo"
31 mkdir -p "$CARGO_HOME"
32 cat >.cargo/config <<EOF
34 registry = 'https://github.com/rust-lang/crates.io-index'
35 replace-with = 'vendored-sources'
37 [source.vendored-sources]
38 directory = '$PWD/vendor'
42 export CARGO_HOME="$(pwd)/.cargo"
46 --target x86_64-unknown-linux-gnux32 \
51 rm -rf $RPM_BUILD_ROOT
52 export CARGO_HOME="$(pwd)/.cargo"
57 --root $RPM_BUILD_ROOT%{_prefix}
59 %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates.toml
60 %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates2.json
63 rm -rf $RPM_BUILD_ROOT
66 %defattr(644,root,root,755)
67 %attr(755,root,root) %{_bindir}/*