]> git.pld-linux.org Git - projects/template-specs.git/blame - rust.spec
Add .tar.xz deps
[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
26ddd9b2
ER
18BuildRequires: tar >= 1:1.22
19BuildRequires: xz
90d6d73c
ER
20BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
21
22%description
23
24%prep
25%setup -q
26
27# Use our offline registry
28export CARGO_HOME="$(pwd)/.cargo"
29
30mkdir -p "$CARGO_HOME"
31cat >.cargo/config <<EOF
32[source.crates-io]
33registry = 'https://github.com/rust-lang/crates.io-index'
34replace-with = 'vendored-sources'
35
36[source.vendored-sources]
37directory = '$PWD/vendor'
38EOF
39
40%build
41export CARGO_HOME="$(pwd)/.cargo"
42
43cargo -v build \
44%ifarch x32
45 --target x86_64-unknown-linux-gnux32 \
46%endif
47 --release \
48 --frozen
49
50%install
51rm -rf $RPM_BUILD_ROOT
52install -d $RPM_BUILD_ROOT%{_bindir}
53cp -p target/release/* $RPM_BUILD_ROOT%{_bindir}
54
55%clean
56rm -rf $RPM_BUILD_ROOT
57
58%files
59%defattr(644,root,root,755)
60%attr(755,root,root) %{_bindir}/*
This page took 0.06627 seconds and 4 git commands to generate.