Name:           lk-jwt-service
Group:          System/Servers
Version:        0.4.1
Release:        alt1%{?dist}
Summary:        Minimal service to issue LiveKit JWTs for MatrixRTC

License:        AGPL-3.0-only
#URL:            https://github.com/element-hq/lk-jwt-service
Source:        source/%name-%version.tar

# Vendored Go modules (directory "vendor/"), generated once with:
#   tar -xzf v%{version}.tar.gz
#   cd %{name}-%{version}
#   GOTOOLCHAIN=local go mod vendor
#   cd ..
#   tar -cJf %{name}-%{version}-vendor.tar.xz %{name}-%{version}/vendor
Source1:        source/%name-development-%version.tar

BuildRequires:  golang >= 1.23
Requires:       ca-certificates

%description
MatrixRTC Authorization Service: issues LiveKit JWTs for MatrixRTC clients.

%prep
%setup -a1

%build
# go.mod contains a "toolchain ..." directive; force using local Go toolchain (no auto-download)
export GOTOOLCHAIN=local
export GOPATH=%{_builddir}/%{name}-%{version}/_gopath
export GOCACHE=%{_builddir}/%{name}-%{version}/_gocache

go build -trimpath -buildmode=pie -mod=vendor -o %{name} .

%check
export GOTOOLCHAIN=local
export GOPATH=%{_builddir}/%{name}-%{version}/_gopath
export GOCACHE=%{_builddir}/%{name}-%{version}/_gocache

go test -mod=vendor ./...

%install
install -Dpm0755 %{name} %{buildroot}%{_bindir}/%{name}

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

%changelog
* Mon Feb 23 2026 Your Name <romenskiy2012@altlinux.ru> 0.4.1-alt1
- Initial package
