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/
#

%global         debug_package %{nil}
%global         __strip /bin/true
%global         __requires_exclude ^(libcef\\.so.*|libwidevine.*\\.so.*|libcurl-gnutls\\.so\\..*)$
%global         __provides_exclude ^(lib.*\\.so.*)$

Name:           spotify-client
Summary:        Spotify music player native client
Version:        1.2.63.394.g126b0d89
#1.2.60.564.gcc6305cb
Release:        1
License:        https://www.spotify.com/legal/end-user-agreement
URL:            http://www.spotify.com/
ExclusiveArch:  x86_64 %{ix86}
#https://repository-origin.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.2.60.564.gcc6305cb_amd64.deb
Source0:        https://repository-origin.spotify.com/pool/non-free/s/spotify-client/spotify-client_%{version}_amd64.deb
Source2:        spotify-wrapper
Source3:        spotify.xml
Source4:        spotify.appdata.xml
Source5:        spotify.protocol
Source6:        https://github.com/dasJ/spotifywm/archive/refs/heads/master.tar.gz
Source10:       README.SUSE
BuildRequires:  firewalld
BuildRequires:  firewall-macros
BuildRequires:  hicolor-icon-theme
#BuildRequires:  chrpath
BuildRequires:  libglvnd
BuildRequires:  libX11-devel
BuildRequires:  gcc-c++
BuildRequires:  chrpath
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  desktop-file-utils
BuildRequires:  pkgconfig(appstream-glib)
BuildRequires:  libcurl-devel
Requires:       libayatana-appindicator3 libatomic1

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

Recommends:     libmp3lame0
Recommends:     ffmpeg

Provides:       spotify = %{version}

%description
Think of Spotify as your new music collection. Your library. Only this time your
collection is vast: millions of tracks and counting. Spotify comes in all shapes
and sizes, available for your PC, Mac, home audio system and mobile phone.
Wherever you go, your music follows you. And because the music plays live,
there’s no need to wait for downloads and no big dent in your hard drive.

%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

%define _use_internal_dependency_generator 0
%define __find_requires %_builddir/%{name}-%{version}/find-requires.sh
cat >%__find_requires <<'EOF'
#!/bin/sh
EOF
chmod +x %__find_requires

#chrpath -d \
#    .%{_datadir}/spotify/spotify

cp %{SOURCE10} .

%build
export CC=gcc
export CXX=g++

tar -xzf %{SOURCE6}
cd spotifywm-master

make %{?_smp_mflags}

%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

# Firewalld rules
install -D -m 644 -p %{SOURCE3} \
    %{buildroot}%{_libexecdir}/firewalld/services/spotify.xml

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

# Set kwin fix patch
mkdir -p %{buildroot}%{_libdir}/%{name}
rm -f spotifywm.so-%{version}-*.x86_64.debug
install -D -m 644 -p spotifywm-master/spotifywm.so %{buildroot}%{_libdir}/%{name}/spotifywm.so

%files
%doc README.SUSE
%{_bindir}/spotify
%{_datadir}/applications/spotify.desktop
%{_datadir}/icons/hicolor
%{_libdir}/%{name}
%{_libdir}/%{name}/spotifywm.so
%{_libdir}/libcurl-gnutls.so.4
%{_libexecdir}/firewalld/services/spotify.xml
%{_datadir}/appdata/spotify.appdata.xml
%{_datadir}/kservices5/spotify.protocol
%{_datadir}/kservices5
%if (0%{?sle_version} <= 150400 || 0%{?suse_version} <= 1550)
%{_libexecdir}/firewalld
%{_libexecdir}/firewalld/services
%endif


# Add the missing files
%{_libdir}/%{name}/Apps/login.spa
%{_libdir}/%{name}/Apps/xpui.spa
%{_libdir}/%{name}/chrome_100_percent.pak
%{_libdir}/%{name}/chrome_200_percent.pak
%{_libdir}/%{name}/icons/spotify-linux-512.png
%{_libdir}/%{name}/icudtl.dat
%{_libdir}/%{name}/libEGL.so
%{_libdir}/%{name}/libGLESv2.so
%{_libdir}/%{name}/libcef.so
%{_libdir}/%{name}/libvk_swiftshader.so
%{_libdir}/%{name}/locales/en-US.pak
%{_libdir}/%{name}/resources.pak
#%{_libdir}/%{name}/snapshot_blob.bin
%{_libdir}/%{name}/spotify
#%{_libdir}/%{name}/v8_context_snapshot.bin


%changelog
openSUSE Build Service is sponsored by