File zsa-wally.spec of Package zsa-wally

#
# spec file for package ergodox-wally
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

%define pkg_name wally

Name:           zsa-wally
Version:        2.1.3+git17.0870ded
Release:        0
Summary:        Flash your ZSA Keyboard the EZ way
License:        MIT
Url:            https://www.zsa.io/flash/
Source:         %{pkg_name}-%{version}.tar.xz
Source1:        vendor.tar.zst
Source2:        node_modules.tar.zst
BuildRequires:  nodejs
BuildRequires:  nodejs-packaging
BuildRequires:  golang(API)
BuildRequires:  golang-packaging
BuildRequires:  pkgconfig(udev)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(webkit2gtk-4.0)
BuildRequires:  pkgconfig(libusb-1.0)
# Needed to properly install desktop files
BuildRequires:  update-desktop-files
Requires:       zsa-wally-udev-rules

%description
ZSA keyboards can do a lot — and all of that intelligence lives right on the
board. You customize the firmware online, download a file, and flash it.

%package udev-rules
Summary:        Flash your ZSA Keyboard the EZ way - udev rules
BuildArch:      noarch
Recommends:     zsa-wally
%description udev-rules
ZSA keyboards can do a lot — and all of that intelligence lives right on the
board. You customize the firmware online, download a file, and flash it.

This package holds the udev rules to grant access to the devices for configuration.

%prep
%autosetup -p1 -a1 -n %{pkg_name}-%{version}
tar xf '%{S:2}' -C frontend/

%build
pushd frontend/
env PATH="./node_modules/.bin/:${PATH}" NODE_OPTIONS='--openssl-legacy-provider' npm run build
popd
go build -mod=vendor -buildmode=pie -o dist/linux64/wally .

%install
install -D -m 0755 dist/linux64/wally  %{buildroot}%{_bindir}/wally
for rules_file in 50-oryx-legacy.rules 50-wally.rules 50-oryx.rules ; do
  install -D -m 0644 dist/linux64/${rules_file}  %{buildroot}%{_udevrulesdir}/${rules_file}
done
install -D -m 0644 dist/linux64/wally.desktop  %{buildroot}/usr/share/applications/wally.desktop
install -D -m 0644 appicon.png  %{buildroot}/usr/share/pixmaps/wally.png
%suse_update_desktop_file wally

%files
%{_bindir}/wally
%doc README.md
%license license.md
/usr/share/applications/wally.desktop
/usr/share/pixmaps/wally.png

%files udev-rules
%{_udevrulesdir}/50-wally.rules
%{_udevrulesdir}/50-oryx.rules
%{_udevrulesdir}/50-oryx-legacy.rules

%changelog
openSUSE Build Service is sponsored by