File duf.spec of Package duf

#
# spec file for package duf
#
# Copyright (c) 2023 SUSE LLC
#
# 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/
#


Name:           duf
Version:        0.8.1
Release:        0
Summary:        Disk space utilility written in Go
License:        MIT
Group:          System/Shells
URL:            https://github.com/muesli/duf
Source0:        https://github.com/muesli/duf/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.xz
BuildRequires:  c_compiler
BuildRequires:  golang(API)

%description
duf is a disk/usage utility and a `df` alternative for Linux, BSD, macOS, and Windows.
It has the following features:
  * User-friendly, colorful output
  * Adjusts to your terminal's theme & width
  * Sort the results according to your needs
  * Groups & filters devices
  * Can conveniently output JSON

%prep
%setup -qa1

%build
%ifarch ppc64
BUILDMOD=""
%else
BUILDMOD="-buildmode=pie"
%endif
export RPM_OPT_FLAGS="%{optflags}"
export CGO_CPPFLAGS="%{optflags}"
export CGO_CFLAGS="%{optflags}"
export CGO_CXXFLAGS="%{optflags}"
go build -v -x -mod=vendor -modcacherw -trimpath $BUILDMOD -a -ldflags "-s -X main.revision=%{version}"

%install
install -Dm0755 %{name} %{buildroot}%{_bindir}/%{name}
install -Dm0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1%{?ext_man}

%files
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1%{?ext_man}
%license LICENSE
%doc README.md

%changelog
openSUSE Build Service is sponsored by