]> git.pld-linux.org Git - projects/template-specs.git/blame - rust.spec
dokuwiki-plugin.spec: Fix packaging languages with rpm 4.12
[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
3ae78191 17BuildRequires: rpmbuild(macros) >= 2.004
90d6d73c 18BuildRequires: rust
26ddd9b2
ER
19BuildRequires: tar >= 1:1.22
20BuildRequires: xz
3ae78191 21ExclusiveArch: %{rust_arches}
90d6d73c
ER
22BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
23
24%description
25
26%prep
00ebcdd3 27%setup -q -b1
90d6d73c
ER
28
29# Use our offline registry
30export CARGO_HOME="$(pwd)/.cargo"
31
32mkdir -p "$CARGO_HOME"
33cat >.cargo/config <<EOF
34[source.crates-io]
35registry = 'https://github.com/rust-lang/crates.io-index'
36replace-with = 'vendored-sources'
37
38[source.vendored-sources]
39directory = '$PWD/vendor'
40EOF
41
42%build
43export CARGO_HOME="$(pwd)/.cargo"
44
3ae78191 45%cargo_build --frozen
90d6d73c
ER
46
47%install
48rm -rf $RPM_BUILD_ROOT
8811f067
ER
49export CARGO_HOME="$(pwd)/.cargo"
50
f329c346 51%cargo_install \
8811f067
ER
52 --frozen \
53 --path . \
54 --root $RPM_BUILD_ROOT%{_prefix}
55
56%{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates.toml
57%{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates2.json
90d6d73c
ER
58
59%clean
60rm -rf $RPM_BUILD_ROOT
61
62%files
63%defattr(644,root,root,755)
64%attr(755,root,root) %{_bindir}/*
This page took 0.693803 seconds and 4 git commands to generate.