File springrts.spec of Package springrts

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


%define relto() $(realpath --relative-to %{_prefix} %{1})
%define libunitsyncSONAME 1
%define _version 106.0
Name:           springrts
Version:        0.%{_version}
Release:        0
Summary:        A full 3D open source RTS game engine
License:        GPL-2.0-or-later
Group:          Amusements/Games/Strategy/Real Time
URL:            https://springrts.com
Source:         https://springrts.com/dl/buildbot/default/master/%{_version}/source/spring_%{_version}_src.tar.lzma
# PATCH-FIX-UPSTREAM springrts-104-find-docbook.patch -- fix manpage generation
Patch0:         springrts-104-find-docbook.patch
# PATCH-FIX numeric-limits.patch -- include <limits> for std::numeric_limits
Patch1:         numeric-limits.patch
# PATCH-FIX-UPSTREAM fix-manpages.patch -- fix manpage generation, again
Patch2:         https://github.com/spring/spring/commit/553a21526b144568b608a0507674b076ec80d9f9.patch#/fix-manpages.patch
# PATCH-FIX-UPSTREAM springrts-add-missing-cstdint-headers.patch - https://github.com/spring/spring/commit/137158cc4a8147cf7404e8892b08d1da533b1699.patch
Patch3:         https://github.com/spring/spring/commit/137158cc4a8147cf7404e8892b08d1da533b1699.patch#/springrts-add-missing-cstdint-headers.patch
# PATCH-FIX-UPSTREAM springrts-add-more-missing-cstdint-headers.patch
Patch4:         springrts-add-more-missing-cstdint-headers.patch
BuildRequires:  asciidoc
## we choose the gold linker for build
BuildRequires:  binutils-gold
BuildRequires:  cmake
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  fdupes
BuildRequires:  fontconfig-devel
BuildRequires:  gcc-c++
BuildRequires:  java-devel
BuildRequires:  libboost_chrono-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_headers-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  libxslt-tools
BuildRequires:  pkgconfig
BuildRequires:  python-rpm-macros
BuildRequires:  python3-devel
BuildRequires:  strip-nondeterminism
BuildRequires:  pkgconfig(IL)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(jsoncpp)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libunwind)
BuildRequires:  pkgconfig(minizip)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(xcursor)
BuildRequires:  pkgconfig(zlib)
Requires:       %{name}-engine = %{version}
Requires:       libunitsync = %{version}
Recommends:     springlobby
# The split into p7zip (7zr) and p7zip-full (7z) happened in Tumbleweed and Leap >= 15.2
%if (0%{?suse_version} >= 1550) || (0%{?is_opensuse} && 0%{?sle_version} >= 150200)
BuildRequires:  p7zip-full
%else
BuildRequires:  p7zip
%endif
ExcludeArch:    i586 aarch64

%description
Spring is an open source game engine that supports 3D multiplayer gameplay,
mods & being capable of loading the content of the game Total Annihilation.

This package includes no maps, mods or a multiplayer client. Download SpringLobby
to get the multiplayer client which can be used for singleplayer, too. Maps and
mods are available via springlobby's p2p system or community websites.

%package gamedata
Summary:        Game-related files
Group:          Amusements/Games/Strategy/Real Time
Requires:       %{name}-engine = %{version}
BuildArch:      noarch

%description gamedata
Game-related files for the open source RTS game engine Spring.

%package engine-default
Summary:        Meta package for the Spring game engine
Group:          Amusements/Games/Strategy/Real Time
Requires:       %{name}-gamedata = %{version}

%description engine-default
Installs all engine-related files and the gamedata.

%package engine-dedicated
Summary:        Dedicated server for the Spring game engine
Group:          Amusements/Games/Strategy/Real Time
Requires:       %{name}-gamedata = %{version}

%description engine-dedicated
A dedicated server for the open source RTS game engine Spring.

%package engine-headless
Summary:        Spring without graphics
Group:          Amusements/Games/Strategy/Real Time
Requires:       %{name}-gamedata = %{version}

%description engine-headless
The Spring version without a GUI.

%package -n libunitsync
Summary:        A library for Spring
Group:          Amusements/Games/Strategy/Real Time
Requires:       %{name}-gamedata = %{version}

%description -n libunitsync
Utility library for Spring.

## meta packages

%package engine
Summary:        Metapackage default and OpenGL4
Group:          Amusements/Games/Strategy/Real Time
Requires:       %{name}-engine-default = %{version}
Requires:       libunitsync = %{version}
BuildArch:      noarch

%description engine
Metapackage for the default components of springrts including the OpenGL4 variant of Spring.

%package map-tools
Summary:        Tools for map creation
Group:          Amusements/Games/Strategy/Real Time

%description map-tools
This package contains tools to compile / decompile maps for the Spring engine.

%package pr-downloader_shared
Summary:        Maps/Mod Downloader for Spring
Group:          Amusements/Games/Strategy/Real Time

%description pr-downloader_shared
Tool to download maps and games for the Spring engine.

%prep
%autosetup -p1 -n spring_%{_version}

%build
# Don't use standard cmake macro:
# When using the cmake macro with the RPM optimized compiler options the software
# reports during build stage that it "will very likely not sync in online mode!".
mkdir build
cd build
# FindJava.cmake looks for javah executable. However,
# the build never invokes the tool. Define a bogus
# Java_JAVAH_EXECUTABLE in order to be able to build
# with JDK10 that does not have this tool, deprecated
# since JDK8.
cmake -DCMAKE_BUILD_TYPE=RELWITHDBGINFO \
      -DCMAKE_INSTALL_PREFIX=%{_prefix} \
      -DJava_JAVAH_EXECUTABLE:PATH=%{_bindir}/true \
      -DAI_LIBS_DIR=%{relto %{_libdir}/spring} \
      -DLIBDIR=%{_lib} \
      -DDOCDIR=%{relto %{_docdir}/%{name}} \
      -DDATADIR="%{relto %{_datadir}/%{name}}" \
      ..
%make_build

%install
%cmake_install
strip-nondeterminism -t zip `find %{buildroot} -name \*.sdz -o -name \*.jar`
%fdupes %{buildroot}

%post -n %{name}-engine-default -p /sbin/ldconfig
%postun -n %{name}-engine-default -p /sbin/ldconfig
%post -n libunitsync -p /sbin/ldconfig
%postun -n libunitsync -p /sbin/ldconfig

%files engine
%{_datadir}/applications/spring.desktop
%{_datadir}/mime/packages/spring.xml
%{_datadir}/pixmaps/application-x-spring-demo.png
%{_datadir}/pixmaps/spring.png
%{_mandir}/man6/spring-opengl4.6%{?ext_man}

%files gamedata
%{_datadir}/%{name}

%files engine-default
%{_bindir}/spring
%{_libdir}/spring
%{_mandir}/man6/spring.6%{?ext_man}

%files engine-dedicated
%{_bindir}/spring-dedicated
%{_mandir}/man6/spring-dedicated.6%{?ext_man}

%files engine-headless
%{_bindir}/spring-headless
%{_mandir}/man6/spring-headless.6%{?ext_man}

%files -n libunitsync
%{_libdir}/libunitsync.so

%files map-tools
%{_bindir}/mapcompile
%{_bindir}/mapdecompile

%files pr-downloader_shared
%{_bindir}/pr-downloader

%changelog
openSUSE Build Service is sponsored by