%bcond_without qt6

Name:           strawberry
Version:        1.1.2
Release:        1%{?dist}
Summary:        Audio player and music collection organizer

# Main program: GPLv3
# src/analyzer and src/engine/gstengine and src/engine/xineengine: GPLv2
# 3rdparty/taglib, src/widgets/fancytabwidget and src/widgets/stylehelper: LGPLv2
# 3rdparty/singleapplication: MIT
# 3rdparty/utf8-cpp: Boost
# src/core/timeconstants.h and ext/libstrawberry-common/core/logging and ext/libstrawberry-common/core/messagehandler: ASL 2.0
License:        GPLv2 and GPLv3+ amd LGPLv2 and ASL 2.0 and MIT and Boost
URL:            http://www.strawberrymusicplayer.org/
Source0:        https://files.strawberrymusicplayer.org/%{name}-%{version}.tar.xz


BuildRequires:  boost1.81-devel
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  libappstream-glib
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(gio-unix-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(gnutls)
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(gthread-2.0)
BuildRequires:  pkgconfig(libcdio)
BuildRequires:  pkgconfig(libchromaprint)
BuildRequires:  pkgconfig(libmtp)
BuildRequires:  pkgconfig(libnotify)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libudf)
BuildRequires:  pkgconfig(protobuf) >= 3.11
BuildRequires:  pkgconfig(libebur128)

%if %{with qt6}
BuildRequires:  cmake(Qt6Concurrent)
BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6DBus)
BuildRequires:  cmake(Qt6Gui)
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6Sql)
BuildRequires:  cmake(Qt6Test)
BuildRequires:  cmake(Qt6Widgets)
%else
BuildRequires:  cmake(Qt5Concurrent)
BuildRequires:  cmake(Qt5Core)
BuildRequires:  cmake(Qt5DBus)
BuildRequires:  cmake(Qt5Gui)
BuildRequires:  cmake(Qt5LinguistTools)
BuildRequires:  cmake(Qt5Network)
BuildRequires:  cmake(Qt5Sql)
BuildRequires:  cmake(Qt5Test)
BuildRequires:  cmake(Qt5Widgets)
BuildRequires:  cmake(Qt5X11Extras)
BuildRequires:  qt5-linguist
%endif

BuildRequires:  pkgconfig(sqlite3) >= 3.7
BuildRequires:  pkgconfig(taglib) >= 1.11
BuildRequires:  utf8cpp-devel
%ifnarch s390 s390x
BuildRequires:  pkgconfig(libgpod-1.0)
%endif

# Moodbar requires fftw
BuildRequires:  fftw-devel

# Additional features depends on raven-multimedia repo
BuildRequires:  xine-lib-devel vlc-devel

Requires:       gstreamer1-plugins-base
Requires:       gstreamer1-plugins-good
Requires:       gstreamer1-plugins-ugly
Requires:       hicolor-icon-theme 

Provides:       bundled(singleapplication)
#Provides:       bundled(taglib) = 1.12-1
#Provides:       bundled(utf8-cpp)

%description
Strawberry is a audio 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, DSF, DSDIFF, Ogg Vorbis, Speex, MPC,
    TrueAudio, AIFF, MP4, MP3 and ASF
  * Audio CD playback
  * Native desktop notifications
  * Playlists in multiple formats
  * Advanced output and device options with support for bit perfect playback
    on Linux
  * Edit tags on music files
  * Fetch tags from MusicBrainz
  * Album cover art from Last.fm, Musicbrainz and Discogs
  * Song lyrics from AudD and API Seeds
  * Support for multiple backends
  * Audio analyzer
  * Equalizer
  * Transfer music to iPod, iPhone, MTP or mass-storage USB player
  * Integrated Tidal support
  * Scrobbler with support for Last.fm, Libre.fm and ListenBrainz

%prep
%autosetup -p1

# # Remove most 3rdparty libraries
# # Unbundle taglib next release:
# # https://github.com/taglib/taglib/issues/837#issuecomment-428389347
# mv 3rdparty/singleapplication/ .
# rm -fr 3rdparty/*
# mv singleapplication/ 3rdparty/
# 
# mv 3rdparty/singleapplication/LICENSE 3rdparty/singleapplication/LICENSE-singleapplication
# #mv 3rdparty/taglib/COPYING 3rdparty/taglib/COPYING-taglib

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
export CXXFLAGS="$CFLAGS"

%{cmake} \
  -DBUILD_WERROR:BOOL=OFF \
  -DCMAKE_BUILD_TYPE:STRING=Release \
%if %{with qt6}
  -DQT_MAJOR_VERSION=6 \
%else
  -DQT_MAJOR_VERSION=5 \
%endif
  .

%cmake_build

%install
%cmake_install

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/org.strawberrymusicplayer.strawberry.desktop
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/org.strawberrymusicplayer.strawberry.appdata.xml

%files
%license COPYING
%doc Changelog
%{_bindir}/strawberry
%{_bindir}/strawberry-tagreader
%{_metainfodir}/org.strawberrymusicplayer.strawberry.appdata.xml
%{_datadir}/applications/org.strawberrymusicplayer.strawberry.desktop
%{_datadir}/icons/hicolor/*/apps/strawberry.*
%{_mandir}/man1/strawberry.1.*
%{_mandir}/man1/strawberry-tagreader.1.*

%changelog
* Fri Sep 13 2024 Raven <raven@sysadmins.ws> - 1.1.2-1
- Release 1.1.2

* Tue Jul 23 2024 Raven <raven@sysadmins.ws> - 1.1.1-1
- Release 1.1.1

* Mon Jul 15 2024 Raven <raven@sysadmins.ws> - 1.1.0-1
- Release 1.1.0

* Thu Jun 27 2024 Raven <raven@sysadmins.ws> - 1.0.23-4
- rebuilt for qt6 (el8)

* Tue May 28 2024 Raven <raven@sysadmins.ws> - 1.0.23-3
- import patch for qt 6.7+

* Mon May 20 2024 Raven <raven@sysadmins.ws> - 1.0.23-2
- rebuilt for qt6 (el8)

* Tue Feb 27 2024 Raven <raven@sysadmins.ws> - 1.0.23-1
- Release 1.0.23

* Sun Dec 24 2023 Raven <raven@sysadmins.ws> - 1.0.22-2
- rebuild for new protobuf25

* Mon Dec 18 2023 Raven <raven@sysadmins.ws> - 1.0.22-1
- Release 1.0.22

* Wed Nov 15 2023 Raven <raven@sysadmins.ws> - 1.0.21-1
- Release 1.0.21

* Fri Aug 25 2023 Raven <raven@sysadmins.ws> - 1.0.18-1
- Release 1.0.18

* Mon Apr 17 2023 Raven <raven@sysadmins.ws> - 1.0.17-1
- Release 1.0.17

* Sat Mar  4 2023 Raven <raven@sysadmins.ws> - 1.0.14-1
- Release 1.0.14

* Tue Sep 20 2022 Raven <raven@sysadmins.ws> - 1.0.9-1
- Release 1.0.9

* Thu Apr 21 2022 Raven <raven@sysadmins.ws> - 1.0.4-1
- Release 1.0.4

* Thu Feb 17 2022 Raven <raven@sysadmins.ws> - 1.0.1-1
- Release 1.0.1

* Sat Oct 23 2021 Raven <raven@sysadmins.ws> - 1.0.0-1
- Release 1.0.0

* Tue May 25 2021 Raven <raven@sysadmins.ws> - 0.9.3-1
- Release 0.9.3

* Wed Apr 15 2020 Raven <raven@sysadmins.ws> - 0.6.9-1
- Release 0.6.9

* Tue Mar 31 2020 Adrian Reber <adrian@lisas.de> - 0.6.8-3
- Rebuilt for libcdio-2.1.0

* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Sat Jan 11 19:30:20 CET 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.6.8-1
- Release 0.6.8 (#1788069)

* Thu Dec 19 2019 Orion Poplawski <orion@nwra.com> - 0.6.7-2
- Rebuild for protobuf 3.11

* Wed Dec 04 16:39:27 CET 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.6.7-1
- Release 0.6.7

* Thu Oct 10 20:22:06 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.6.5-1
- Release 0.6.5

* Wed Sep 25 19:58:52 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.6.4-1
- Release 0.6.4

* Thu Aug 08 23:06:50 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.6.3-1
- Release 0.6.3

* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sun May 05 21:55:17 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.5.5-1
- Release 0.5.5

* Sun May 05 20:10:21 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.5.4-1
- Release 0.5.4

* Fri May 03 23:14:14 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.5.3-2
- Rebuilt for new gstreamer

* Tue Apr 02 01:34:00 CET 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.5.3-1
- Release 0.5.3

* Thu Feb 21 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.5.2-2
- Remove unneeded BR

* Mon Feb 18 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.5.2-1
- Update to 0.5.2

* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Nov 30 2018 Robert-André Mauchin <zebob.m@gmail.com> - 0.4.2-1
- Release 0.4.2

* Wed Nov 21 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.4.1-3
- Rebuild for protobuf 3.6

* Fri Nov 02 2018 Robert-André Mauchin <zebob.m@gmail.com> - 0.4.1-2
- Remove extraneous Requires to qtiocompressor

* Thu Nov 01 2018 Robert-André Mauchin <zebob.m@gmail.com> - 0.4.1-1
- Release 0.4.1

* Sat Oct 20 2018 Robert-André Mauchin <zebob.m@gmail.com> - 0.3.3-1
- Initial package
