File clapper.spec of Package clapper

#
# spec file for package clapper
#
# Copyright (c) 2020-24 Florian "sp1rit" <packaging@sp1rit.anonaddy.me>
# Copyright (C) 2020-24 Rafostar
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

%global uuid com.github.rafostar.Clapper
%global libver 0.0
%global libsuffix 0.7.0
%global sover 0
%global gstlib Clapper

%global gst_version 1.20.0
%global gtk4_version 4.10.0
%global meson_version 0.64
%global glib2_version 2.76.0
%global adw_version 1.4.0

%bcond_without server

Name:           clapper
Version:        0.7.0
Release:        0
Summary:        Simple and modern media player
License:        GPL-3.0
URL:            https://github.com/Rafostar/clapper
Source0:        %{name}-%{version}.tar.xz

BuildRequires:  gcc
BuildRequires:  meson >= %{meson_version}


BuildRequires:  pkgconfig(gstreamer-1.0) >= %{gst_version}
BuildRequires:  pkgconfig(gstreamer-base-1.0) >= %{gst_version}
BuildRequires:  pkgconfig(gstreamer-video-1.0) >= %{gst_version}
BuildRequires:  pkgconfig(gstreamer-audio-1.0) >= %{gst_version}
BuildRequires:  pkgconfig(gstreamer-pbutils-1.0) >= %{gst_version}
BuildRequires:  pkgconfig(gstreamer-tag-1.0) >= %{gst_version}

BuildRequires:  pkgconfig(glib-2.0) >= %{glib2_version}
BuildRequires:  pkgconfig(gobject-2.0) >= %{glib2_version}
BuildRequires:  pkgconfig(gio-2.0) >= %{glib2_version}
BuildRequires:  pkgconfig(gio-unix-2.0) >= %{glib2_version}
BuildRequires:  pkgconfig(gmodule-2.0) >= %{glib2_version}

BuildRequires:  pkgconfig(gtk4) >= %{gtk4_version}
BuildRequires:  pkgconfig(libadwaita-1) >= %{adw_version}

BuildRequires:  gobject-introspection
BuildRequires:  pkgconfig(gobject-introspection-1.0)
BuildRequires:  vala

BuildRequires:  desktop-file-utils

%if %{with server}
BuildRequires:  pkgconfig(libsoup-3.0)
BuildRequires:  pkgconfig(microdns) >= 0.2.0
%endif

%define altlibver %(sed s/[.]/_/g <<< %{libver})

Requires:       lib%{name}-%{altlibver}-%{sover} = %{version}
Requires:       lib%{name}-gtk-%{altlibver}-%{sover} = %{version}

%global _description %{expand:
Clapper is a modern media player powered by GStreamer and built for the GNOME desktop environment using GTK4 toolkit.}

%if 0%{?suse_version}
# SUSE recommends group tag, while Fedora discourages their use
Group:          Productivity/Multimedia/Video/Players

BuildRequires:  update-desktop-files
BuildRequires:  Mesa-libGL-devel
BuildRequires:  Mesa-libGLESv3-devel

Requires:       gstreamer >= %{gst_version}
Requires:       gstreamer-plugins-base >= %{gst_version}
Requires:       gstreamer-plugins-good >= %{gst_version}
Requires:       gstreamer-plugins-bad >= %{gst_version}

# Popular video decoders
Recommends:     gstreamer-plugins-libav >= %{gst_version}

# CD Playback
Suggests:       gstreamer-plugins-ugly
# Intel/AMD video acceleration
Suggests:       gstreamer-plugins-vaapi

# GObject Introspection Bindings are in a seperate subpackage in openSUSE
# https://en.opensuse.org/openSUSE:Packaging_guidelines#GObject_Introspection_Bindings_.28.typelibs.29
%package -n typelib-1_0-%{gstlib}-%{altlibver}
Summary:        Introspection bindings for lib%{name}-%{altlibver}-%{sover}
Group:          System/Libraries
Requires:       lib%{name}-%{altlibver}-%{sover} = %{version}

%package -n typelib-1_0-%{gstlib}Gtk-%{altlibver}
Summary:        Introspection bindings for lib%{name}-gtk-%{altlibver}-%{sover}
Group:          System/Libraries
Requires:       lib%{name}-gtk-%{altlibver}-%{sover} = %{version}

%description -n typelib-1_0-%{gstlib}-%{altlibver} %{_description}
This subpackage provides the GObject Introspection bindings for
lib%{name}-%{altlibver}-%{sover}.

%description -n typelib-1_0-%{gstlib}Gtk-%{altlibver} %{_description}
This subpackage provides the GObject Introspection bindings for
lib%{name}-gtk-%{altlibver}-%{sover}.


%lang_package
%else
BuildRequires:  glibc-all-langpacks
BuildRequires:  libzstd-devel

BuildRequires:  mesa-libGL-devel
BuildRequires:  mesa-libGLES-devel

Requires:       gstreamer1 >= %{gst_version}
Requires:       gstreamer1-plugins-base >= %{gst_version}
Requires:       gstreamer1-plugins-good >= %{gst_version}
Requires:       gstreamer1-plugins-bad-free >= %{gst_version}

# ASS subtitles (assrender)
Recommends:     gstreamer1-plugins-bad-free-extras >= %{gst_version}

# CD Playback
Suggests:       gstreamer1-plugins-ugly-free
# Intel/AMD video acceleration
Suggests:       gstreamer1-vaapi

# expaneded suse's %%lang_package macro
%package lang
Summary: Translations for package %{name}
Group: System/Localization

Requires: %{name} = %{version}

Provides: %{name}-lang-all = %{version}
BuildArch: noarch
%description lang
Provides translations for the "%{name}" package.
%endif

%package -n lib%{name}-%{altlibver}-%{sover}
Summary: Media player components
Group: Productivity/Multimedia/Video/Players
License: LGPL-2.1

%package -n lib%{name}-gtk-%{altlibver}-%{sover}
Summary: GTK media player component
Group: Productivity/Multimedia/Video/Players
License: LGPL-2.1
Requires: lib%{name}-%{altlibver}-%{sover} = %{version}

%package devel
Summary: Development files for %{name}
Group: Development/Libraries/C and C++
License: LGPL-2.1
Requires: lib%{name}-%{altlibver}-%{sover} = %{version}
Requires: lib%{name}-gtk-%{altlibver}-%{sover} = %{version}

%description %{_description}

%description -n lib%{name}-%{altlibver}-%{sover} %{_description}
%description -n lib%{name}-gtk-%{altlibver}-%{sover} %{_description}

%description devel %{_description}

This subpackage holds the required files to compile against
lib%{name}.

%prep
%autosetup -p1

%build
%meson \
	%{!?with_server:-Dserver=disabled} 
	%{nil}
%meson_build

%install
%meson_install
%if 0%{?suse_version}
%suse_update_desktop_file %{uuid}
%endif

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{uuid}.desktop

%find_lang clapper-app
%find_lang clapper-gtk

%files lang -f clapper-app.lang -f clapper-gtk.lang

%post -n lib%{name}-%{altlibver}-%{sover} -p /sbin/ldconfig
%postun -n lib%{name}-%{altlibver}-%{sover} -p /sbin/ldconfig

%post -n lib%{name}-gtk-%{altlibver}-%{sover} -p /sbin/ldconfig
%postun -n lib%{name}-gtk-%{altlibver}-%{sover} -p /sbin/ldconfig

%files
%license COPYING-GPL
%doc README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{uuid}.desktop
%{_datadir}/dbus-1/services/%{uuid}.service
%{_datadir}/glib-2.0/schemas/%{uuid}.gschema.xml
%{_datadir}/icons/hicolor/*/apps/%{uuid}*.svg
%{_datadir}/metainfo/%{uuid}.metainfo.xml
%{_datadir}/mime/packages/%{uuid}.xml

%files -n lib%{name}-%{altlibver}-%{sover}
%license COPYING-LGPL
%{_libdir}/lib%{name}-%{libver}.so.%{sover}
%{_libdir}/lib%{name}-%{libver}.so.%{libsuffix}

%{_libdir}/libgst%{name}glcontexthandler.so.%{sover}
%{_libdir}/libgst%{name}glcontexthandler.so.%{libsuffix}
%{_libdir}/gstreamer-1.0/libgst%{name}.so
%{_libdir}/%{name}-%{libver}/

%if 0%{?suse_version}
%files -n typelib-1_0-%{gstlib}-%{altlibver}
%endif
%{_libdir}/girepository-1.0/%{gstlib}-%{libver}.typelib

%files -n lib%{name}-gtk-%{altlibver}-%{sover}
%license COPYING-LGPL
%{_libdir}/lib%{name}-gtk-%{libver}.so.%{sover}
%{_libdir}/lib%{name}-gtk-%{libver}.so.%{libsuffix}

%if 0%{?suse_version}
%files -n typelib-1_0-%{gstlib}Gtk-%{altlibver}
%endif
%{_libdir}/girepository-1.0/%{gstlib}Gtk-%{libver}.typelib


%files devel
%{_datadir}/gir-1.0/%{gstlib}-%{libver}.gir
%{_datadir}/gir-1.0/%{gstlib}Gtk-%{libver}.gir
%{_datadir}/vala/vapi/%{name}-%{libver}.{deps,vapi}
%{_datadir}/vala/vapi/%{name}-gtk-%{libver}.{deps,vapi}
%{_includedir}/%{name}-%{libver}/
%{_libdir}/lib%{name}-%{libver}.so
%{_libdir}/lib%{name}-gtk-%{libver}.so
%{_libdir}/libgst%{name}glcontexthandler.so
%{_libdir}/pkgconfig/%{name}-%{libver}.pc
%{_libdir}/pkgconfig/%{name}-gtk-%{libver}.pc

%changelog
openSUSE Build Service is sponsored by