File projectM-4.spec of Package projectM-4

#
# spec file for package projectM-4
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define _libver 4
%ifarch %arm aarch64
%bcond_without sdl
%bcond_without gles_flavor
%else
%bcond_without sdl
%bcond_without gles_flavor
%endif
%bcond_without pulseaudio_qt
Name:           projectM-4
Version:        4.1.2
Release:        0
Summary:        A Music Visualizer
License:        LGPL-2.1-or-later
Group:          Productivity/Multimedia/Sound/Visualization
URL:            http://projectm.sourceforge.net
Source0:        https://github.com/projectM-visualizer/projectm/archive/v%{version}.tar.gz#/projectm-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  git-core
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
# System vendoring
BuildRequires:  glm-devel
BuildRequires:  projectm-eval-devel-static
%if 0%{?sle_version}
BuildRequires:  gcc12-c++
%endif
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(pthread-stubs)
%if %{with pulseaudio_qt}
BuildRequires:  libqt5-linguist-devel
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(ftgl)
BuildRequires:  pkgconfig(libpulse)
%endif
%if %{with sdl}
BuildRequires:  libSDL2-devel
%endif
%if %{with gles_flavor}
# Workaround: Qt5OpenGL is required for configure when testing libglm
BuildRequires:  pkgconfig(Qt5OpenGL)
BuildRequires:  pkgconfig(glesv1_cm)
%endif
%if %{with pulseaudio_qt}
Obsoletes:      %{name}-qt5 < %{version}
Provides:       %{name}-qt5 = %{version}
%endif

%description
projectM is a music visualizer.

%package     -n lib%{name}-%{_libver}
Summary:        Run-time library for projectM
Group:          System/Libraries
Obsoletes:      lib%{name}-qt5-%{_libver} < %{version}
Provides:       lib%{name}-qt5-%{_libver} = %{version}

%description -n lib%{name}-%{_libver}
projectM is a music visualizer.
This package contains its runtime library.

%package     -n lib%{name}-playlist%{_libver}
Summary:        Run-time library for projectM
Group:          System/Libraries
Obsoletes:      lib%{name}-qt5-%{_libver} < %{version}
Provides:       lib%{name}-qt5-%{_libver} = %{version}

%description -n lib%{name}-playlist%{_libver}
projectM is a music visualizer.
This package contains its playlist runtime library.

%if 0
%package        data
Summary:        Data files for projectM
Group:          Productivity/Multimedia/Sound/Visualization
Requires:       %{name} = %{version}
Requires:       dejavu
Obsoletes:      %{name}-qt5-data < %{version}
Provides:       %{name}-qt5-data = %{version}

%description    data
projectM is a music visualizer.
This package contains its data: config, presets, shaders.
%endif

%package        devel
Summary:        Development Files for projectM
Group:          Development/Libraries/C and C++
Requires:       lib%{name}-playlist%{_libver}
#Requires:       %%{name}-data = %%{version}
Requires:       lib%{name}-%{_libver} = %{version}
Obsoletes:      %{name}-qt5-devel < %{version}
Provides:       %{name}-qt5-devel = %{version}

%description    devel
projectM is a music visualizer.
This package contains its development files.

%prep
%autosetup -n projectm-%{version} -p1
# Remove some vendored libs
rm -rf vendor/{glm,projectm-eval}

%build
# Needs c++17
%if 0%{?sle_version}
%cmake -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++-12 \
%else
%cmake \
%endif
 -DENABLE_SYSTEM_GLM=true \
 -DENABLE_SYSTEM_PROJECTM_EVAL=true

%cmake_build

%install
%cmake_install
%if %{with sdl}
rm -rf %{buildroot}%{_bindir}/projectM-unittest
%endif
find %{buildroot} -type f -name "*.la" -delete -print
#%%suse_update_desktop_file -r projectM-pulseaudio AudioVideo Audio Mixer
%fdupes -s %{buildroot}

%post -n lib%{name}-playlist%{_libver} -p /sbin/ldconfig
%postun -n lib%{name}-playlist%{_libver} -p /sbin/ldconfig

%post -n lib%{name}-%{_libver}
               /sbin/ldconfig

%postun -n lib%{name}-%{_libver}
               /sbin/ldconfig

#%%files

%files -n lib%{name}-%{_libver}
%license LICENSE.txt
%{_libdir}/lib%{name}.so.%{_libver}*

%files -n lib%{name}-playlist%{_libver}
%license LICENSE.txt
%{_libdir}/lib%{name}-playlist.so.%{_libver}*

#%%files data
#%%{_datadir}/%%{name}

%files devel
%license LICENSE.txt
%doc README.md
%{_includedir}/%{name}/
%{_libdir}/lib%{name}.so
%{_libdir}/lib%{name}-playlist.so
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/pkgconfig/%{name}-playlist.pc
%{_libdir}/cmake/

%changelog
openSUSE Build Service is sponsored by