File subtitlecomposer.spec of Package subtitlecomposer

#
# spec file for package subtitlecomposer
#
# Copyright (c) 2020 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 realname subtitlecomposer
Name:           %{realname}
Version:        0
Release:        0
Summary:        A text-based subtitle editor
License:        GPL-2.0-or-later
Group:          Productivity/Multimedia/Video/Editors and Convertors
URL:            https://subtitlecomposer.kde.org
Source0:        %{realname}-%{version}.tar.xz
BuildRequires:  cmake >= 3.10
BuildRequires:  extra-cmake-modules
BuildRequires:  pkgconfig
BuildRequires:  cmake(KF5Auth)
BuildRequires:  cmake(KF5Codecs)
BuildRequires:  cmake(KF5Config)
BuildRequires:  cmake(KF5ConfigWidgets)
BuildRequires:  cmake(KF5CoreAddons)
BuildRequires:  cmake(KF5I18n)
BuildRequires:  cmake(KF5KIO)
BuildRequires:  cmake(KF5Sonnet)
BuildRequires:  cmake(KF5TextWidgets)
BuildRequires:  cmake(KF5WidgetsAddons)
BuildRequires:  cmake(KF5XmlGui)
BuildRequires:  cmake(Qt5Core) >= 5.6
BuildRequires:  cmake(Qt5Gui)
BuildRequires:  cmake(Qt5Qml)
BuildRequires:  cmake(Qt5Test)
BuildRequires:  cmake(Qt5Widgets)
BuildRequires:  pkgconfig(icu-i18n)
BuildRequires:  pkgconfig(icu-uc)
%if 0%{?is_opensuse}
BuildRequires:  libqt5-qtbase-private-headers-devel
BuildRequires:  update-desktop-files
%else
BuildRequires:  qt5-qtbase-private-devel
#!BuildIgnore:  libgudev
#!BuildIgnore:  python2
%endif
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libswscale)
BuildRequires:  pkgconfig(openal)
BuildRequires:  openssl-devel
BuildRequires:  pocketsphinx-devel

%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.

%if 0%{?fedora}
%define _kf5_configdir %{_sysconfdir}/xdg
%define _kf5_iconsdir %{_datadir}/icons
%define _kf5_bindir %{_bindir}
%define _kf5_applicationsdir %{_datadir}/applications
%define _kf5_appsdir %{_datadir}
%define _kf5_appstreamdir %{_datadir}/metainfo
%define _kf5_kxmlguidir %{_datadir}/kxmlgui5
%define _kf5_libdir %{_prefix}/%{_lib}
%endif

%prep
%setup -q -n %{name}-%{version}

# Fix permissions
chmod 644 ChangeLog

%build
%if 0%{?fedora} >= 33
	%cmake_kf5 -DKDE_INSTALL_LIBDIR=%{_lib}
%else
	%cmake_kf5 -d build
%endif
%cmake_build

%install
%cmake_install

# 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}%{_datadir}/%{realname}/scripts/api/ files_for_doc/
rm -rf %{buildroot}%{_datadir}/%{realname}/scripts/api/
# Point to the correct path of the header files directory (doc)
perl -pi -e "s|'api'|'%{_docdir}/subtitlecomposer/api'|" %{buildroot}%{_datadir}/%{realname}/scripts/README

%find_lang %{name} %{name}.lang --all-name --with-qt

%if 0%{?is_opensuse}
%suse_update_desktop_file -r org.kde.%{realname} Qt KDE AudioVideo AudioVideoEditing
%kf5_post_install
%endif

%files -f %{name}.lang
%doc ChangeLog README.md files_for_doc/api
%license LICENSE
%config(noreplace) %{_kf5_configdir}/%{realname}rc
%dir %{_kf5_iconsdir}/hicolor/256x256
%dir %{_kf5_iconsdir}/hicolor/256x256/apps
%{_datadir}/mime/packages/%{realname}.xml
%{_kf5_applicationsdir}/org.kde.%{realname}.desktop
%{_kf5_appsdir}/%{realname}/
%{_kf5_appstreamdir}/org.kde.%{realname}.appdata.xml
%{_kf5_bindir}/%{realname}
%{_kf5_iconsdir}/hicolor/*/*/*
%{_kf5_libdir}/%{realname}/


%changelog
openSUSE Build Service is sponsored by