File wego.spec of Package wego

#
# spec file for package wego
#
# Copyright (c) 2022 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:           wego
Version:        2.1
Release:        0
Summary:        Weather app for the terminal
License:        ISC
URL:            https://github.com/schachmat/wego
Source0:        https://github.com/schachmat/wego/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
BuildRequires:  golang(API) >= 1.17

%description
wego is a weather client for the terminal.

%prep
%autosetup -p1 -a1


%build
export FZF_VERSION=%{version} FZF_REVISION=tarball
export GOCACHE=$(readlink -f vendor/)
%ifarch ppc64
BUILDMOD=""
%else
BUILDMOD="-buildmode=pie"
%endif
export RPM_OPT_FLAGS="%{optflags}"
go build -v -x -mod=vendor $BUILDMOD -a -ldflags "-s -X main.revision=%{version}"

%install
install -Dm755 wego %{buildroot}%{_bindir}/wego

%check
export SHELL=/bin/sh GOOS=
export GOCACHE=$(readlink -f vendor/)
%ifarch ppc64
BUILDMOD=""
%else
BUILDMOD="-buildmode=pie"
%endif
export RPM_OPT_FLAGS="%{optflags}"
go test -v -x -mod=vendor ${BUILDMOD} -a \
    -ldflags "-X main.revision=%{version}"

%files
%doc README.md
%{_bindir}/wego
%license LICENSE

%changelog
openSUSE Build Service is sponsored by