# Force out of source build
%undefine __cmake_in_source_build

Name:           strawberry
Version:        0.9.3
Release:        1%{?dist}
Summary:        A music player and music collection organizer
Group:          Productivity/Multimedia/Sound/Players
License:        GPL-3.0+
URL:            https://www.strawberrymusicplayer.org/
Source0:        https://github.com/strawberrymusicplayer/strawberry/archive/refs/tags/%{version}.tar.gz

%if 0%{?suse_version} && 0%{?suse_version} > 1325
BuildRequires:  libboost_headers-devel
%else
BuildRequires:  boost-devel
%endif
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  make
BuildRequires:  git
BuildRequires:  gettext
BuildRequires:  desktop-file-utils
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
%if 0%{?suse_version}
BuildRequires:  appstream-glib
%else
  %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos}
BuildRequires:  libappstream-glib
  %else
BuildRequires:  appstream-util
  %endif
%endif
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(gio-unix-2.0)
BuildRequires:  pkgconfig(gthread-2.0)
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(protobuf)
BuildRequires:  pkgconfig(sqlite3) >= 3.9
%if ! 0%{?centos} && ! 0%{?mageia}
BuildRequires:  pkgconfig(taglib)
%endif
BuildRequires:  pkgconfig(fftw3)
BuildRequires:  cmake(Qt5Core)
BuildRequires:  cmake(Qt5Gui)
BuildRequires:  cmake(Qt5Widgets)
BuildRequires:  cmake(Qt5Concurrent)
BuildRequires:  cmake(Qt5Network)
BuildRequires:  cmake(Qt5Sql)
BuildRequires:  cmake(Qt5DBus)
BuildRequires:  cmake(Qt5Test)
BuildRequires:  qt5-qtx11extras-devel
%if 0%{?suse_version} || 0%{?fedora_version} || 0%{?mageia}
BuildRequires:  cmake(Qt5LinguistTools)
%endif
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)
%if ! 0%{?centos}
BuildRequires:  pkgconfig(libchromaprint)
%endif
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libcdio)
BuildRequires:  pkgconfig(libgpod-1.0)
BuildRequires:  pkgconfig(libmtp)
%if 0%{?suse_version} || 0%{?fedora_version}
BuildRequires:  pkgconfig(libvlc)
%endif

%if 0%{?suse_version}
Requires:  libQt5Sql5-sqlite
%endif

%description
Strawberry is a music player and music collection organizer.
It is a fork of Clementine. The name is inspired by the band Strawbs.

Features:
  - Play and organize music
  - Supports WAV, FLAC, WavPack, Ogg FLAC, Ogg Vorbis, Ogg Opus, Ogg Speex,
    MPC, TrueAudio, AIFF, MP4, MP3, ASF and Monkey's Audio.
  - Audio CD playback
  - Native desktop notifications
  - Playlist management
  - Playlists in multiple formats
  - Advanced audio output and device configuration for bit-perfect playback on Linux
  - Edit tags on audio files
  - Automatically retrieve tags from MusicBrainz
  - Album cover art from Last.fm, Musicbrainz, Discogs, Musixmatch, Deezer,
Tidal, Qobuz and Spotify
  - Song lyrics from AudD, Genius, Musixmatch, ChartLyrics, lyrics.ovh and lololyrics.com
  - Support for multiple backends
  - Audio analyzer
  - Audio equalizer
  - Scrobbler with support for Last.fm, Libre.fm and ListenBrainz
  - Transfer music to mass-storage USB players, MTP compatible devices and iPod Nano/Classic
  - Streaming support for Subsonic-compatible servers
  - Unofficial streaming support for Tidal and Qobuz

%if 0%{?suse_version}
%debug_package
%endif

%prep
%setup -qn %{name}-%{version}

%build
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos}
  export CXXFLAGS="-fPIC $RPM_OPT_FLAGS"
%endif
%{cmake} -DCMAKE_BUILD_TYPE:STRING=Release -DQT_VERSION_MAJOR=5
%if 0%{?centos} || (0%{?mageia} && 0%{?mageia} <= 7)
  %make_build
%else
  %cmake_build
%endif

%install
%if 0%{?centos}
  %make_install
%else
%if 0%{?mageia}
  %make_install -C build
%else
  %cmake_install
%endif
%endif

%if 0%{?suse_version}
  %suse_update_desktop_file org.strawberrymusicplayer.strawberry Qt AudioVideo
Audio Player
%endif

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/org.strawberrymusicplayer.strawberry.desktop
%if 0%{?fedora_version}
  appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/org.strawberrymusicplayer.strawberry.appdata.xml
%else
  appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/org.strawberrymusicplayer.strawberry.appdata.xml
%endif

%files
%defattr(-,root,root,-)
%doc README.md Changelog
%license COPYING
%{_bindir}/strawberry
%{_bindir}/strawberry-tagreader
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/apps/strawberry.*
%if 0%{?fedora_version}
  %{_metainfodir}/*.appdata.xml
%else
  %{_datadir}/metainfo/*.appdata.xml
%endif
%{_mandir}/man1/%{name}.1.*
%{_mandir}/man1/%{name}-tagreader.1.*

%changelog