File spotify-client.spec of Package spotify-client

#
# spec file for package spotify-client
#
# Copyright (c) 2022 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/
#

Name:           spotify-client
Summary:        Spotify music player native client
Version:        1.2.63.394.g126b0d89
Release:        1
License:        LicenseRef-proprietary:Spotify
URL:            https://www.spotify.com/legal/end-user-agreement/
ExclusiveArch:  x86_64 %{ix86}
Source0:        https://repository-origin.spotify.com/pool/non-free/s/spotify-client/spotify-client_%{version}_amd64.deb  
Source2:        spotify-wrapper
Source4:        spotify.appdata.xml
Source5:        spotify.protocol
Requires:       desktop-file-utils libasound2 libcurl4 mozilla-nss libatspi0 libayatana-appindicator3 libSM6 libXss1
BuildRequires:  desktop-file-utils
BuildRequires:  libcurl4
BuildRequires:  appstream-glib

Recommends:     ffmpeg
Recommends:     libnotify

Suggests:       zenity
# jap/kr/emote font support
Suggests:		noto-sans-kr-fonts noto-sans-jp-fonts noto-sans-cjk-fonts

Provides:       spotify = %{version}
AutoReqProv:    no

%description
Access all of your favorite music, discover new songs, and share music online with your friends,
all in one place. Create shared playlists or share individual songs with your friends with
just a click of a button. Follow your favorite artists or friends to know what they are listening to,
and then save the songs to your own playlists. Spotify is the best way to have access to millions
of songs, and all the latest hits.

%prep
%setup -q -c -T %{name}_%{version}

# unpack deb
ar x %{SOURCE0}
# unpack data
tar -xzf data.tar.gz
# remove used files
rm data.tar.gz control.tar.gz debian-binary

%build

%install
mkdir -p %{buildroot}%{_libdir}/%{name}

# Program resources - 512x512 icon along main executable is needed by the client
cp -frp \
    .%{_datadir}/spotify/*.{pak,dat,bin} \
    .%{_datadir}/spotify/{Apps,locales} \
    %{buildroot}%{_libdir}/%{name}
install -p -D -m 644 .%{_datadir}/spotify/icons/spotify-linux-512.png \
    %{buildroot}%{_libdir}/%{name}/icons/spotify-linux-512.png

# Binaries
install -p -m 755 \
    .%{_datadir}/spotify/*.so \
    .%{_datadir}/spotify/spotify \
    %{buildroot}%{_libdir}/%{name}/

# Wrapper script
mkdir -p %{buildroot}%{_bindir}
cat %{SOURCE2} | sed -e 's|INSTALL_DIR|%{_libdir}/%{name}|g' \
    > %{buildroot}%{_bindir}/spotify
chmod +x %{buildroot}%{_bindir}/spotify

# Desktop file
install -m 0644 -D -p .%{_datadir}/spotify/spotify.desktop \
    %{buildroot}%{_datadir}/applications/spotify.desktop
desktop-file-validate %{buildroot}%{_datadir}/applications/spotify.desktop

# Icons
for size in 16 22 24 32 48 64 128 256 512; do
    install -p -D -m 644 .%{_datadir}/spotify/icons/spotify-linux-${size}.png \
        %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}.png
done

mkdir -p %{buildroot}%{_datadir}/appdata
install -p -m 0644 %{SOURCE4} %{buildroot}%{_datadir}/appdata/
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/spotify.appdata.xml

# The launcher will download the native client which requires libcurl-gnutls.so.4
mkdir -p %{buildroot}%{_libdir}
ln -s -f libcurl.so.4 %{buildroot}%{_libdir}/libcurl-gnutls.so.4

# Copy protocol file for KDE
mkdir -p %{buildroot}%{_datadir}/kservices5
install -D -m 644 -p %{SOURCE5} %{buildroot}%{_datadir}/kservices5/spotify.protocol

%files
%{_bindir}/spotify
%{_datadir}/applications/spotify.desktop
%{_datadir}/icons/hicolor
%{_libdir}/%{name}
%{_libdir}/libcurl-gnutls.so.4
%{_datadir}/appdata/spotify.appdata.xml
%dir %{_datadir}/kservices5
%{_datadir}/kservices5/spotify.protocol

%changelog
openSUSE Build Service is sponsored by