Name:    yaamp
Version: 0.0.1
Release: 1%{dist}
License: MIT
Summary: Winamp-like audio player designed to be used with the Yandex.Music service

URL:     https://yaamp.ru/
Source0: https://github.com/umnik1/%{name}/archive/refs/tags/v%{version}.tar.gz
Source2: yaamp.desktop

Patch0: yaamp-disable-discord.patch
Patch1: yaamp-build-fixes.patch

BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: libstdc++-devel
BuildRequires: nodejs-devel >= 12.0
BuildRequires: npm
BuildRequires: yarnpkg
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(xtst)

%description
%{summary}.

%prep
%autosetup -p1


%build
yarn cache clean

yarn global add node-gyp

yarn --link-duplicates --pure-lockfile

yarn dist --linux


%install

mkdir -p %{buildroot}/opt
mkdir -p %{buildroot}%{_datadir}/{applications,icons/hicolor/512x512/apps}
mv artifacts/linux-unpacked %{buildroot}/opt/%{name}
install %{SOURCE2} %{buildroot}%{_datadir}/applications/yaamp.desktop
install res/icon.png %{buildroot}/%{_datadir}/icons/hicolor/512x512/apps/yaamp.png

%files
%license LICENSE
%doc README.md
/opt/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/512x512/apps/%{name}.png

%changelog
* Mon Nov 20 2023 Raven <raven@sysadmins.ws> - 0.0.1-1
- initial build