File dust.spec of Package dust

#
# spec file for package dust
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 https://bugs.opensuse.org/
#

%if %{defined fedora}
%global debug_package %{nil}
%endif

# Use hardening ldflags.
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
Name:           dust
Version:        0.6.0
Release:        0
Summary:        Alternative du
License:        Apache-2.0
Group:          System/Console
URL:            https://github.com/bootandy/dust/
Source:         https://github.com/bootandy/dust/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# cargo vendor &&
# tar cfJ vendor.tar.xz vendor
Source1:        vendor.tar.xz
BuildRequires:  cargo
BuildRequires:  rust
BuildRequires:  rust-std-static

%description
An alternative to the du tool

%prep
%setup -q
%setup -q -D -T -a 1

mkdir .cargo
cat >.cargo/config <<EOF
[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"
EOF

%build
export RUSTFLAGS="%{rustflags}"
RUST_BACKTRACE=1 cargo build --release

%install
export RUSTFLAGS="%{rustflags}"

mkdir build
cargo install --path . --root=build
install -Dm0755 build/bin/dust %{buildroot}%{_bindir}/dust

%files
%license LICENSE
%{_bindir}/dust

%changelog
openSUSE Build Service is sponsored by