File hearts.spec of Package hearts2

#
# spec file for package hearts
#
# Copyright (c) 2026 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  Hearts
Name:           hearts
Version:        @SERVICE@
Release:        0
Summary:        Card game
License:        MIT
Group:          Amusements/Games/Board/Card
URL:            https://github.com/Rescator7/Hearts2
Source0:        %{name}-%{version}.tar.xz
Patch0:         animated_arrow.patch
BuildRequires:  cmake
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  sox
BuildRequires:  cmake(Qt6LinguistTools)
BuildRequires:  cmake(Qt6Multimedia)
BuildRequires:  cmake(Qt6Svg)
BuildRequires:  cmake(Qt6SvgWidgets)
BuildRequires:  cmake(Qt6Widgets) >= 6.4.2
BuildRequires:  pkgconfig(allegro-5) >= 5.2.8
BuildRequires:  pkgconfig(allegro_acodec-5)
BuildRequires:  pkgconfig(allegro_audio-5)
Suggests:       %{name}-addons

%description
Hearts card game version 2.

%package        addons
Summary:        Decks for %{name}
Requires:       %{name} = %{version}
BuildArch:      noarch

%description    addons
Card game decks for %{name}.

%prep
%autosetup -p1
mv sounds sounds-wav
mkdir sounds
for i in $(find sounds-wav/ -name '[[:digit:]]*.wav' -exec basename -a {} + | cut -d '.' -f1) ; do
    sox sounds-wav/$i.wav sounds/$i.ogg
done
sox sounds-wav/Soundwhich*.wav sounds/"Soundwhich - Correct (LittleRainySeasons) [public]".ogg
sed -i 's/\.wav/.ogg/' sounds.cpp

#ed -i 's/\.svg/.svgz/' deck.cpp
sed -i 's/\(Default\.svg\)/\1z/' resources.qrc
for i in Default English Russian kaiser-jubilaum ; do
    sed -i "s/\($i\.svg\)/\1z/" deck.cpp
    gzip -c SVG-cards/$i/$i.svg > SVG-cards/$i/$i.svgz
    rm -v SVG-cards/$i/$i.svg
done

%build
%cmake_qt6
%qt6_build

%install
%qt6_install
rm -rvf %{buildroot}%{_datadir}/%{name}/SVG-cards/Default
rm -vf %{buildroot}%{_datadir}/%{name}/SVG-cards/tigullio-international/tigullio-international.svg
%fdupes -s %{buildroot}%{_datadir}/

%files
%doc README.md
%{_bindir}/%{_name}
%{_datadir}/%{name}/
%exclude %{_datadir}/%{name}/backgrounds/
%exclude %{_datadir}/%{name}/SVG-cards/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.??g
#%%{_datadir}/metainfo/%%{_name}.metainfo.xml
#%%{_mandir}/man?/%%{name}.?%%{?ext_man}
%license LICENSE

%files addons
%{_datadir}/%{name}/backgrounds/
%{_datadir}/%{name}/SVG-cards/

%changelog
openSUSE Build Service is sponsored by