File clementine.spec of Package clementine

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


%define rev 1f87535c2fdaf2d70bb92783d3c05449d0f6cd24

%bcond_without git

%if 0%{?suse_version} > 1500
%bcond_without manpage
%else
%bcond_with manpage
%endif
%bcond_without qt5

Name:           clementine
Version:        1.3.1+git20181203
Release:        0
Summary:        A music player derived from Amarok 1.4
License:        GPL-3.0-or-later
Group:          Productivity/Multimedia/Sound/Players
Url:            https://clementine-player.org/
%if %{without git}
#Source:         https://github.com/clementine-player/Clementine/releases/download/%%{version}/%%{name}-%%{version}.tar.xz
%else
Source0:        https://github.com/clementine-player/Clementine/archive/%{rev}.tar.gz#/%{name}-%{version}.tar.gz
%endif
# PATCH-FEATURE-UPSTREAM uudisks2-support-for-devicemanager.patch
Patch1:         clementine-udisks-headers.patch
# PATCH-FIX-FEDORA clementine-lastscope-size.patch
Patch2:         clementine-lastscope-size.patch
# Patch fix factory build, add -fPIC to moodbar build
Patch3:         clementine-moodbar-fpic.patch
# PATCH-FIX-UPSTREAM clementine-gcc7fix.patch davejplater@gmail.com -- add <funtional> to includes.
Patch4:         clementine-gcc7fix.patch
# PATCH-FIX-OPENSUSE clementine-hidden-systray-icon.patch davejplater@gmail.com -- sys tray icon is hidden on some plasma5 systems.
Patch6:         clementine-hidden-systray-icon.patch
%if 0%{?suse_version} > 1325
BuildRequires:  libboost_headers-devel
%else
BuildRequires:  boost-devel
%endif
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  freeglut-devel
BuildRequires:  gcc-c++
BuildRequires:  gettext-tools
BuildRequires:  help2man
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
%if %{with qt5}
#BuildRequires:  pkgconfig(qca2-qt5)
BuildRequires:  libQt5Gui-private-headers-devel
BuildRequires:  liblastfm-qt5-devel
BuildRequires:  cmake(Qt5LinguistTools)
BuildRequires:  cmake(Qt5Test)
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(Qt5Xml)
BuildRequires:  pkgconfig(libmygpo-qt5)
#BuildRequires:  pkgconfig(QxtCore-qt5)
%else
BuildRequires:  liblastfm-devel
BuildRequires:  libqxt-devel
BuildRequires:  pkgconfig(QJson)
BuildRequires:  pkgconfig(QtCore)
BuildRequires:  pkgconfig(QtGui)
BuildRequires:  pkgconfig(QtSql)
%endif
BuildRequires:  pkgconfig(cryptopp)
BuildRequires:  pkgconfig(fftw3)
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gstreamer-1.0)
BuildRequires:  pkgconfig(gstreamer-app-1.0)
BuildRequires:  pkgconfig(gstreamer-audio-1.0)
BuildRequires:  pkgconfig(gstreamer-base-1.0)
BuildRequires:  pkgconfig(gstreamer-tag-1.0)
BuildRequires:  pkgconfig(libcdio)
BuildRequires:  pkgconfig(libchromaprint)
BuildRequires:  pkgconfig(libechonest)
BuildRequires:  pkgconfig(libgpod-1.0)
BuildRequires:  pkgconfig(libmtp)
BuildRequires:  pkgconfig(libnotify)
BuildRequires:  pkgconfig(libprojectM)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libsparsehash)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(protobuf)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(taglib) > 1.11.1
Requires:       libtag1 >= 1.8
%if %{without qt5}
Recommends:     sni-qt
%endif
# clementine-kde was last used in openSUSE 12.2.
# plasma_runner was dropped in Clementine 1.1.0.
Provides:       %{name}-kde = %{version}
Obsoletes:      %{name}-kde < %{version}

%description
Clementine is a music player and library organiser.

Features:
 * Search and play your local music library.
 * Listen to internet radio from Last.FM and SomaFM.
 * Edit tags on MP3 and OGG files, organise your music.
 * Native desktop notifications.

%prep
%if %{without git}
%setup -q
%else
%setup -q -n Clementine-%{rev}
rm -rvf 3rdparty/libmygpo-qt5
%endif
%patch3
%patch4
%patch1
%patch2
%patch6
# NOTE: Build using system versions of libraries.
#rm -rvf 3rdparty/taglib
#rm -rvf 3rdparty/libmygpo-qt5
#rm -rvf 3rdparty/sha2

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
export CXXFLAGS="$CFLAGS"
%cmake \
  -DBUILD_WERROR=OFF            \
  -DUSE_BUILTIN_TAGLIB=OFF      \
  -DUSE_SYSTEM_PROJECTM=ON      \
  -DBUNDLE_PROJECTM_PRESETS=OFF \
%if %{without qt5}
  -DUSE_SYSTEM_QXT=ON           \
%endif
  -DENABLE_MOODBAR=ON           \
  -DENABLE_DBUS=ON
make %{?_smp_mflags}

%install
%cmake_install

%if %{with manpage}
# Generate a man page with help2man.
mkdir -p %{buildroot}%{_mandir}/man1/
pushd %{buildroot}%{_mandir}/man1/
cp -f %{buildroot}%{_bindir}/%{name} ./
help2man --version-string="%{version}" -N -o %{name}.1 ./%{name}
rm -f %{name}
popd
%endif

%suse_update_desktop_file clementine Qt AudioVideo Audio Player

%if 0%{?suse_version} < 1500
%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif

%files
%defattr(-,root,root)
%doc Changelog README.md
%license COPYING
%{_bindir}/clementine*
%{_datadir}/applications/clementine.desktop
%{_datadir}/icons/hicolor/*/apps/clementine.*
%if %{with manpage}
%{_mandir}/man1/%{name}.1%{?ext_man}
%endif
%if %{with qt5}
%{_datadir}/metainfo/
%{_datadir}/kservices5/
%else
%dir %{_datadir}/appdata/
%{_datadir}/appdata/clementine.appdata.xml
%dir %{_datadir}/kde4/
%dir %{_datadir}/kde4/services/
%{_datadir}/kde4/services/clementine-*.protocol
%endif

%changelog
openSUSE Build Service is sponsored by