File deezer.spec of Package deezer

Name: deezer
Version: 4.21.0
Release: 0
Url: https://github.com/siphomateke/deezer
Summary: Unofficial Deezer desktop client
Group: System/GUI/KDE
BuildRequires: desktop-file-utils
BuildRequires: update-desktop-files
BuildRequires: hicolor-icon-theme
BuildRequires: -post-build-checks
BuildRequires: unzip
Requires: nodejs16
Requires: npm16
Requires: nodejs-common
License: MIT
Source0: %{name}-%{version}.tar.xz
BuildRoot: %{_tmppath}/%{name}-%{version}-build

%description
For Windows, Deezer distributes a version of the Electron run time (Windows binary) and the source code of their application itself. The build process of this package extracts the application source from the Windows installer.

This package applies several patches for:

- Compatibility with newer Electron versions
- Compatibility with a Linux environment in general.
- Fixing bugs

%build

%install
mkdir -p %{buildroot}/usr/share/%{name}/
cp -f %{SOURCE0} %{buildroot}/usr/share/%{name}/%{name}-%{version}.tar.xz

%post
if test -e /usr/share/%{name}/%{name}-%{version}.tar.xz ; then
	tar xf /usr/share/%{name}/%{name}-%{version}.tar.xz -C /
    rm -f "/usr/share/%{name}/%{name}-%{version}.tar.xz"
fi

sudo npm install -g electron@^6 --unsafe-perm=true
sudo npm install -g --engine-strict asar
sudo npm install -g prettier

sudo update-desktop-database --quiet

%preun
if [ "$1" = 0 ]; then
  rm -f "/usr/bin/%{name}"
  rm -r "/usr/share/applications/%{name}.desktop"
  rm -f "/usr/share/pixmaps/%{name}.png"
fi

%clean

%files
%defattr(-,root,root)
/usr/share/%{name}
/usr/share/%{name}/%{name}-%{version}.tar.xz

%changelog
openSUSE Build Service is sponsored by