File easylpac.spec of Package EasyLPAC

#
# spec file for package easylpac
#
# Copyright (c) 2024 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/
#

%define build_time `date -u +'%Y-%m-%dT%H:%M:%SZ'`

Name:           easylpac
Version:        1
Release:        0
Summary:        Lpac gui frontend
License:        MIT
Group:          Hardware/Other
URL:            https://github.com/creamlike1024/EasyLPAC
Source0:        %{name}-%{version}.tar.zst
Source1:        vendor.tar.zst
Source2:        ci-registry.json
Source3:        eum-registry.json
BuildRequires:  zstd
BuildRequires:  golang-packaging
BuildRequires:  golang(API) >= 1.21
BuildRequires:  update-desktop-files

# openSUSE_Tumbleweed
%if 0%{?suse_version} > 1600
BuildRequires:  libX11-devel
BuildRequires:  libXxf86vm-devel
%else
# openSUSE_Leap
BuildRequires:  xorg-x11-devel
%endif

BuildRequires:  gtk3-devel
BuildRequires:  Mesa-libGL-devel

Requires:       lpac
Requires:       pcsc-lite
Requires:       pcsc-tools

%{?systemd_ordering}
%{go_nostrip}
%{go_provides}

%description
Lpac gui frontend, It allows you to easily manage euicc profiles
Reading LPA activation code and QRCode from clipboard not working in Wayland

%prep
%autosetup -p1 -a1
install -Dm 644 %{S:2} %{_builddir}/%{name}-%{version}/
install -Dm 644 %{S:3} %{_builddir}/%{name}-%{version}/
sed -i 's/const Version = "development"/const Version = "%{version}"/' main.go
sed -i "s/const EUICCDataVersion = \"unknown\"/const EUICCDataVersion = \"%{build_time}\"/" main.go

%build
%goprep .
%gobuild -ldflags="-s -w" ./...

%install
%goinstall
mv %{buildroot}%{_bindir}/EasyLPAC %{buildroot}%{_bindir}/%{name}
install -d %{buildroot}/%{_datadir}
install -d %{buildroot}/%{_datadir}/pixmaps/
install -Dm 644 assets/icon128.png %{buildroot}/%{_datadir}/pixmaps/%{name}.png

install -d %{buildroot}/%{_datadir}/applications
printf '%s\n' \
    '[Desktop Entry]' \
    'Name=%{name}' \
    'Comment=managing eSIM profiles on removable eUICCs' \
    'GenericName=Managing eSIM Profiles' \
    'Keywords=uicc;esim;euicc;lapc;LPAC;esay;easylpac;EasyLPAC;' \
    'Exec=/usr/bin/%{name}' \
    'Icon=%{name}' \
    'Terminal=false' \
    'Type=Application' \
    'Categories=Utility;X-SuSE-DesktopUtility;' \
    'StartupWMClass=%{name}' | \
    install -DTm 644 /dev/stdin %{buildroot}/%{_datadir}/applications/%{name}.desktop

%suse_update_desktop_file %{name}


%check
%gotest ./...

%files
%license LICENSE
%doc README.md
%{_bindir}/%{name}
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications

%changelog

openSUSE Build Service is sponsored by