File vcmi.spec of Package vcmi

#
# spec file for package vcmi
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# 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/
#


%if 0%{?suse_version} < 1650
%define gcc_ver 13
%endif
%define boost_version 1.66.0
Name:           vcmi
Version:        1.6.8
Release:        0
Summary:        An open-source project aiming to reimplement HMM3:WoG game engine
License:        GPL-2.0-only
Group:          Amusements/Games/Strategy/Turn Based
URL:            https://vcmi.eu/
Source:         https://github.com/vcmi/vcmi/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE no-boost-system.patch -- Boost.System was merged to headers
Patch0:         no-boost-system.patch
BuildRequires:  cmake >= 3.16.0
BuildRequires:  fdupes
BuildRequires:  gcc%{?gcc_ver}-c++
# building on openSUSE Leap fails with boost 1.66.0, using boost 1.75.0 instead
%if 0%{?sle_version} >= 150500 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
BuildRequires:  libboost_atomic1_75_0-devel
BuildRequires:  libboost_chrono1_75_0-devel
BuildRequires:  libboost_filesystem1_75_0-devel
BuildRequires:  libboost_locale1_75_0-devel
BuildRequires:  libboost_program_options1_75_0-devel
BuildRequires:  libboost_thread1_75_0-devel
%else
BuildRequires:  libboost_atomic-devel >= %{boost_version}
BuildRequires:  libboost_chrono-devel >= %{boost_version}
BuildRequires:  libboost_filesystem-devel >= %{boost_version}
BuildRequires:  libboost_locale-devel >= %{boost_version}
BuildRequires:  libboost_program_options-devel >= %{boost_version}
BuildRequires:  libboost_thread-devel >= %{boost_version}
# fix building for Tumbleweed with gcc14
BuildRequires:  libquadmath-devel
%endif
BuildRequires:  libqt5-linguist-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(SDL2_image)
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(SDL2_ttf)
BuildRequires:  pkgconfig(fuzzylite) >= 6
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libswscale)
BuildRequires:  pkgconfig(minizip)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(tbb) >= 2021.8.0
BuildRequires:  pkgconfig(zlib)
Recommends:     ffmpeg
Recommends:     innoextract
ExclusiveArch:  x86_64

%description
VCMI is an open-source project aiming to reimplement HMM3:WoG game engine, giving it new and extended possibilities.

%prep
%autosetup -N
%if 0%{?suse_version} > 1600
%autopatch 0
%endif

%build
%cmake \
    -DCMAKE_C_COMPILER=gcc%{?gcc_ver:-%{gcc_ver}} \
    -DCMAKE_CXX_COMPILER=g++%{?gcc_ver:-%{gcc_ver}} \
    -DCMAKE_INSTALL_LIBDIR="%{_lib}" \
    -DENABLE_GITVERSION=OFF \
    -DENABLE_INNOEXTRACT=OFF \
    -DFORCE_BUNDLED_FL=OFF

%cmake_build

%install
%cmake_install
# we disable rpath, so we need to put libvcmi.so in library path.
mv %{buildroot}%{_libdir}/%{name}/lib%{name}.so %{buildroot}%{_libdir}/
%fdupes %{buildroot}%{_datadir}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license license.txt
%doc ChangeLog.md docs
%{_bindir}/vcmibuilder
%{_bindir}/vcmiclient
%{_bindir}/vcmieditor
%{_bindir}/vcmilauncher
%{_bindir}/vcmiserver
%{_libdir}/lib%{name}.so
%{_libdir}/%{name}/
%{_datadir}/%{name}/
%{_datadir}/applications/*
%{_datadir}/icons/*
%{_datadir}/metainfo/eu.vcmi.VCMI.metainfo.xml

%changelog
openSUSE Build Service is sponsored by