File rustfmt.spec of Package rustfmt
#
# spec file for package rustfmt
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 Luke Jones, luke.nukem.jones@gmail.com
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: rustfmt
Version: 0.9.0
Release: 0
Summary: Format Rust code according to style guide
License: MIT or Apache-2.0
Group: Development/Languages/Rust
Url: https://github.com/rust-lang-nursery/rustfmt
Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.xz
BuildRequires: cargo
BuildRequires: git
BuildRequires: rust
BuildRequires: rust-std
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
A tool for formatting Rust code according to style guidelines.
%prep
%setup -q
%setup -q -D -T -a 1
mkdir cargo-home
cat >cargo-home/config <<EOF
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = './vendor'
EOF
%build
export CARGO_HOME=`pwd`/cargo-home/
cargo build --release %{?_smp_mflags}
%install
mkdir build
export CARGO_HOME=`pwd`/cargo-home/
cargo install --root=build
mkdir -p %{buildroot}%{_bindir}
install -Dm0755 build/bin/rustfmt %{buildroot}%{_bindir}/rustfmt
install -Dm0755 build/bin/cargo-fmt %{buildroot}%{_bindir}/cargo-fmt
%files
%defattr(-,root,root)
%doc LICENSE-MIT LICENSE-APACHE README.md
%{_bindir}/rustfmt
%{_bindir}/cargo-fmt
%changelog