--- /dev/null
+%debuginforustflags -C debuginfo=%{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1:2}%{!?__dic_1:0}%{expand:%%undefine __dic_%{?_enable_debug_packages}}
+%rpmrustflags %debuginforustflags
+%rust_arches %{x8664} %{ix86} x32 aarch64 armv6hl armv7hl armv7hnl
+
+%__cargo /usr/bin/cargo
+%__cargo_common_opts -v --offline
+%cargo_build \\\
+ RUSTFLAGS="${RUSTFLAGS:-%rpmrustflags}" \\\
+ %{?__jobs:CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-%{__jobs}}"} \\\
+ %{__cargo} %{__cargo_common_opts} build %{!?debug:--release} \\\
+%ifarch x32 \
+ --target x86_64-unknown-linux-gnux32 \\\
+%endif \
+%{nil}
+
+%cargo_install \\\
+ RUSTFLAGS="${RUSTFLAGS:-%rpmrustflags}" \\\
+ %{?__jobs:CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-%{__jobs}}"} \\\
+ %{__cargo} %{__cargo_common_opts} install \\\
+%ifarch x32 \
+ --target x86_64-unknown-linux-gnux32 \\\
+%endif \
+%{nil}