## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 5;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%bcond_without tests
# Fedora 40+ ships with KDE 6, so the Qt6 build is preferred
%if 0%{?fedora} >= 40
%bcond_without qt6
%else
%bcond_with    qt6
%endif

%global giturl https://github.com/strawberrymusicplayer/strawberry

Name:           strawberry
Version:        1.0.23
Release:        %autorelease
Summary:        Audio player and music collection organizer

# Apache-2.0:
#   src/utilities/timeconstants.h
#   ext/libstrawberry-common/core/logging.{cpp,h}
#   ext/libstrawberry-common/core/messagehandler.{cpp,h}
# GPL-2.0-or-later:
#   src/engine/gstengine.{cpp,h}
# GPL-3.0-or-later:
#   everything else
License:        Apache-2.0 AND GPL-2.0-or-later AND GPL-3.0-or-later
URL:            https://www.strawberrymusicplayer.org/
Source:         %{giturl}/archive/%{version}/%{name}-%{version}.tar.gz

BuildRequires:  boost-devel
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  gcc-c++
BuildRequires:  gettext
BuildRequires:  libappstream-glib
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(fftw3)
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(gio-unix-2.0)
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-pbutils-1.0)
BuildRequires:  pkgconfig(gstreamer-tag-1.0)
BuildRequires:  pkgconfig(gthread-2.0)
BuildRequires:  pkgconfig(icu-uc)
BuildRequires:  pkgconfig(icu-i18n)
BuildRequires:  pkgconfig(libcdio)
BuildRequires:  pkgconfig(libchromaprint)
BuildRequires:  pkgconfig(libebur128)
BuildRequires:  pkgconfig(libmtp)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libvlc)
BuildRequires:  pkgconfig(protobuf)
BuildRequires:  pkgconfig(sqlite3) >= 3.7
BuildRequires:  pkgconfig(taglib) >= 1.11
%ifnarch s390 s390x
BuildRequires:  pkgconfig(libgpod-1.0)
%endif

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

%if %{with tests}
BuildRequires:  cmake(GTest)
BuildRequires:  pkgconfig(gmock)
%endif

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

%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 unneeded 3rdparty to ensure they don't get accidentally bundled
rm -rf 3rdparty

%if %{with tests}
# Disable tests that need graphical environment and thus don't work in mock
sed -i '/add_test_file(.* true)/d' tests/CMakeLists.txt
%endif

%build
%{cmake} -DBUILD_WERROR:BOOL=OFF \
%if %{with qt6}
         -DBUILD_WITH_QT6=ON \
%else
         -DBUILD_WITH_QT5=ON \
%endif
         -DCMAKE_BUILD_TYPE:STRING=Release
%cmake_build

%install
%cmake_install

%check
%if %{with tests}
%{cmake_build} -t run_strawberry_tests
%endif

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
## START: Generated by rpmautospec
* Wed Jul 03 2024 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.23-5
- Enable the libvlc backend

* Wed Jul 03 2024 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.23-4
- Build against Qt6 on F40+

* Wed Jan 31 2024 Pete Walter <pwalter@fedoraproject.org> - 1.0.23-3
- Rebuild for ICU 74

* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.23-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 12 2024 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.23-1
- Update to version 1.0.23 (fedora#2258043)

* Sat Dec 23 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.22-3
- Rebuilt for kdsingleapplication (fedora#2255689)

* Sun Dec 10 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.22-1
- Update to version 1.0.22 (fedora#2253831)

* Mon Nov 27 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.21-2
- Unbundle kdsingleapplication

* Sun Oct 22 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.21-1
- Update to version 1.0.21 (fedora#2245471)

* Mon Sep 25 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.20-1
- Update to version 1.0.20 (fedora#2240623)

* Tue Jul 25 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.18-1
- Update to version 1.0.18
- Refresh and correct the license list and the resulting License field
- Convert the License field to SPDX
- Resolves: fedora#2219104

* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.17-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jul 11 2023 František Zatloukal <fzatlouk@redhat.com> - 1.0.17-2
- Rebuilt for ICU 73.2

* Sat Apr 01 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.17-1
- Update to version 1.0.17 (fedora#2183425)

* Mon Mar 27 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.16-1
- Update to version 1.0.16 (fedora#2182195)

* Sun Mar 05 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.15-1
- Update to version 1.0.15 (fedora#2175493)

* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Sat Jan 14 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.14-1
- Update to version 1.0.14
- Resolves: rhbz#2160866

* Wed Jan 11 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.13-1
- Update to version 1.0.13
- Resolves: rhbz#2159830

* Tue Jan 03 2023 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.12-1
- Update to version 1.0.12
- Resolves: rhbz#2157166

* Sat Dec 31 2022 Pete Walter <pwalter@fedoraproject.org> - 1.0.10-2
- Rebuild for ICU 72

* Tue Oct 25 2022 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.10-1
- Update to version 1.0.10
- Resolves: rhbz#2137193

* Thu Sep 08 2022 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.9-1
- Update to version 1.0.9
- Resolves: rhbz#2124044

* Wed Aug 31 2022 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.8-2
- Run upstream tests in %%check

* Mon Aug 29 2022 Ondrej Mosnáček <omosnacek@gmail.com> - 1.0.8-1
- Update to version 1.0.8
- Resolves: rhbz#2122307

* Sat Aug 13 2022 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.7-1
- Update to 1.0.7 - closes rhbz#2110841

* Sat Jul 23 2022 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.6-1
- Update to 1.0.6 - closes rhbz#2108388

* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jun 13 2022 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.5-1
- Update to 1.0.5 - close: rhbz#2095994

* Sun Apr 10 2022 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.4-1
- Update to 1.0.4 - close: rhbz#2073849

* Thu Mar 31 2022 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.3-1
- Update to 1.0.3 - close: rhbz#2068388

* Sun Mar 06 2022 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.2-1
- Update to 1.0.2 - close: rhbz#2056413

* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Sun Jan 09 2022 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.1-1
- Update to 1.0.1

* Tue Nov 23 2021 Ondrej Mosnacek <omosnace@redhat.com> - 1.0.0-1
- Update to 1.0.0

* Sat Nov 06 2021 Adrian Reber <adrian@lisas.de> - 0.9.3-4
- Rebuilt for protobuf 3.19.0

* Mon Oct 25 2021 Adrian Reber <adrian@lisas.de> - 0.9.3-3
- Rebuilt for protobuf 3.18.1

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Mon May 24 16:59:41 CEST 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0.9.3-1
- Update to 0.9.3
- Close: rhbz#1950834

* Thu Apr  8 18:18:11 CEST 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0.9.2-1
- Update to 0.9.2
- Close: rhbz#1938490

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Wed Jan 13 14:43:43 CET 2021 Adrian Reber <adrian@lisas.de> - 0.8.5-2
- Rebuilt for protobuf 3.14

* Fri Jan  8 17:58:40 CET 2021 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.5-1
- Update to 0.8.5
- Close: rhbz#1909456

* Sat Dec 05 14:57:04 CET 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.4-1
- Update to 0.8.4
- Close: rhbz#1897885

* Mon Nov 09 08:13:59 CET 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.3-1
- Update to 0.8.3 (#1891280, #1887027)

* Thu Oct 01 2020 Jeff Law <law@redhat.com> - 0.7.2-4
- Force -fPIC into build flags.  Re-enable LTO

* Wed Sep 30 15:15:27 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.7.2-3
- Disable LTO
- Fix #1878315

* Thu Sep 24 2020 Adrian Reber <adrian@lisas.de> - 0.7.2-2
- Rebuilt for protobuf 3.13

* Mon Aug 24 20:19:01 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.7.2-1
- Update to 0.7.2 (#1869008)

* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.13-3
- Second attempt - Rebuilt for
  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue Jul 14 05:56:51 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.6.13-1
- Update to 0.6.13 (#1856599)

* Sun Jun 21 2020 Adrian Reber <adrian@lisas.de> - 0.6.12-2
- Rebuilt for protobuf 3.12

* Tue Jun 16 22:48:55 CEST 2020 Robert-André Mauchin <zebob.m@gmail.com> - 0.6.12-1
- Update to 0.6.12

* 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

## END: Generated by rpmautospec