File lazygit.spec of Package lazygit

#
# spec file for package lazygit
#
# 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:           lazygit
Version:        0.55.0+git20250906.0d5a4101
Release:        0
Summary:        Simple terminal UI for git commands
License:        MIT
Group:          Productivity/Text/Utilities
URL:            https://github.com/jesseduffield/%{name}
Source:         %{name}-%{version}.tar.gz
Source1:        vendor.tar.gz
### Temporary until go1.22 is default
#BuildRequires:  golang-packaging
BuildRequires:  go >= 1.22
#####

%description
A simple terminal UI for git commands, written in Go with the gocui library.

%prep
%setup -q -a 1

%build
%define main_commit $(echo %{version} | awk -F+ '{print $2}' | awk -F. '{print $2}')
%define main_date $(echo %{version} | awk -F+ '{print $2}' | awk -F. '{print $1}' | tr -d 'git')
%define main_version $(echo %{version} | awk -F+ '{print $1}')
go build \
  -mod=vendor \
  -buildmode=pie \
  -ldflags "-X main.commit=%{main_commit} -X main.date=%{main_date} -X main.version=%{main_version} -X main.buildSource=OBS"

%install
install -D -m0755 %{name} %{buildroot}%{_bindir}/%{name}

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

%changelog

openSUSE Build Service is sponsored by