38 lines
1.2 KiB
Text
38 lines
1.2 KiB
Text
|
%__cargo %{_bindir}/cargo
|
||
|
%__cargo_common_opts --release %{?_smp_mflags}
|
||
|
|
||
|
%cargo_registry %{_usrsrc}/rust
|
||
|
|
||
|
%cargo_prep() %{expand:\
|
||
|
%{__mkdir} -p .cargo && cat > .cargo/config << EOF \
|
||
|
[build]\
|
||
|
rustc = "%{__rustc}"\
|
||
|
rustflags = %{__global_rustflags_toml}\
|
||
|
\
|
||
|
[term]\
|
||
|
verbose = true\
|
||
|
\
|
||
|
[source]\
|
||
|
\
|
||
|
[source.local-registry]\
|
||
|
directory = "%{cargo_registry}"\
|
||
|
\
|
||
|
[source.crates-io]\
|
||
|
registry = "https://crates.io"\
|
||
|
replace-with = "local-registry"\
|
||
|
EOF}
|
||
|
|
||
|
%cargo_build() %{expand:%__cargo build %{__cargo_common_opts} %{?1}}
|
||
|
|
||
|
%cargo_test() %{expand:%__cargo test %{__cargo_common_opts} %{?1}}
|
||
|
|
||
|
%cargo_install() %{expand:%__cargo install %{?_smp_mflags} \\\
|
||
|
--path . \\\
|
||
|
--root %{buildroot}%{_prefix} \\\
|
||
|
%{?1} \\\
|
||
|
&& rm %{buildroot}%{_prefix}/.crates.toml}
|
||
|
|
||
|
%cargo_install_crate() %{expand: mkdir -p %{buildroot}%{cargo_registry}/%{1} && \\\
|
||
|
%__cargo package -l | xargs cp --parents -p -t %{buildroot}%{cargo_registry}/%{1} && \\\
|
||
|
echo '{"files":{},"package":""}' >%{buildroot}%{cargo_registry}/%{1}/.cargo-checksum.json}
|