File amarok.spec of Package amarok

#
# spec file for package amarok
#
# Copyright (c) 2017 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/
#


# Make sure to require at least the version used for linking to avoid undefined symbols at runtime
%define required_libtag  %(rpm -qf `ldd $(type -P tagreader) | awk '/libtag.so.[0-9]/{ print $3 }'`)
Name:           amarok
Version:        2.8.0
Release:        0
Summary:        Media Player for KDE
License:        GPL-2.0+
Group:          Productivity/Multimedia/Sound/Players
Url:            http://amarok.kde.org/
Source0:        ftp://ftp.kde.org/pub/kde/stable/%{name}/%{version}/src/%{name}-%{version}.tar.bz2
# for reproducible builds
Source99:       %{name}.changes
# PATCH-FIX-OPENSUSE initial-preference.diff bnc#605522 llunak@novell.com -- Increase initial preference to be used for audio files instead of Kaffeine
Patch1:         initial-preference.diff
# PATCH-FIX-OPENSUSE flac_mimetype_bnc671581.diff bnc#671581 ctrippe@gmx.net -- Support for the changed mimetype for flac files
Patch2:         flac_mimetype_bnc671581.diff
# PATCH-FIX-UPSTREAM revert_solid_workaround.diff
Patch3:         revert_solid_workaround.diff
Patch4:         amarok-taglib-compare.patch
# PATCH-FIX-OPENSUSE gcc6-workaround.patch -- Workaround an errors seen by GCC6 (PR71273)
Patch5:         gcc6-workaround.patch
# PATCH-FIX-UPSTREAM 0001-Don-t-add-the-analyzer-applet-when-Phonon-doesn-t-su.patch -- avoids adding the analyzer applet on phonon backends that don't support it (e.g. vlc)
Patch100:       0001-Don-t-add-the-analyzer-applet-when-Phonon-doesn-t-su.patch
# PATCH-FIX-UPSTREAM 0002-Don-t-allow-adding-Analyzer-applet-when-not-supporte.patch -- Don't allow adding Analyzer applet when not supported.
# Also now shows an error message explaining why it can't be used.
Patch101:       0002-Don-t-allow-adding-Analyzer-applet-when-not-supporte.patch
# PATCH-FIX-UPSTREAM 0003-Optimization-Don-t-draw-more-than-necessary.patch -- optimization for Analyzer applet
Patch102:       0003-Optimization-Don-t-draw-more-than-necessary.patch
# PATCH-FIX-UPSTREAM 0004-Fix-reading-Album-Artist-Compilation-Disc-Number-in-.patch -- fixes reading APE tags (kde#323735)
Patch103:       0004-Fix-reading-Album-Artist-Compilation-Disc-Number-in-.patch
# PATCH-FIX-UPSTREAM 0005-Sync-playlist-search-config-instantly.patch -- kde#324295
Patch104:       0005-Sync-playlist-search-config-instantly.patch
# PATCH-FIX-UPSTREAM 0006-Don-t-suppress-html-tag-like-characters.patch -- kde#324614
Patch105:       0006-Don-t-suppress-html-tag-like-characters.patch
# PATCH-FIX-UPSTREAM 0007-Fix-performance-issue-with-large-podcast-feeds.patch -- kde#283022
Patch106:       0007-Fix-performance-issue-with-large-podcast-feeds.patch
# PATCH-FIX-UPSTREAM: 0008-Clean-up-the-leftover-of-strigi-removal.patch - remove unneded Strigi reference
Patch107:       0008-Clean-up-the-leftover-of-strigi-removal.patch
# PATCH-FIX-OPENSUSE 0009-Fix-Ampache-plugin-connections.patch - Unbreak Ampache plugin login (under review upstream)
Patch108:       0009-Fix-Ampache-plugin-connections.patch
# PATCH-FIX-UPSTREAM Enable_Wikipedia_over_SSL.patch boo#934730, kde#349313 - Unbreak Wikipedia applet by enabling SSL
Patch109:       Enable_Wikipedia_over_SSL.patch
Patch110:       amarok-ffmpeg3.0.patch
# PATCH-FIX-UPSTREAM Fix-for-infinite-loop-with-some-Audio-CDs.patch kde#339190 -- Fix for the infinite loop in case a home-burned or old audio CD is inserted
Patch111:       Fix-for-infinite-loop-with-some-Audio-CDs.patch
# PATCH-FIX-UPSTREAM Fix-MPRIS2-DesktopEntry-value.patch, nec essary for working media controls in taskbar plsama 5.7 -- kde#565275
Patch112:       Fix-MPRIS2-DesktopEntry-value.patch
# PATCH-FIX-UPSTREAM Fix-crash-during-musicbrainz-search.patch kde#328359 -- Fix a possible crash when looking up metadata on MusicBrainz
Patch113:       Fix-crash-during-musicbrainz-search.patch
# Required for the fdupes macro
BuildRequires:  fdupes
BuildRequires:  gdk-pixbuf-devel
BuildRequires:  libcurl-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libgpod-devel >= 0.7.0
BuildRequires:  libkde4-devel >= 4.6.0
BuildRequires:  liblastfm-devel
BuildRequires:  libmtp-devel
BuildRequires:  libmygpo-qt-devel >= 1.0.5
BuildRequires:  libmysqlclient-devel
BuildRequires:  libmysqld-devel
BuildRequires:  libofa-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libqca2-devel
BuildRequires:  libqjson-devel
BuildRequires:  libqt4-devel >= 4.8.2
BuildRequires:  libxml2-devel
BuildRequires:  loudmouth-devel
%if 0%{?is_opensuse}
BuildRequires:  breeze5-icons
%else
BuildRequires:  oxygen-icon-theme
%endif
BuildRequires:  qt4-qtscript
BuildRequires:  taglib
BuildRequires:  taglib-devel >= 1.7
BuildRequires:  taglib-extras-devel >= 1.0
BuildRequires:  tcpd-devel
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
Requires:       libtag-extras1 >= 1.0
Requires:       phonon-backend
Requires:       taglib >= 1.7
Requires(post): shared-mime-info
Requires(postun): shared-mime-info
Recommends:     %{name}-lang = %{version}
Recommends:     clamz
Recommends:     qt4-qtscript
Recommends:     kio_audiocd4
Recommends:     gstreamer-plugins-ugly
Provides:       kde4-amarok = 2.0.90
Obsoletes:      kde4-amarok <= 2.0.89
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%requires_ge  %{required_libtag}
%kde4_runtime_requires

%description
Amarok is a media player for all kinds of media. This includes MP3, Ogg
Vorbis, audio CDs, podcasts and streams. Play lists can be stored in
.m3u or .pls files.

%lang_package

%prep
: required_libtag '%{required_libtag}'
%setup -q
%patch1
%patch2
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p0
%patch111 -p1
%patch112 -p1
%patch113 -p1

# Remove build time references so build-compare can do its work
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{SOURCE99} '+%%b %%e %%Y')
sed -i "s/__DATE__/\"$FAKE_BUILDDATE\"/" src/main.cpp

%build
%ifarch ppc ppc64
export RPM_OPT_FLAGS="%{optflags} -mminimal-toc"
%endif
%cmake_kde4 -d build
%make_jobs

%install
%kde4_makeinstall -C build

# Remove *.so files (not needed), fix "devel-file-in-non-devel-package" rpmlint warning
# "libampache_account_login.so" should not be removed
rm -f %{buildroot}%{_kde4_libdir}/libamarok{core,lib,ocsclient,pud,shared,-sqlcollection,-transcoding}.so

#bnc722284 amarok is not really a good player for audio-cds, remove the action for solid
rm -f %{buildroot}%{_kde4_appsdir}/solid/actions/amarok-play-audiocd.desktop

%if 0%{?is_opensuse}
# Copy the icon for amzdownloader over from breeze
for i in 16 22 24
do
   mkdir -p %{buildroot}%{_kde4_iconsdir}/hicolor/${i}x${i}/actions
   cp %{_kde4_iconsdir}/breeze/actions/${i}/download.svg %{buildroot}%{_kde4_iconsdir}/hicolor/${i}x${i}/actions/
done
%else
# Copy the icon for amzdownloader over from oxygen
for i in 16 22 32 48
do
   mkdir -p %{buildroot}%{_kde4_iconsdir}/hicolor/${i}x${i}/actions
   cp %{_kde4_iconsdir}/oxygen/${i}x${i}/actions/download.png %{buildroot}%{_kde4_iconsdir}/hicolor/${i}x${i}/actions/
done
%endif

%suse_update_desktop_file amarok Qt KDE AudioVideo Audio Player
%suse_update_desktop_file -r amzdownloader Qt KDE AudioVideo Audio Player

%fdupes -s %{buildroot}

%find_lang amarok
%find_lang amarokcollectionscanner_qt amarok.lang
%find_lang amarokpkg amarok.lang

%kde_post_install

%post
/sbin/ldconfig
%mime_database_post

%postun
/sbin/ldconfig
%mime_database_postun

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING* ChangeLog README TODO
%{_kde4_bindir}/amarok
%{_kde4_bindir}/amarok_afttagger
%{_kde4_bindir}/amarokcollectionscanner
%{_kde4_bindir}/amarokmp3tunesharmonydaemon
%{_kde4_bindir}/amarokpkg
%{_kde4_bindir}/amzdownloader
%{_kde4_modulesdir}/amarok_*
%{_kde4_modulesdir}/kcm_amarok_service_*
%{_kde4_libdir}/libamarok-sqlcollection.so.*
%{_kde4_libdir}/libamarok-transcoding.so.*
%{_kde4_libdir}/libamarokcore.so.*
%{_kde4_libdir}/libamaroklib.so.*
%{_kde4_libdir}/libamarokocsclient.so.*
%{_kde4_libdir}/libamarokpud.so.*
%{_kde4_libdir}/libamarokshared.so.*
%{_kde4_libdir}/libampache_account_login.so
%{_kde4_libdir}/libamarok_service_lastfm_shared.so
%{_kde4_applicationsdir}/amarok.desktop
%{_kde4_applicationsdir}/amarok_containers.desktop
%{_kde4_applicationsdir}/amzdownloader.desktop
%{_datadir}/dbus-1/interfaces/org.freedesktop.MediaPlayer.player.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.MediaPlayer.root.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.MediaPlayer.tracklist.xml
%{_datadir}/dbus-1/interfaces/org.kde.amarok.App.xml
%{_datadir}/dbus-1/interfaces/org.kde.amarok.Collection.xml
%{_datadir}/dbus-1/interfaces/org.kde.amarok.Mpris1Extensions.Player.xml
%{_datadir}/dbus-1/interfaces/org.kde.amarok.Mpris2Extensions.Player.xml
%{_datadir}/mime/packages/amzdownloader.xml
%{_kde4_iconsdir}/hicolor/*/apps/amarok.*
%{_kde4_iconsdir}/hicolor/*/actions/download.*
%{_kde4_appsdir}/amarok/
%dir %{_kde4_appsdir}/desktoptheme
%dir %{_kde4_appsdir}/desktoptheme/default
%dir %{_kde4_appsdir}/desktoptheme/default/widgets
%{_kde4_appsdir}/desktoptheme/default/widgets/amarok-*
%{_kde4_appsdir}/kconf_update/amarok-2.4.1-tokens_syntax_update.pl
%{_kde4_appsdir}/kconf_update/amarok.upd
%{_kde4_sharedir}/config.kcfg/amarokconfig.kcfg
%{_kde4_configdir}/amarok*
%{_kde4_servicesdir}/ServiceMenus/amarok_append.desktop
%{_kde4_servicesdir}/amarok-*
%{_kde4_servicesdir}/amarok_*
%{_kde4_servicesdir}/amarok.protocol
%{_kde4_servicesdir}/amarok*.protocol
%{_kde4_servicetypesdir}/amarok_*

%files lang -f amarok.lang
%defattr(-,root,root,-)

%changelog