File pencil2d.spec of Package pencil2d

#
# spec file for package pencil2d
#
# Copyright (c) 2025 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  _name  org.pencil2d.Pencil2D
Name:           pencil2d
Version:        @SERVICE@
Release:        0
Summary:        Tool to make 2D hand-drawn animations
License:        GPL-2.0-or-later
Group:          Productivity/Graphics/Vector Editors
URL:            https://github.com/pencil2d/pencil
Source0:        %{name}-%{version}.tar.xz
BuildRequires:  appstream-glib
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  help2man
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
#uildRequires:  xvfb-run
BuildRequires:  cmake(Qt6Core)
BuildRequires:  cmake(Qt6Gui)
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  cmake(Qt6Multimedia)
BuildRequires:  cmake(Qt6Network)
BuildRequires:  cmake(Qt6Svg)
BuildRequires:  cmake(Qt6Widgets)
BuildRequires:  cmake(Qt6Xml)
Requires:       %{_bindir}/ffmpeg
%requires_eq    libQt6Svg6

%description
Pencil2D is a free and open source animation/drawing software for Windows,
macOS, Linux, and FreeBSD. It lets you create traditional hand-drawn
animation (cartoon) using both bitmap and vector graphics.

%package        bash-completion
Summary:        Bash completion for %{name}
Group:          System/Shells
Requires:       bash-completion
Supplements:    (%{name} and bash)
BuildArch:      noarch

%description    bash-completion
Bash command line completion support for %{name}.

%package        zsh-completion
Summary:        Zsh Completion for %{name}
Group:          System/Shells
Requires:       zsh
Supplements:    (%{name} and zsh)
BuildArch:      noarch

%description    zsh-completion
ZSH command line completion support for %{name}.

%prep
%autosetup -p1
sed -i '/Icon\[/d;/# Translations/d;/^$/d;/Version/s/\.1/.0/' app/data/%{_name}.desktop

%build
%qmake6 \
    PREFIX=%{_prefix} \
    VERSION=%{version}
%qmake6_build

%install
%qmake6_install
install -dm 0755 %{buildroot}%{_mandir}/man1
help2man --no-info --output=%{buildroot}%{_mandir}/man1/%{name}.1 \
    --name="is an easy, intuitive tool to make 2D hand-drawn animations." \
    --locale=C.UTF-8 "QT_QPA_PLATFORM=offscreen ./app/%{name}"
#   --locale=C.UTF-8 "xvfb-run ./app/%%{name}"
install -dm 0755 %{buildroot}%{_mandir}/ru/man1
help2man --no-info --output=%{buildroot}%{_mandir}/ru/man1/%{name}.1 \
    --name="eto prostoj, intuitivno ponyatnyj instrument dlya sozdaniya 2D animacii narisovannoj vruchnuyu." \
    --locale=ru_RU.UTF-8 "QT_QPA_PLATFORM=offscreen ./app/%{name}"
%suse_update_desktop_file -n -r %{_name} Qt Graphics 2DGraphics RasterGraphics

%check
#xvfb-run ./tests/tests
QT_QPA_PLATFORM=offscreen ./tests/tests
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/%{_name}.metainfo.xml

%files
%doc ChangeLog.md README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{_name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{_name}.??g
%{_datadir}/metainfo/%{_name}.metainfo.xml
%{_datadir}/mime/packages/%{_name}.xml
%{_mandir}/man?/%{name}.?%{?ext_man}
%{_mandir}/ru/man?/%{name}.?%{?ext_man}
%license LICENSE.TXT

%files bash-completion
%dir %{_datadir}/bash-completion/
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/%{name}

%files zsh-completion
%dir %{_datadir}/zsh/
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_%{name}

%changelog
openSUSE Build Service is sponsored by