File lincity-ng.spec of Package lincity-ng
#
# spec file for package lincity-ng
#
# Copyright (c) 2024 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/
#
Name: lincity-ng
Version: 2.12.0
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: fdupes
BuildRequires: hicolor-icon-theme
BuildRequires: libSDL2_gfx-devel
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
BuildRequires: vorbis-tools
BuildRequires: pkgconfig(SDL2_image)
BuildRequires: pkgconfig(SDL2_mixer)
BuildRequires: pkgconfig(SDL2_ttf)
BuildRequires: pkgconfig(libxml-2.0) >= 2.6.11
BuildRequires: pkgconfig(libxslt)
BuildRequires: pkgconfig(physfs) >= 2.1.0
BuildRequires: pkgconfig(sdl2)
Requires: %{name}-data = %{version}
%if 0%{?sle_version} >= 150600 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
BuildRequires: gcc12
BuildRequires: gcc12-c++
%else
BuildRequires: gcc-c++
%endif
%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%{?sle_version} >= 150600 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
export CC="gcc-12"
export CXX="g++-12"
%endif
mkdir build
cd build
# %%cmake macros breaks building
cmake .. -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
%suse_update_desktop_file -r %{name} Game StrategyGame
# done by doc-macro
rm -rf %{buildroot}%{_datadir}/doc/%{name}
# clean-up of duplicate and unneeded files
rm -rf %{buildroot}%{_datadir}/%{name}/COPYING*
rm -rf %{buildroot}%{_datadir}/%{name}/lincity-ng.desktop
rm -rf %{buildroot}%{_datadir}/%{name}/lincity-ng.png
rm -rf %{buildroot}%{_datadir}/%{name}/README.md
rm -rf %{buildroot}%{_datadir}/%{name}/images/tiles/extend.sh
%fdupes %{buildroot}%{_datadir}
%files
%license COPYING*
%doc README.md
%doc doc/lincityconfig.xml doc/userconfig.xml
%{_mandir}/man6/*
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
%files data
%{_datadir}/%{name}/
%changelog