File freeorion.spec of Package freeorion
#
# spec file for package freeorion
#
# 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/
#
%if 0%{?sle_version} >= 150500 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
%define python_subver 10
%else
%define python_subver 11
%endif
%if 0%{?sle_version} && 0%{?sle_version} < 160000
%global force_gcc_version 13
%endif
Name: freeorion
Version: 0.5.1
Release: 0
Summary: A turn-based space empire and galactic conquest (4X) computer game
License: GPL-2.0-only
Group: Amusements/Games/Strategy/Turn Based
URL: https://freeorion.org/
Source: https://github.com/freeorion/freeorion/releases/download/v%{version}/FreeOrion_v%{version}_Source.tar.gz
BuildRequires: cmake >= 3.15
BuildRequires: fdupes
BuildRequires: gcc%{?force_gcc_version}-c++
BuildRequires: google-roboto-fonts
BuildRequires: hicolor-icon-theme
BuildRequires: libpng-devel
BuildRequires: pkgconfig
BuildRequires: python3%{python_subver}-devel
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(glew)
BuildRequires: pkgconfig(glu)
BuildRequires: pkgconfig(openal)
BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(zlib)
Requires: %{name}-data = %{version}
Requires: google-roboto-fonts
Requires: python3%{python_subver}
%if 0%{?sle_version} >= 150500 && 0%{?sle_version} < 160000 && 0%{?is_opensuse}
BuildRequires: libboost_atomic1_75_0-devel
BuildRequires: libboost_date_time1_75_0-devel
BuildRequires: libboost_filesystem1_75_0-devel
BuildRequires: libboost_iostreams1_75_0-devel
BuildRequires: libboost_locale1_75_0-devel
BuildRequires: libboost_log1_75_0-devel
BuildRequires: libboost_python-py3-1_75_0-devel
BuildRequires: libboost_regex1_75_0-devel
BuildRequires: libboost_serialization1_75_0-devel
BuildRequires: libboost_system1_75_0-devel
BuildRequires: libboost_thread1_75_0-devel
%else
BuildRequires: libboost_atomic-devel
BuildRequires: libboost_date_time-devel
BuildRequires: libboost_filesystem-devel
BuildRequires: libboost_iostreams-devel
BuildRequires: libboost_locale-devel
BuildRequires: libboost_log-devel
BuildRequires: libboost_python3-devel
BuildRequires: libboost_regex-devel
BuildRequires: libboost_serialization-devel
BuildRequires: libboost_system-devel
BuildRequires: libboost_thread-devel
%endif
%description
FreeOrion is a turn-based space empire and galactic conquest (4X)
computer game. It is inspired by the tradition of the Master of Orion
games, but is not a clone or remake of that series or any other game.
%package data
Summary: Data files for FreeOrion, a turn-based space empire game
License: CC-BY-SA-3.0
Group: Amusements/Games/Strategy/Turn Based
Requires: %{name} = %{version}
BuildArch: noarch
%description data
FreeOrion is a turn-based space empire and galactic conquest (4X)
computer game. It is inspired by the tradition of the Master of Orion
games, but is not a clone or remake of that series or any other game.
This package contains all the resource data necessary to run FreeOrion.
%prep
%autosetup -p1 -n src-tarball
%build
%if 0%{?force_gcc_version}
export CXX="g++-%{?force_gcc_version}"
%else
export CXX="g++"
%endif
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_INSTALL_LIBDIR=%{_lib} \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \
-DCMAKE_CXX_COMPILER=$(which g++-%{gcc_ver}) \
-DPYTHON_EXECUTABLE:FILEPATH=$(which python3.%{python_subver}) \
-DPYTHON_INCLUDE_DIR=$(python3.%{python_subver} -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
..
# Only try with one thread since some compilation units are very large
%make_build -j2
%install
%cmake_install
## Resource modifications
# Remove included TTF files as we will use the system ones
cd %{buildroot}%{_datadir}/%{name}/default/data/fonts
rm *.ttf LICENSE.*
# Link to system fonts
ln -s %{_datadir}/fonts/truetype/Roboto-Bold.ttf
ln -s %{_datadir}/fonts/truetype/Roboto-Regular.ttf
%fdupes %{buildroot}/%{_datadir}/
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%license default/COPYING
%doc ChangeLog.md README.md
%{_bindir}/*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*
%{_datadir}/icons/*
%{_datadir}/applications/*
%{_datadir}/metainfo/*
%files data
%{_datadir}/%{name}
%changelog