File subtitlecomposer.spec of Package subtitlecomposer5

#
# spec file for package subtitlecomposer
#
# Copyright (c) 2024 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/
#


Name:           subtitlecomposer5
Version:        0.8.1
Release:        0
Summary:        A text-based subtitle editor
License:        GPL-2.0-or-later
Group:          Productivity/Multimedia/Video/Editors and Convertors
URL:            https://invent.kde.org/multimedia/subtitlecomposer
Source0:        https://download.kde.org/stable/subtitlecomposer/subtitlecomposer-%{version}.tar.xz
Source1:        https://download.kde.org/stable/subtitlecomposer/subtitlecomposer-%{version}.tar.xz.sig
Source2:        subtitlecomposer.keyring
# PATCH-FIX-UPSTREAM refreshment of ffmpeg related code
%if 0%{?suse_version} > 1500
Patch0:         0001-Replaced-deprecated-FFmpeg-channel-layout-code.patch
Patch1:         0002-VideoPlayer-check-AVFMT_NO_BYTE_SEEK-flag-for-seek_b.patch
Patch2:         0003-VideoPlayer-drop-an-unused-function-argument.patch
Patch3:         0004-VideoPlayer-stop-using-AVFrame.pkt_pos.patch
Patch4:         0005-VideoPlayer-remove-usage-of-internal-AVInputFormat.r.patch
Patch5:         0006-VideoPlayer-stop-injecting-stream-side-data-in-packe.patch
Patch6:         0007-VideoPlayer-check-return-of-swr_alloc_set_opts2.patch
Patch7:         0008-StreamProcessor-stop-using-pkt_duration.patch
Patch8:         0009-StreamProcessor-stop-using-AVFrame-duration.patch
Patch9:         0010-Require-FFmpeg-5.1.5.patch
# PATCH-FIX-UPSTREAM https://invent.kde.org/multimedia/subtitlecomposer/-/merge_requests/48
Patch10:        use-pocketsphinx-5.0.0-api.patch
%endif
BuildRequires:  cmake >= 3.10
BuildRequires:  extra-cmake-modules
BuildRequires:  libQt5Widgets-private-headers-devel
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  cmake(KF5Auth)
BuildRequires:  cmake(KF5Codecs)
BuildRequires:  cmake(KF5Config)
BuildRequires:  cmake(KF5ConfigWidgets)
BuildRequires:  cmake(KF5CoreAddons)
BuildRequires:  cmake(KF5I18n)
BuildRequires:  cmake(KF5KIO)
BuildRequires:  cmake(KF5Kross)
BuildRequires:  cmake(KF5Sonnet)
BuildRequires:  cmake(KF5TextWidgets)
BuildRequires:  cmake(KF5WidgetsAddons)
BuildRequires:  cmake(KF5XmlGui)
BuildRequires:  cmake(Qt5Core)
BuildRequires:  cmake(Qt5Gui)
BuildRequires:  cmake(Qt5Qml)
BuildRequires:  cmake(Qt5Test)
BuildRequires:  cmake(Qt5Widgets)
BuildRequires:  pkgconfig(icu-i18n)
BuildRequires:  pkgconfig(icu-uc)
BuildRequires:  pkgconfig(libavcodec)
%if 0%{?suse_version} > 1500
BuildRequires:  pkgconfig(libavformat) >= 59.27.100
%else
BuildRequires:  pkgconfig(libavformat) >= 57.83.100
%endif
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libswscale)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(openssl)
%if 0%{?suse_version} > 1500
%ifnarch ppc64 s390x
BuildRequires:  pkgconfig(pocketsphinx) >= 5
%endif
%endif

%description
A text-based subtitles editor that supports basic operations. It supports
SubRip (SRT), MicroDVD, SSA/ASS, MPlayer, TMPlayer and YouTube captions, and
has speech Recognition using PocketSphinx.

%lang_package

%prep
%autosetup -p1 -n subtitlecomposer-%{version}

%build
%cmake_kf5 -d build -- -DCMAKE_INSTALL_LOCALEDIR=%{_kf5_localedir}

%cmake_build

%install
%kf5_makeinstall -C build

# Fix rpmlint error (devel-file-in-non-devel-package) and install header files as doc (since they are installed just for help)
mkdir files_for_doc
cp -a %{buildroot}%{_kf5_appsdir}/subtitlecomposer/scripts/api/ files_for_doc/
rm -r %{buildroot}%{_kf5_appsdir}/subtitlecomposer/scripts/api/
# Point to the correct path of the header files directory (doc)
perl -pi -e "s|'api'|'/usr/share/doc/packages/subtitlecomposer/api'|" %{buildroot}%{_kf5_appsdir}/subtitlecomposer/scripts/README

%suse_update_desktop_file -r org.kde.subtitlecomposer

%kf5_find_lang %{name}

%{kf5_post_install}

%files
%doc ChangeLog README.md files_for_doc/api
%license LICENSE
%config(noreplace) %{_kf5_configdir}/subtitlecomposerrc
%dir %{_kf5_iconsdir}/hicolor/256x256
%dir %{_kf5_iconsdir}/hicolor/256x256/apps
%{_kf5_applicationsdir}/org.kde.subtitlecomposer.desktop
%{_kf5_appsdir}/subtitlecomposer/
%{_kf5_appstreamdir}/org.kde.subtitlecomposer.appdata.xml
%{_kf5_bindir}/subtitlecomposer
%{_kf5_iconsdir}/hicolor/*/*/*
%{_kf5_sharedir}/mime/packages/subtitlecomposer.xml
%if 0%{?suse_version} > 1500
%ifnarch ppc64 s390x
%{_kf5_libdir}/subtitlecomposer/
%endif
%endif

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by