File fheroes2.spec of Package fheroes2

#
# spec file for package fheroes2
#
# Copyright (c) 2025 SUSE LLC and contributors
# Copyright (c) 2020-2025, Martin Hauke <mardnh@gmx.de>
#
# 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/
#


# fheroes2 needs a c++17 compiler at least
%if 0%{?sle_version} && 0%{?sle_version} < 160000
%global force_gcc_version 13
%endif
Name:           fheroes2
Version:        1.1.11
Release:        0
Summary:        A free implementation of Heroes of Might and Magic II engine
License:        GPL-2.0-only
Group:          Amusements/Games/3D/Shoot
URL:            https://ihhub.github.io/fheroes2/
Source:         https://github.com/ihhub/fheroes2/archive/%{version}.tar.gz/#/%{name}-%{version}.tar.gz
Source1:        README.SUSE
BuildRequires:  cmake >= 3.24
BuildRequires:  gcc%{?force_gcc_version}-c++
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(SDL2_image)
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(SDL2_ttf)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(zlib)
# To extract game data from the GOG installer
Recommends:     innoextract

%description
Free Heroes II (fheroes2) is free implementation of Heroes of Might
and Magic II game engine.

NOTE:
To play Free Heroes II with fheroes2 you need the original game files.
Also see /usr/share/doc/packages/fheroes2/README.SUSE

%prep
%setup -q

%build
export CFLAGS="%{optflags}"
%if 0%{?force_gcc_version}
export CXX="g++-%{force_gcc_version}"
%endif
%cmake -DUSE_SDL_VERSION=SDL2 \
    -DENABLE_IMAGE=ON
%cmake_build

%install
install -Dm0755 build/fheroes2 %{buildroot}%{_bindir}/fheroes2
install -m0644 %{SOURCE1} README.SUSE
# Install data
mkdir -p %{buildroot}%{_datadir}/%{name}/files/data
cp -Rav files/data/* %{buildroot}%{_datadir}/%{name}/files/data
mkdir -p %{buildroot}%{_datadir}/%{name}/files/lang
cp -Rav files/lang/*.mo %{buildroot}%{_datadir}/%{name}/files/lang

%files
%license LICENSE
%doc changelog.txt README.md README.SUSE
#%%doc fheroes2.key
%{_bindir}/fheroes2
%{_datadir}/%{name}

%changelog
openSUSE Build Service is sponsored by