File lincity-ng.spec of Package lincity-ng

#
# spec file for package lincity-ng
#
# 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/
#


# use GCC 13 for Leap 15.x
%if 0%{?suse_version} < 1600
%global force_gcc_version 13
%endif
Name:           lincity-ng
Version:        2.14.2
Release:        0
Summary:        City Simulation Game
License:        GPL-2.0-or-later
Group:          Amusements/Games/Strategy/Real Time
URL:            https://github.com/lincity-ng/lincity-ng
Source:         https://github.com/lincity-ng/lincity-ng/archive/refs/tags/%{name}-%{version}.tar.gz#/%{name}-%{name}-%{version}.tar.gz
BuildRequires:  cmake >= 3.21
BuildRequires:  gcc%{?force_gcc_version}-c++
BuildRequires:  fdupes
BuildRequires:  fluidsynth
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  vorbis-tools
BuildRequires:  pkgconfig(SDL2_image)
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(SDL2_ttf)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(fmt)
BuildRequires:  pkgconfig(libxml++-5.0)
BuildRequires:  pkgconfig(libxml-2.0) >= 2.6.11
BuildRequires:  pkgconfig(libxslt)
BuildRequires:  pkgconfig(sdl2)
Requires:       %{name}-data = %{version}

%description
LinCity-NG is a city simulation game. It is a polished and improved
version of the classic LinCity game. Within the scope of the GoTM
project at happypenguin, a new iso-3D graphics engine was created with
a completely redone and modern GUI.

%package data
Summary:        Data files for LinCity-NG
Group:          Amusements/Games/Strategy/Real Time
Requires:       %{name} = %{version}
BuildArch:      noarch

%description data
Data files for LinCity-NG (the city simulation game).

%prep
%autosetup -n %{name}-%{name}-%{version}

%build
%if 0%{?force_gcc_version}
export CC="gcc-%{force_gcc_version}"
export CXX="g++-%{force_gcc_version}"
%endif

mkdir build
cd build
# %%cmake macros breaks building
cmake .. -DCMAKE_BUILD_TYPE=Release \
         -DCMAKE_INSTALL_MANDIR=%{_mandir}/man6 \
         -DCMAKE_INSTALL_PREFIX=%{_prefix} \
         -DCMAKE_POSITION_INDEPENDENT_CODE=ON

%install
%cmake_install

# Save some space by encoding provided sounds to ogg
for i in %{buildroot}%{_datadir}/%{name}/sounds/*.wav; do
    # calculate a deterministic serial https://wiki.debian.org/ReproducibleBuilds/OggSerialNumbers
    serial=$(sha256sum "$i" | tr a-f 0-5 | cut -c 1-9)
    oggenc -s "$serial" --quiet "$i" && rm "$i"
done
sed -i "s/\.wav/.ogg/" %{buildroot}%{_datadir}/%{name}/sounds/sounds.xml

# done by doc-macro
rm -rf %{buildroot}%{_datadir}/doc/%{name}

%fdupes %{buildroot}%{_datadir}

%files
%license COPYING*
%doc README.md
%{_mandir}/man6/*
%{_bindir}/%{name}
%{_datadir}/applications/io.github.lincity_ng.lincity-ng.desktop
%{_datadir}/icons/hicolor/*/apps/io.github.lincity_ng.lincity-ng.png
%{_datadir}/metainfo/io.github.lincity_ng.lincity-ng.metainfo.xml

%files data
%{_datadir}/%{name}/

%changelog
openSUSE Build Service is sponsored by