1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-04 01:48:54 +00:00

games/spring: update to 105.0.1

PR:		254732
This commit is contained in:
Dmitry Marakasov 2021-04-22 15:05:40 +03:00
parent 0c1868c33e
commit 33c9707d8b
42 changed files with 516 additions and 861 deletions

View File

@ -1,110 +1,86 @@
PORTNAME= spring
PORTVERSION= 98.0
PORTREVISION= 21
PORTVERSION= 105.0.1
CATEGORIES= games
MASTER_SITES= SF/springrts/springrts/${PORTNAME}-${PORTVERSION} \
http://springrts.com/dl/
DISTNAME= ${PORTNAME}_${PORTVERSION}_src
MAINTAINER= amdmi3@FreeBSD.org
COMMENT= Project aiming to create a new and versatile RTS Engine
LICENSE= GPLv2
BROKEN= fails to build
LICENSE= GPLv2+ BSD3CLAUSE BSD2CLAUSE
LICENSE_COMB= multi
LICENSE_FILE= ${WRKSRC}/LICENSE
LIB_DEPENDS= libfreetype.so:print/freetype2 \
libboost_thread.so:devel/boost-libs \
libIL.so:graphics/devil \
libogg.so:audio/libogg \
libvorbis.so:audio/libvorbis
libvorbis.so:audio/libvorbis \
libminizip.so:archivers/minizip \
libfontconfig.so:x11-fonts/fontconfig \
libcurl.so:ftp/curl \
libunwind.so:devel/libunwind \
libjsoncpp.so:devel/jsoncpp
BUILD_DEPENDS= 7z:archivers/p7zip
# XXX: it should be possible to build it on i386, investigate
# (currently link fails on undefined reference to __sync_fetch_and_add_8)
BROKEN_FreeBSD_12= ld: error: undefined symbol: streflop_libm::__inline_isnanf(float)
ONLY_FOR_ARCHS= amd64
ONLY_FOR_ARCHS_REASON= relies on x86 floating-point math and amd64 atomic ops
USE_SDL= sdl2
USE_GITHUB= yes
GH_TUPLE= spring:Python:3bb6837:Python/AI/Interfaces/Python \
spring:AAI:a15f45c:AAI/AI/Skirmish/AAI \
spring:CircuitAI:91fd31e:CircuitAI/AI/Skirmish/CircuitAI \
spring:HughAI:1a11f5a:HughAI/AI/Skirmish/HughAI \
spring:KAIK:f6bdd3e:KAIK/AI/Skirmish/KAIK \
spring:Shard:75339ae:Shard/AI/Skirmish/Shard \
spring:SpringMapConvNG:76429b4:SprintMapConvNG/tools/mapcompile \
spring:pr-downloader:67423a3:pr_downloader/tools/pr-downloader \
spring:pyunitsync:6e1b3fd:pyunitsync/tools/unitsync/python
USES= cmake compiler:c++11-lib desktop-file-utils gl localbase:ldflags \
openal:al pkgconfig sdl shared-mime-info xorg
USE_GL= gl glu glew
USE_SDL= sdl2
USE_XORG= x11 xcursor
USE_LDCONFIG= yes
DOS2UNIX_GLOB= *.h *.hpp *.cpp
USES= cmake:insource compiler:c++11-lib dos2unix gl openal:al sdl \
tar:lzma xorg
USES+= desktop-file-utils shared-mime-info
CMAKE_ARGS= -DDATADIR:STRING="share/${PORTNAME}" \
-DAI_TYPES:STRING="NATIVE" \
-DDOCDIR:STRING="share/doc/${PORTNAME}" \
-DCREATE_MAN_PAGES:BOOL=false \
-DUSE_TCMALLOC:BOOL=false \
-DUSE_LIBSQUISH:BOOL=false \
-DUNITSYNC_PYTHON_WRAPPER:BOOL=false
-DAI_TYPES:STRING="NATIVE" \
-DCMAKE_DISABLE_FIND_PACKAGE_Git=TRUE \
-Wno-dev
WRKSRC= ${WRKDIR}/${PORTNAME}_${PORTVERSION}
# Do not exctract bundled copies of header files for 3rd-party packages:
EXTRACT_AFTER_ARGS=--no-same-owner --no-same-permissions --exclude ${WRKSRC:T}/include
# The check-target fails right now: https://springrts.com/mantis/view.php?id=4736
TEST_TARGET= check
PORTDOCS= *
PORTDATA= *
OPTIONS_DEFINE= MANPAGES PR_DOWNLOADER DOCS
OPTIONS_DEFAULT=MANPAGES PR_DOWNLOADER
OPTIONS_SUB= yes
PR_DOWNLOADER_DESC= Map and game downloader
MANPAGES_CMAKE_ON= -DCREATE_MAN_PAGES:BOOL=true -DMANDIR:STRING="man"
MANPAGES_CMAKE_OFF= -DCREATE_MAN_PAGES:BOOL=false
MANPAGES_BUILD_DEPENDS= 7z:archivers/p7zip \
asciidoc:textproc/asciidoc \
xsltproc:textproc/libxslt \
${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl \
bash:shells/bash
CXXFLAGS+= -Wno-deprecated # Too much noise
PR_DOWNLOADER_LIB_DEPENDS=libcurl.so:ftp/curl
.include <bsd.port.pre.mk>
MAKE_ENV= PORTVERSION="${PORTVERSION:R}" # build system expects 2 digit version
.if defined(WITH_SYNC_DEBUG)
CFLAGS= # empty
CXXFLAGS= # empty
CMAKE_ARGS+= -DTRACE_SYNC=true -DSYNCDEBUG=true
CMAKE_BUILD_TYPE=DEBUG2
CMAKE_ARGS+= -DTRACE_SYNC=true -DSYNCDEBUG=true -DSYNCCHECK=true
CMAKE_BUILD_TYPE=DEBUG
.endif
.if ! ${PORT_OPTIONS:MPR_DOWNLOADER}
post-extract:
@${RM} ${WRKSRC}/tools/pr-downloader/CMakeLists.txt
.endif
# The check-target fails right now: https://springrts.com/mantis/view.php?id=4736
TEST_TARGET= check
PORTDATA= *
OPTIONS_DEFINE= MANPAGES
OPTIONS_DEFAULT=MANPAGES
OPTIONS_SUB= yes
MANPAGES_CMAKE_BOOL= ENABLE_MANPAGES
MANPAGES_BUILD_DEPENDS= asciidoc:textproc/asciidoc \
xsltproc:textproc/libxslt \
${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl \
bash:shells/bash
post-patch:
@${REINPLACE_CMD} -e 's|-O2||' ${WRKSRC}/CMakeLists.txt
.if defined(WITH_OPTIONAL_GS4)
# allows minimal runtest with older hardware
@${REINPLACE_CMD} -e '/GLEW_ARB_geometry_shader4/ s|CHECK_REQ_EXT|CHECK_OPT_EXT|' ${WRKSRC}/rts/Rendering/GlobalRendering.cpp
.endif
@${REINPLACE_CMD} -e 's|/etc/\(spring/datadir\)|${PREFIX}/\1|g' \
${WRKSRC}/rts/System/FileSystem/DataDirLocater.cpp
@${REINPLACE_CMD} -e 's|x1F3F|x0F3F|g' \
${WRKSRC}/rts/System/Sync/FPUCheck.cpp
@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
${WRKSRC}/rts/build/cmake/*.cmake
@${REINPLACE_CMD} -e 's|execinfo|/usr/lib/libexecinfo.so|' \
${WRKSRC}/rts/CMakeLists.txt \
${WRKSRC}/rts/builds/dedicated/CMakeLists.txt
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' \
${WRKSRC}/rts/System/Platform/Misc.cpp
@${REINPLACE_CMD} -e 's|/bin/bash|${LOCALBASE}&|' \
${WRKSRC}/doc/manpages/make_manpages.sh
.if ! ${PORT_OPTIONS:MMANPAGES}
@${REINPLACE_CMD} -e '/set(CREATE_MAN_PAGES)/ d' \
${WRKSRC}/doc/CMakeLists.txt
.endif
# XXX: recheck if this is still needed
@${REINPLACE_CMD} -e 's|x1F3F|x0F3F|g' \
${WRKSRC}/rts/System/Sync/FPUCheck.cpp
pre-build:
cd ${WRKSRC} && ${MAKE_CMD} generateVersionFiles
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@ -1,2 +1,21 @@
SHA256 (spring_98.0_src.tar.lzma) = 9137a8a35b42dd622c107c3b26525dc40d8b6e0dca0ce4a87c9fef005328823b
SIZE (spring_98.0_src.tar.lzma) = 9114659
TIMESTAMP = 1619038665
SHA256 (spring-spring-105.0.1_GH0.tar.gz) = 975e74540acd6e2f0a1a4965d222ff79b035e152e35edbab982bee4a76a41b22
SIZE (spring-spring-105.0.1_GH0.tar.gz) = 10625978
SHA256 (spring-Python-3bb6837_GH0.tar.gz) = 710bb1a7f4835ab4d55a91b95cc7c5f53cfb8a3e2ba528f46d62df4f5a8d632e
SIZE (spring-Python-3bb6837_GH0.tar.gz) = 29519
SHA256 (spring-AAI-a15f45c_GH0.tar.gz) = 2d3b0922969b28596339f651bd208ce26b9220830cc917f70613368a2a4828ee
SIZE (spring-AAI-a15f45c_GH0.tar.gz) = 137400
SHA256 (spring-CircuitAI-91fd31e_GH0.tar.gz) = 8d54f79070559cf53bed127421a33ee2d5dc27825364e0ef9008d47e47e91980
SIZE (spring-CircuitAI-91fd31e_GH0.tar.gz) = 713006
SHA256 (spring-HughAI-1a11f5a_GH0.tar.gz) = 6caaae79f6435ac74b7f6bd4407f89c5e48f30711932655c9ba64321f8056937
SIZE (spring-HughAI-1a11f5a_GH0.tar.gz) = 126562
SHA256 (spring-KAIK-f6bdd3e_GH0.tar.gz) = 20cf1304c94f18f11cc22597e7b88bc57e7125a79541498d9b3b86faa133e63c
SIZE (spring-KAIK-f6bdd3e_GH0.tar.gz) = 97974
SHA256 (spring-Shard-75339ae_GH0.tar.gz) = 0dc59dc03cc3d92d30abe8f2570a7aa9ec6f80bbe9e8464baedc8810393e7f32
SIZE (spring-Shard-75339ae_GH0.tar.gz) = 358911
SHA256 (spring-SpringMapConvNG-76429b4_GH0.tar.gz) = 920a3cc2420feabdd8c8603b407070dfb6b56a65216f0d2e0796e94afa1cb22f
SIZE (spring-SpringMapConvNG-76429b4_GH0.tar.gz) = 21488
SHA256 (spring-pr-downloader-67423a3_GH0.tar.gz) = f12ff0999bac8b0044eb603975b324e2ca0461c6d4c0bb61e2856300ed6edea1
SIZE (spring-pr-downloader-67423a3_GH0.tar.gz) = 832323
SHA256 (spring-pyunitsync-6e1b3fd_GH0.tar.gz) = 3d05a88200337bbac3a8d4a8b92eb4660687fa3948a4aeb87fb07a01b057fa1a
SIZE (spring-pyunitsync-6e1b3fd_GH0.tar.gz) = 131119

View File

@ -0,0 +1,11 @@
--- ./AI/Skirmish/CircuitAI/CMakeLists.txt.orig 2021-01-01 16:10:55 UTC
+++ ./AI/Skirmish/CircuitAI/CMakeLists.txt
@@ -9,7 +9,7 @@ if (WIN32) # spring::condition_variable_any requireme
elseif (APPLE)
set(additionalSources ${additionalSources} ${CMAKE_SOURCE_DIR}/rts/System/Platform/Mac/Signal.cpp)
else ()
- set(additionalSources ${additionalSources} ${CMAKE_SOURCE_DIR}/rts/System/Platform/Linux/Futex.cpp)
+ #set(additionalSources ${additionalSources} ${CMAKE_SOURCE_DIR}/rts/System/Platform/Linux/Futex.cpp)
endif ()
set(additionalLibraries ${Cpp_AIWRAPPER_TARGET} CUtils)
#set(additionalLibraries ${Cpp_AIWRAPPER_TARGET} CUtils ${SDL2_LIBRARY})

View File

@ -0,0 +1,13 @@
https://github.com/spring/CircuitAI/pull/17/files
--- AI/Skirmish/CircuitAI/src/circuit/module/EconomyManager.h.orig 2021-01-01 16:10:55 UTC
+++ AI/Skirmish/CircuitAI/src/circuit/module/EconomyManager.h
@@ -164,7 +164,7 @@ class CEconomyManager: public IModule { (private)
float pull;
int mex;
float fraction;
- inline bool operator< (const SPullMtoS& rhs) { return mex < rhs.mex; }
+ inline bool operator< (const SPullMtoS& rhs) const { return mex < rhs.mex; }
inline bool operator() (const SPullMtoS& lhs, const int rhs) { return lhs.mex < rhs; }
};
std::vector<SPullMtoS> mspInfos;

View File

@ -0,0 +1,22 @@
--- AI/Skirmish/CircuitAI/src/circuit/setup/SetupManager.cpp.orig 2021-01-01 16:10:55 UTC
+++ AI/Skirmish/CircuitAI/src/circuit/setup/SetupManager.cpp
@@ -26,6 +26,8 @@
#include "Info.h"
#include <regex>
+#include <algorithm>
+#include <random>
namespace circuit {
@@ -183,7 +185,9 @@ void CSetupManager::PickStartPos(CCircuitAI* circuit,
c.distDivIncome = center.distance(cl.position) / income;
validClusters.push_back(std::make_pair(kv.first, c));
}
- std::random_shuffle(validClusters.begin(), validClusters.end());
+ std::random_device rd;
+ std::minstd_rand g(rd());
+ std::shuffle(validClusters.begin(), validClusters.end(), g);
auto cmp = [](const std::pair<int, SCluster>& a, const std::pair<int, SCluster>& b) {
if (a.second.count < b.second.count) {

View File

@ -0,0 +1,21 @@
--- ./AI/Skirmish/CircuitAI/src/circuit/util/math/EncloseCircle.cpp.orig 2021-01-01 16:10:55 UTC
+++ ./AI/Skirmish/CircuitAI/src/circuit/util/math/EncloseCircle.cpp
@@ -9,6 +9,7 @@
#include "util/utils.h"
#include <algorithm>
+#include <random>
#include <assert.h>
namespace circuit {
@@ -48,7 +49,9 @@ void CEncloseCircle::MakeCircle(const std::vector<AIFl
}
// Randomize order
// TODO: Read why shuffle??
- std::random_shuffle(shuffled.begin(), shuffled.end());
+ std::random_device rd;
+ std::minstd_rand g(rd());
+ std::shuffle(shuffled.begin(), shuffled.end(), g);
// Progressively add points to circle or recompute circle
decltype(shuffled)::iterator it = shuffled.begin();

View File

@ -1,184 +0,0 @@
https://github.com/spring/spring/commit/a61970779994
https://github.com/spring/spring/commit/f2f84f38e04a
https://github.com/spring/spring/commit/318c003c7273
https://github.com/spring/spring/commit/5048e2a3446c
--- rts/Net/AutohostInterface.cpp.orig 2014-10-07 20:09:51 UTC
+++ rts/Net/AutohostInterface.cpp
@@ -116,68 +116,60 @@ std::string AutohostInterface::TryBindSocket(
const std::string& remoteIP, int remotePort,
const std::string& localIP, int localPort)
{
- std::string errorMsg = "";
+ std::string errorMsg;
ip::address localAddr;
ip::address remoteAddr;
boost::system::error_code err;
+
try {
socket.open(ip::udp::v6(), err); // test IP v6 support
+
const bool supportsIPv6 = !err;
remoteAddr = netcode::WrapIP(remoteIP, &err);
- if (err) {
+
+ if (err)
throw std::runtime_error("Failed to parse address " + remoteIP + ": " + err.message());
- }
- if (!supportsIPv6 && remoteAddr.is_v6()) {
+ if (!supportsIPv6 && remoteAddr.is_v6())
throw std::runtime_error("IP v6 not supported, can not use address " + remoteAddr.to_string());
- }
if (localIP.empty()) {
// use the "any" address as local "from"
if (remoteAddr.is_v6()) {
localAddr = ip::address_v6::any();
} else {
- if (supportsIPv6) {
- socket.close();
- }
+ socket.close();
socket.open(ip::udp::v4());
+
localAddr = ip::address_v4::any();
}
} else {
localAddr = netcode::WrapIP(localIP, &err);
- if (err) {
+
+ if (err)
throw std::runtime_error("Failed to parse local IP " + localIP + ": " + err.message());
- }
- if (localAddr.is_v6() != remoteAddr.is_v6()) {
+
+ if (localAddr.is_v6() != remoteAddr.is_v6())
throw std::runtime_error("Local IP " + localAddr.to_string() + " and remote IP " + remoteAddr.to_string() + " are IP v4/v6 mixed");
- }
}
socket.bind(ip::udp::endpoint(localAddr, localPort));
-
- boost::asio::socket_base::non_blocking_io command(true);
- socket.io_control(command);
-
- // A similar, slighly less verbose message is already in GameServer
- //LOG("Connecting (UDP) to IP (v%i) %s Port %i",
- // (remoteAddr.is_v6() ? 6 : 4), remoteAddr.c_str(), remotePort);
+ socket.non_blocking(true);
socket.connect(ip::udp::endpoint(remoteAddr, remotePort));
- } catch (const std::runtime_error& ex) { // includes also boost::system::system_error, as it inherits from runtime_error
+ } catch (const std::runtime_error& ex) {
+ // also includes asio::system_error, inherits from runtime_error
socket.close();
errorMsg = ex.what();
- if (errorMsg.empty()) {
+
+ if (errorMsg.empty())
errorMsg = "Unknown problem";
- }
}
return errorMsg;
}
-AutohostInterface::~AutohostInterface()
-{
-}
void AutohostInterface::SendStart()
{
--- rts/Net/AutohostInterface.h.orig 2014-10-07 20:09:51 UTC
+++ rts/Net/AutohostInterface.h
@@ -28,7 +28,7 @@ class AutohostInterface (public)
*/
AutohostInterface(const std::string& remoteIP, int remotePort,
const std::string& localIP = "", int localPort = 0);
- virtual ~AutohostInterface();
+ virtual ~AutohostInterface() {}
bool IsInitialized() const { return initialized; }
--- rts/System/FileSystem/Archives/SevenZipArchive.cpp.orig 2014-10-07 20:09:51 UTC
+++ rts/System/FileSystem/Archives/SevenZipArchive.cpp
@@ -3,7 +3,6 @@
#include "SevenZipArchive.h"
#include <algorithm>
-#include <boost/system/error_code.hpp>
#include <stdexcept>
#include <string.h> //memcpy
@@ -86,7 +85,7 @@ IArchive* CSevenZipArchiveFactory::DoCreateArchive(con
return new CSevenZipArchive(filePath);
}
-const char* CSevenZipArchive::GetErrorStr(int err)
+static inline const char* GetErrorStr(int err)
{
switch(err) {
case SZ_OK:
@@ -108,6 +107,27 @@ const char* CSevenZipArchive::GetErrorStr(int err)
}
+static inline std::string GetSystemErrorStr(WRes wres)
+{
+#ifdef USE_WINDOWS_FILE
+ LPSTR messageBuffer = nullptr;
+ size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, wres, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
+
+ std::string errorstr(messageBuffer, size);
+
+ //Free the buffer.
+ LocalFree(messageBuffer);
+#else
+ std::string errorstr(strerror(wres));
+#endif
+
+ return errorstr;
+}
+
+
+
+
CSevenZipArchive::CSevenZipArchive(const std::string& name):
CBufferedArchive(name, false),
blockIndex(0xFFFFFFFF),
@@ -126,9 +146,8 @@ CSevenZipArchive::CSevenZipArchive(const std::string&
WRes wres = InFile_Open(&archiveStream.file, name.c_str());
if (wres) {
- boost::system::error_code e(wres, boost::system::get_system_category());
LOG_L(L_ERROR, "Error opening \"%s\": %s (%i)",
- name.c_str(), e.message().c_str(), e.value());
+ name.c_str(), GetSystemErrorStr(wres).c_str(), (int) wres);
return;
}
--- rts/System/FileSystem/Archives/SevenZipArchive.h.orig 2014-10-07 20:09:51 UTC
+++ rts/System/FileSystem/Archives/SevenZipArchive.h
@@ -95,7 +95,6 @@ class CSevenZipArchive : public CBufferedArchive (priv
int packedSize;
};
int GetFileName(const CSzArEx* db, int i);
- const char* GetErrorStr(int res);
std::vector<FileData> fileData;
UInt16 *tempBuf;
--- rts/System/Net/UDPListener.cpp.orig 2014-10-07 20:09:51.000000000 +0000
+++ rts/System/Net/UDPListener.cpp
@@ -34,8 +34,7 @@ UDPListener::UDPListener(int port, const std::string&
const std::string err = TryBindSocket(port, &socket, ip);
if (err.empty()) {
- boost::asio::socket_base::non_blocking_io socketCommand(true);
- socket->io_control(socketCommand);
+ socket->non_blocking(true);
mySocket = socket;
SetAcceptingConnections(true);

View File

@ -1,31 +0,0 @@
https://github.com/spring/spring/commit/a385d9d7715a
CMake Error at /usr/local/share/cmake/Modules/FindBoost.cmake:2049 (message):
Unable to find the requested Boost libraries.
Boost version: 1.69.0
Boost include path: /usr/local/include
Could not find the following Boost libraries:
boost_signals
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:245 (FIND_PACKAGE)
--- CMakeLists.txt.orig 2014-10-07 20:09:51 UTC
+++ CMakeLists.txt
@@ -242,7 +242,7 @@ if (MINGW)
set(SDL2_INCLUDE_DIR "${MINGWLIBS}/include/SDL2")
endif (MINGW)
-FIND_PACKAGE(Boost 1.47.0 COMPONENTS thread regex program_options system chrono signals filesystem REQUIRED)
+FIND_PACKAGE(Boost 1.47.0 COMPONENTS thread regex program_options system chrono filesystem REQUIRED)
FIND_PACKAGE(Boost 1.47.0 COMPONENTS timer)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})

View File

@ -0,0 +1,11 @@
--- doc/CMakeLists.txt.orig 2020-12-26 12:45:43 UTC
+++ doc/CMakeLists.txt
@@ -1,6 +1,7 @@
+option(ENABLE_MANPAGES "Enable manpages" FALSE)
### make and install the man pages
-if (UNIX)
+if (UNIX AND ENABLE_MANPAGES)
find_package(SevenZip)
set(AsciiDoc_FIND_QUIETLY TRUE)
find_package(AsciiDoc)

View File

@ -0,0 +1,8 @@
--- doc/manpages/make_manpages.sh.orig 2020-12-26 12:45:43 UTC
+++ doc/manpages/make_manpages.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
ORIG_DIR=$(pwd)

View File

@ -1,196 +0,0 @@
+++ rts/aGui/GuiElement.h 2015-04-08 15:06:26 -0400
@@ -4,4 +4,5 @@
#define GUIELEMENT_H
+#include <cmath>
#include <list>
#include <SDL_events.h>
+++ rts/lib/streflop/SMath.h
@@ -16,6 +16,8 @@
#ifndef STREFLOP_MATH_H
#define STREFLOP_MATH_H
+#include <cmath>
+
// just in case, should already be included
#include "streflop.h"
+++ rts/Sim/Weapons/LaserCannon.cpp 2015-04-07 20:49:52 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "LaserCannon.h"
#include "WeaponDef.h"
+++ rts/Sim/Weapons/FlameThrower.cpp 2015-04-07 20:50:46 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "FlameThrower.h"
#include "WeaponDef.h"
+++ rts/Sim/Weapons/MissileLauncher.cpp 2015-04-07 20:53:21 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "MissileLauncher.h"
#include "WeaponDef.h"
+++ rts/Sim/Weapons/EmgCannon.cpp 2015-04-07 20:57:50 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "EmgCannon.h"
#include "WeaponDef.h"
+++ rts/Sim/Units/Groups/GroupHandler.cpp 2015-04-08 16:24:53 -0400
@@ -2,4 +2,6 @@
#include <boost/cstdint.hpp>
+
+#include <cmath>
#include <SDL_keycode.h>
+++ rts/Sim/Weapons/TorpedoLauncher.cpp 2015-04-08 16:26:07 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "TorpedoLauncher.h"
#include "WeaponDef.h"
+++ rts/Game/Camera.cpp 2015-04-08 16:27:30 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
#include <string.h>
+++ rts/Game/InMapDraw.cpp 2015-04-08 16:44:34 -0400
@@ -1,6 +1,7 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
-#include "SDL_mouse.h"
-#include "SDL_keyboard.h"
+#include <cmath>
+#include <SDL_mouse.h>
+#include <SDL_keyboard.h>
#include "InMapDraw.h"
+++ rts/Game/PreGame.cpp 2015-04-08 16:45:50 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
#include <map>
#include <SDL_keycode.h>
+++ rts/Game/UI/MiniMap.cpp 2015-04-08 16:47:16 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
#include <SDL_keycode.h>
#include <SDL_mouse.h>
+++ rts/Rendering/GL/myGL.cpp 2015-04-08 16:51:02 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
#include <vector>
#include <string>
+++ rts/System/Input/Joystick.cpp 2015-04-08 16:54:28 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "InputHandler.h"
#include "Joystick.h"
+++ rts/System/SpringApp.cpp 2015-04-08 16:59:02 -0400
@@ -1,4 +1,6 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <cmath>
+
#include "System/Input/InputHandler.h"
+++ rts/Sim/Projectiles/WeaponProjectiles/LargeBeamLaserProjectile.cpp 2015-04-07 20:42:45 -0400
@@ -10,4 +10,5 @@
#include "System/myMath.h"
#include <cstring> //memset
+#include <cmath> // floor
CR_BIND_DERIVED(CLargeBeamLaserProjectile, CWeaponProjectile, (ProjectileParams()))
--- rts/System/Sync/SyncedFloat3.h 2014-10-07 20:09:51 UTC
+++ rts/System/Sync/SyncedFloat3.h 2015-04-24 08:44:31 -0400
@@ -13,4 +13,6 @@
#include "System/FastMath.h" //SSE (I)SQRT
+#include <math.h>
+
/**
* @brief SyncedFloat3 class
@@ -614,7 +616,7 @@
void AssertNaNs() const {
- assert(!math::isnan(x) && !math::isinf(x));
- assert(!math::isnan(y) && !math::isinf(y));
- assert(!math::isnan(z) && !math::isinf(z));
+ assert(!isnanf(x) && !__isinff(x));
+ assert(!isnanf(y) && !__isinff(y));
+ assert(!isnanf(z) && !__isinff(z));
}
+++ rts/Sim/Path/IPathController.cpp 2015-04-08 18:59:04 -0400
@@ -1,3 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <math.h>
+
#include "IPathController.hpp"
#include "Sim/Units/Unit.h"
@@ -27,8 +29,8 @@
const float rawSpeedDiff = (targetSpeed * targetSpeedSign) - (currentSpeed * currentSpeedSign);
- const float absSpeedDiff = math::fabs(rawSpeedDiff);
+ const float absSpeedDiff = fabsf(rawSpeedDiff);
// need to clamp, game-supplied values can be much larger than |speedDiff|
- const float modAccRate = std::min(absSpeedDiff, maxAccRate);
- const float modDecRate = std::min(absSpeedDiff, maxDecRate);
+ const float modAccRate = fminf(absSpeedDiff, maxAccRate);
+ const float modDecRate = fminf(absSpeedDiff, maxDecRate);
const float deltaSpeed = mix(modAccRate, -modDecRate, (rawSpeedDiff < 0.0f));
@@ -66,6 +68,6 @@
static float TurnAccelerationSign(float turnBrakeDist, short curDeltaHeading, short newDeltaHeading) {
- const bool b0 = (turnBrakeDist >= std::abs(curDeltaHeading));
- const bool b1 = (std::abs(newDeltaHeading) <= std::abs(curDeltaHeading));
+ const bool b0 = (turnBrakeDist >= abs(curDeltaHeading));
+ const bool b1 = (abs(newDeltaHeading) <= abs(curDeltaHeading));
const bool b2 = (Sign(curDeltaHeading) != Sign(newDeltaHeading));
@@ -86,5 +88,5 @@
const short curDeltaHeading = newHeading - short(oldHeading + (*curTurnSpeed) * (maxTurnAccel / maxTurnSpeed));
- const float minTurnAccel = std::min(float(std::abs(curDeltaHeading)), maxTurnAccel);
+ const float minTurnAccel = fminf(float(abs(curDeltaHeading)), maxTurnAccel);
const float rawTurnAccel = Clamp(Sign(curDeltaHeading) * maxTurnAccel, -minTurnAccel, minTurnAccel);
const float newTurnSpeed = Clamp((*curTurnSpeed) + rawTurnAccel * (1 - owner->IsInAir()), -maxTurnSpeed, maxTurnSpeed);
+++ rts/Sim/Projectiles/Unsynced/BitmapMuzzleFlame.cpp 2015-04-08 20:20:52 -0400
@@ -1,4 +1,5 @@
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
+#include <math.h>
#include "BitmapMuzzleFlame.h"
@@ -61,5 +62,5 @@
const float ilength = length * (igrowth + 1.0f);
- const float3 udir = (std::fabs(dir.dot(UpVector)) >= 0.99f)? FwdVector: UpVector;
+ const float3 udir = (fabsf(dir.dot(UpVector)) >= 0.99f)? FwdVector: UpVector;
const float3 xdir = (dir.cross(udir)).SafeANormalize();
const float3 ydir = (dir.cross(xdir)).SafeANormalize();

View File

@ -1,156 +0,0 @@
From
https://github.com/spring/KAIK/commit/42fec4393483d9c0dd049ca84bd230988c2fbdb6
--- AI/Skirmish/KAIK/CommandTracker.h
+++ AI/Skirmish/KAIK/CommandTracker.h
@@ -15,7 +15,7 @@ class CCommandTracker {
ai(aic),
maxCmdsPerFrame(0),
peakCmdFrame(0),
- avgCmdSize(0.0f),
+ //avgCmdSize(0.0f),
totalCmdSize(0),
totalNumCmds(0) {
}
@@ -31,7 +31,7 @@ class CCommandTracker {
int maxCmdsPerFrame;
int peakCmdFrame;
- float avgCmdSize;
+ //float avgCmdSize;
int totalCmdSize;
int totalNumCmds;
};
--- AI/Skirmish/KAIK/KAIK.cpp
+++ AI/Skirmish/KAIK/KAIK.cpp
@@ -107,7 +107,6 @@ void CKAIK::UnitFinished(int unitID) {
void CKAIK::UnitDestroyed(int unitID, int attackerUnitID) {
if (ai->Initialized()) {
- attackerUnitID = attackerUnitID;
ai->econTracker->UnitDestroyed(unitID);
if (ai->GetUnit(unitID)->groupID != -1) {
@@ -151,10 +150,6 @@ void CKAIK::UnitDamaged(int unitID, int attackerID, float damage, float3 dir) {
if (ai->GetUnit(unitID)->isDead) {
return;
}
-
- attackerID = attackerID;
- dir = dir;
-
ai->econTracker->UnitDamaged(unitID, damage);
}
}
@@ -169,25 +164,25 @@ void CKAIK::UnitMoveFailed(int unitID) {
void CKAIK::EnemyEnterLOS(int enemyUnitID) {
if (ai->Initialized()) {
- enemyUnitID = enemyUnitID;
+ //TODO
}
}
void CKAIK::EnemyLeaveLOS(int enemyUnitID) {
if (ai->Initialized()) {
- enemyUnitID = enemyUnitID;
+ //TODO
}
}
void CKAIK::EnemyEnterRadar(int enemyUnitID) {
if (ai->Initialized()) {
- enemyUnitID = enemyUnitID;
+ //TODO
}
}
void CKAIK::EnemyLeaveRadar(int enemyUnitID) {
if (ai->Initialized()) {
- enemyUnitID = enemyUnitID;
+ //TODO
}
}
@@ -201,9 +196,6 @@ void CKAIK::EnemyDestroyed(int enemyUnitID, int attackerUnitID) {
void CKAIK::EnemyDamaged(int enemyUnitID, int attackerUnitID, float damage, float3 dir) {
if (ai->Initialized()) {
ai->thm->EnemyDamaged(enemyUnitID, attackerUnitID);
-
- damage = damage;
- dir = dir;
}
}
@@ -222,7 +214,6 @@ void CKAIK::EnemyFinished(int enemyUnitID) {
void CKAIK::RecvChatMessage(const char* msg, int player) {
if (ai->Initialized()) {
- player = player;
if ((msg = strstr(msg, "KAIK::")) == NULL) {
return;
--- AI/Skirmish/KAIK/MetalMap.cpp
+++ AI/Skirmish/KAIK/MetalMap.cpp
@@ -219,8 +219,6 @@ void CMetalMap::GetMetalPoints() {
}
}
- // comment out for debug
- TotalMetal = TotalMetal;
}
// set that spot's metal making ability (divide by cells to values are small)
--- AI/Skirmish/KAIK/MetalMap.h
+++ AI/Skirmish/KAIK/MetalMap.h
@@ -36,7 +36,7 @@ class CMetalMap {
int TempMetal;
int coordx;
int coordy;
- int Minradius;
+ //int Minradius;
int MinMetalForSpot;
int XtractorRadius; // in metal map units
int DoubleRadius; // in metal map units
--- AI/Skirmish/KAIK/MicroPather.cpp
+++ AI/Skirmish/KAIK/MicroPather.cpp
@@ -60,7 +60,7 @@ using namespace NSMicroPather;
class OpenQueueBH {
public:
- OpenQueueBH(AIClasses* ai, PathNode** heapArray): ai(ai), size(0) {
+ OpenQueueBH(AIClasses* ai, PathNode** heapArray): size(0) {
this->heapArray = heapArray;
}
@@ -174,7 +174,6 @@ class OpenQueueBH {
private:
PathNode** heapArray;
- AIClasses* ai;
int size;
};
--- AI/Skirmish/KAIK/Unit.cpp
+++ AI/Skirmish/KAIK/Unit.cpp
@@ -93,8 +93,7 @@ bool CUNIT::CanAttack(int otherUnit) const {
return false;
}
-bool CUNIT::CanAttackMe(int otherUnit) const {
- otherUnit = otherUnit;
+bool CUNIT::CanAttackMe(int /*otherUnit*/) const {
// TODO: the function above, in reverse
return true;
}
--- AI/Skirmish/KAIK/UnitHandler.cpp
+++ AI/Skirmish/KAIK/UnitHandler.cpp
@@ -117,7 +117,6 @@ void CUnitHandler::IdleUnitUpdate(int frame) {
}
void CUnitHandler::UnitMoveFailed(int unitID) {
- unitID = unitID;
}
// called when unit nanoframe first created

View File

@ -1,11 +0,0 @@
Obtained from: http://www.viva64.com/en/b/0293/
--- rts/System/Platform/CpuID.cpp 2014-10-07 16:09:51 -0400
+++ rts/System/Platform/CpuID.cpp 2015-04-07 20:23:18 -0400
@@ -142,5 +142,5 @@
ExecCPUID(&eax, &ebx, &ecx, &edx);
- if ((ebx && 0xFFFF) == 0)
+ if ((ebx & 0xFFFF) == 0)
return;

View File

@ -1,8 +0,0 @@
+++ rts/System/Platform/Linux/CrashHandler.cpp 2015-04-08 20:09:33 -0400
@@ -344,5 +344,5 @@
boost::this_thread::sleep(boost::posix_time::seconds(10));
#if defined(__GNUC__)
- std::_Exit(-1);
+ _Exit(-1);
#else
std::quick_exit(-1);

View File

@ -1,9 +0,0 @@
+++ rts/System/Platform/Misc.cpp 2015-04-08 20:05:21 -0400
@@ -226,5 +226,6 @@
mib[2] = KERN_PROC_PATHNAME;
mib[3] = -1;
- char buf[PATH_MAX];
+ long maxpath = pathconf("/", _PC_PATH_MAX);
+ char buf[maxpath];
size_t cb = sizeof(buf);
int err = sysctl(mib, 4, buf, &cb, NULL, 0);

View File

@ -1,32 +0,0 @@
Modified for CMake 3.12 to drop FOLLOW_SYMLINKS in file(GLOB ...).
Obtained via: https://springrts.com/mantis/view.php?id=4679
From 9e0db5f602407de4e7875ca85761b41782c1bb9c Mon Sep 17 00:00:00 2001
From: Johan Rehnberg <cleanrock@gmail.com>
Date: Wed, 31 Dec 2014 11:35:19 +0100
Subject: [PATCH] fix GetListOfSubModules to support GLOB returning both "//"
and "/"
I needed this when building on archlinux with cmake 3.1.0 where GLOB returns "/"
...
--- rts/build/cmake/Util.cmake.orig 2014-10-07 20:09:51 UTC
+++ rts/build/cmake/Util.cmake
@@ -165,11 +165,12 @@ EndFunction (MakeGlobal)
# Find all CMakeLists.txt files in sub-directories
Macro (GetListOfSubModules list_var)
- File(GLOB ${list_var} RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" FOLLOW_SYMLINKS "${CMAKE_CURRENT_SOURCE_DIR}/*/CMakeLists.txt")
-
+ File(GLOB ${list_var} RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*/CMakeLists.txt")
# Strip away the "/CMakeLists.txt" parts, so we end up with just a list of dirs,
# for example: AAI;RAI;KAIK
- String(REPLACE "//CMakeLists.txt" "" ${list_var} "${${list_var}}")
+ # GLOB can prefix with "//" or "/" (perhaps changed in cmake 3.1.0), this double replace will support both "//" and "/"
+ String(REPLACE "/CMakeLists.txt" "" ${list_var} "${${list_var}}")
+ String(REPLACE "/" "" ${list_var} "${${list_var}}")
EndMacro (GetListOfSubModules list_var)

View File

@ -1,16 +0,0 @@
CMake 3.12 errors on FOLLOW_SYMLINKS (which was never supported for
file(GLOB ...) anyway, but was ignored).
See also https://springrts.com/mantis/view.php?id=6005
--- ./rts/build/cmake/UtilJava.cmake.bak 2014-10-07 22:09:51 UTC
+++ ./rts/build/cmake/UtilJava.cmake
@@ -45,7 +45,7 @@
# Returns the name of the first sub-dir (in alphabetical descending order)
# under dir.
macro (GetFirstSubDirName name_var dir)
- file(GLOB dirContent RELATIVE "${dir}" FOLLOW_SYMLINKS "${dir}/*")
+ file(GLOB dirContent RELATIVE "${dir}" "${dir}/*")
foreach (dirPart ${dirContent})
if (IS_DIRECTORY "${dir}/${dirPart}")
set(${name_var} ${dirPart})

View File

@ -1,13 +0,0 @@
Submitted upstream:
https://springrts.com/mantis/view.php?id=4731
--- rts/lib/headlessStubs/glstub.c 2014-10-07 16:09:52 -0400
+++ rts/lib/headlessStubs/glstub.c 2015-04-08 14:03:33 -0400
@@ -131,5 +131,5 @@
GLAPI void APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint *params) {}
GLAPI void APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) {}
-GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length) {}
+GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length) {}
GLAPI void APIENTRY glUniform1fARB(GLint location, GLfloat v0) {}

View File

@ -0,0 +1,7 @@
--- rts/Game/CMakeLists.txt.orig 2021-01-01 16:12:22 UTC
+++ rts/Game/CMakeLists.txt
@@ -1,3 +1,4 @@
+set_source_files_properties(GameSetup.cpp PROPERTIES CXX_STANDARD 14)
# This list was created using this *nix shell command:
# > find . -name "*.cpp" | sort

View File

@ -0,0 +1,11 @@
--- rts/Game/GameSetup.cpp.orig 2021-01-01 16:12:22 UTC
+++ rts/Game/GameSetup.cpp
@@ -255,7 +255,7 @@ void CGameSetup::LoadStartPositions(bool withoutMap)
// Server syncs these later, so we can use unsynced rng
CGlobalUnsyncedRNG rng;
rng.Seed(HsiehHash(setupText.c_str(), setupText.length(), 1234567));
- std::random_shuffle(teamStartNums.begin(), teamStartNums.begin() + teamStartingData.size(), rng);
+ std::shuffle(teamStartNums.begin(), teamStartNums.begin() + teamStartingData.size(), rng);
}
for (size_t i = 0; i < teamStartingData.size(); ++i)

View File

@ -0,0 +1,12 @@
https://github.com/spring/spring/pull/556
--- rts/Lua/LuaMaterial.h.orig 2021-01-01 19:08:25 UTC
+++ rts/Lua/LuaMaterial.h
@@ -6,6 +6,7 @@
#include <cstring> // strcmp
#include <string>
#include <vector>
+#include <array>
/*
LuaMaterial

View File

@ -0,0 +1,11 @@
--- rts/Rendering/Env/Decals/DecalsDrawerGL4.cpp.orig 2021-01-01 19:08:25 UTC
+++ rts/Rendering/Env/Decals/DecalsDrawerGL4.cpp
@@ -338,7 +338,7 @@ void CDecalsDrawerGL4::DetectMaxDecals()
decals.resize(maxDecals);
freeIds.resize(maxDecals - 1); // idx = 0 is invalid, so -1
std::iota(freeIds.begin(), freeIds.end(), 1); // start with 1, 0 is illegal
- std::random_shuffle(freeIds.begin(), freeIds.end(), guRNG);
+ std::shuffle(freeIds.begin(), freeIds.end(), guRNG);
groups.reserve(maxDecalGroups);
}

View File

@ -0,0 +1,12 @@
https://github.com/spring/spring/pull/554
--- rts/Rendering/LineDrawer.h.orig 2020-12-26 12:45:43 UTC
+++ rts/Rendering/LineDrawer.h
@@ -4,6 +4,7 @@
#define _LINE_DRAWER_H
#include <vector>
+#include <array>
#include "Game/UI/CursorIcons.h"
#include "Rendering/GL/VertexArrayTypes.h"

View File

@ -0,0 +1,7 @@
--- rts/Sim/CMakeLists.txt.orig 2021-01-01 16:12:22 UTC
+++ rts/Sim/CMakeLists.txt
@@ -1,3 +1,4 @@
+set(CMAKE_CXX_STANDARD 14)
# This list was created using this *nix shell command:
# > find . -name "*.cpp"" | sort

View File

@ -0,0 +1,13 @@
--- rts/Sim/Misc/SimObjectIDPool.cpp.orig 2020-12-26 12:45:43 UTC
+++ rts/Sim/Misc/SimObjectIDPool.cpp
@@ -25,8 +25,8 @@ void SimObjectIDPool::Expand(unsigned int baseID, unsi
std::generate(newIDs.begin(), newIDs.begin() + numIDs, [&baseID]() { return (baseID++); });
// randomize so that Lua widgets can not easily determine counts
- std::random_shuffle(newIDs.begin(), newIDs.begin() + numIDs, gsRNG);
- std::random_shuffle(newIDs.begin(), newIDs.begin() + numIDs, gsRNG);
+ std::shuffle(newIDs.begin(), newIDs.begin() + numIDs, gsRNG);
+ std::shuffle(newIDs.begin(), newIDs.begin() + numIDs, gsRNG);
// lambda capture ("[n = baseID]() mutable { return (n++); }") requires std=c++14
baseID -= numIDs;

View File

@ -0,0 +1,41 @@
--- rts/Sim/Projectiles/ProjectileHandler.cpp.orig 2020-12-26 12:45:43 UTC
+++ rts/Sim/Projectiles/ProjectileHandler.cpp
@@ -66,6 +66,18 @@ ProjMemPool projMemPool;
CProjectileHandler projectileHandler;
+namespace {
+ template<class RandomIt, class RandomFunc>
+ void random_shuffle(RandomIt first, RandomIt last, RandomFunc&& r)
+ {
+ typename std::iterator_traits<RandomIt>::difference_type i, n;
+ n = last - first;
+ for (i = n-1; i > 0; --i) {
+ using std::swap;
+ swap(first[i], first[r(i+1)]);
+ }
+ }
+}
void CProjectileHandler::Init()
{
@@ -106,8 +118,8 @@ void CProjectileHandler::Init()
freeProjectileIDs[false].push_back(i);
}
- std::random_shuffle(freeProjectileIDs[ true].begin(), freeProjectileIDs[ true].end(), gsRNG);
- std::random_shuffle(freeProjectileIDs[false].begin(), freeProjectileIDs[false].end(), guRNG);
+ ::random_shuffle(freeProjectileIDs[ true].begin(), freeProjectileIDs[ true].end(), gsRNG);
+ ::random_shuffle(freeProjectileIDs[false].begin(), freeProjectileIDs[false].end(), guRNG);
}
for (int modelType = 0; modelType < MODELTYPE_OTHER; ++modelType) {
@@ -395,7 +407,7 @@ void CProjectileHandler::AddProjectile(CProjectile* p)
// generate (newSize - oldSize) new id's starting from oldSize
std::for_each(freeIDs.begin(), freeIDs.end(), [k = oldSize](int& id) mutable { id = k++; });
- std::random_shuffle(freeIDs.begin(), freeIDs.end(), rngFunc);
+ ::random_shuffle(freeIDs.begin(), freeIDs.end(), rngFunc);
}

View File

@ -0,0 +1,11 @@
--- rts/System/CMakeLists.txt.orig 2020-12-26 12:45:43 UTC
+++ rts/System/CMakeLists.txt
@@ -140,7 +140,7 @@ set(sources_engine_System_Threading_Mac
"${CMAKE_CURRENT_SOURCE_DIR}/Platform/Mac/Signal.cpp"
)
set(sources_engine_System_Threading_Linux
- "${CMAKE_CURRENT_SOURCE_DIR}/Platform/Linux/Futex.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/Platform/Mac/Signal.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Platform/Linux/ThreadSupport.cpp"
)
set(sources_engine_System_Threading_Windows

View File

@ -0,0 +1,13 @@
https://github.com/spring/spring/pull/558
--- rts/System/GlobalRNG.h.orig 2021-01-01 16:12:22 UTC
+++ rts/System/GlobalRNG.h
@@ -100,6 +100,8 @@ template<typename RNG, bool synced> class CGlobalRNG {
typedef typename RNG::val_type rng_val_type;
typedef typename RNG::res_type rng_res_type;
+ using result_type = rng_res_type;
+
static_assert(std::numeric_limits<float>::digits == 24, "sign plus mantissa bits should be 24");
void Seed(rng_val_type seed) { SetSeed(seed); }

View File

@ -0,0 +1,19 @@
--- rts/System/Platform/Linux/Futex.h.orig 2020-12-26 12:45:43 UTC
+++ rts/System/Platform/Linux/Futex.h
@@ -8,7 +8,7 @@
#include "System/Misc/SpringTime.h"
-
+#ifndef __FreeBSD__
class spring_futex
{
private:
@@ -32,6 +32,7 @@ class spring_futex (public)
protected:
native_type mtx;
};
+#endif
/*FIXME
class recursive_futex

View File

@ -0,0 +1,19 @@
--- rts/System/Platform/Linux/ThreadSupport.cpp.orig 2021-01-01 16:12:22 UTC
+++ rts/System/Platform/Linux/ThreadSupport.cpp
@@ -7,6 +7,7 @@
#include <csignal>
#include <fstream>
#include <sys/syscall.h>
+#include <pthread_np.h>
#include "System/Log/ILog.h"
#include "System/Platform/Threading.h"
@@ -42,7 +43,7 @@ enum LinuxThreadState {
* There is no glibc wrapper for this system call, so you have to write one:
*/
static int gettid() {
- return syscall(SYS_gettid);
+ return pthread_getthreadid_np();
}
/**

View File

@ -0,0 +1,21 @@
--- rts/System/Platform/Misc.cpp.orig 2021-01-01 16:12:22 UTC
+++ rts/System/Platform/Misc.cpp
@@ -29,7 +29,9 @@
#include <mach-o/dyld.h>
#elif defined( __FreeBSD__)
+ #include <sys/types.h>
#include <sys/sysctl.h>
+ #include <ifaddrs.h>
#else
@@ -714,7 +716,7 @@ namespace Platform
return (GetMacType(macAddr, 0), macAddr);
}
- #elif defined(__APPLE__)
+ #elif defined(__APPLE__) || defined (__FreeBSD__)
std::array<uint8_t, 6> GetRawMacAddr() {
// TODO: http://lists.freebsd.org/pipermail/freebsd-hackers/2004-June/007415.html

View File

@ -1,28 +0,0 @@
In file included from rts/System/Sound/OpenAL/Sound.cpp:7:
/usr/local/include/AL/alc.h:34:16: error: typedef 'ALCdevice' cannot be referenced with a struct specifier
typedef struct ALCdevice ALCdevice;
^
rts/System/Sound/OpenAL/Sound.h:23:33: note: declared here
typedef struct ALCdevice_struct ALCdevice;
^
1 error generated.
--- rts/System/Sound/OpenAL/Sound.h.orig 2019-11-30 22:16:43 UTC
+++ rts/System/Sound/OpenAL/Sound.h
@@ -11,6 +11,7 @@
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/thread/recursive_mutex.hpp>
+#include <AL/alc.h>
#include "System/float3.h"
@@ -19,8 +20,6 @@
class CSoundSource;
class SoundBuffer;
class SoundItem;
-struct ALCdevice_struct;
-typedef struct ALCdevice_struct ALCdevice;
namespace boost {
class thread;

View File

@ -0,0 +1,12 @@
https://github.com/spring/spring/pull/555
--- rts/System/SpringHashMap.hpp.orig 2021-01-01 16:12:22 UTC
+++ rts/System/SpringHashMap.hpp
@@ -9,6 +9,7 @@
#include <cstdlib>
#include <iterator>
#include <utility>
+#include <algorithm>
#define DCHECK_EQ_F(a, b)
#define DCHECK_LT_F(a, b)

View File

@ -0,0 +1,12 @@
https://github.com/spring/spring/pull/555
--- rts/System/SpringHashSet.hpp.orig 2021-01-01 16:12:22 UTC
+++ rts/System/SpringHashSet.hpp
@@ -9,6 +9,7 @@
#include <cstdlib> // malloc
#include <iterator>
#include <utility>
+#include <algorithm> // fill_n
#define DCHECK_EQ_F(a, b)
#define DCHECK_LT_F(a, b)

View File

@ -0,0 +1,20 @@
--- rts/System/Threading/SpringThreading.h.orig 2020-12-26 12:45:43 UTC
+++ rts/System/Threading/SpringThreading.h
@@ -13,7 +13,7 @@
#if defined(_WIN32)
#include "System/Platform/Win/CriticalSection.h"
-#elif defined(__APPLE__) || !defined(USE_FUTEX)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || !defined(USE_FUTEX)
#include "System/Platform/Mac/Signal.h"
#elif !defined(__APPLE__) && defined(USE_FUTEX)
#include "System/Platform/Linux/Futex.h"
@@ -37,7 +37,7 @@ namespace spring {
typedef CriticalSection recursive_mutex;
typedef win_signal signal;
typedef std::condition_variable_any condition_variable;
-#elif defined(__APPLE__) || !defined(USE_FUTEX)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || !defined(USE_FUTEX)
typedef std::mutex mutex;
typedef std::recursive_mutex recursive_mutex;
typedef mac_signal signal;

View File

@ -0,0 +1,60 @@
--- rts/build/cmake/UtilVersion.cmake.orig 2020-12-26 12:45:43 UTC
+++ rts/build/cmake/UtilVersion.cmake
@@ -138,56 +138,7 @@ EndMacro (get_version_from_file)
# Sets the following vars:
# - ${prefix}_VERSION
Macro (fetch_spring_version dir prefix)
- # unset the vars
- Set(${prefix}_VERSION)
- Set(${prefix}_VERSION-NOTFOUND)
-
- If (EXISTS "${dir}/.git")
- # Try to fetch version through git
- If (NOT GIT_FOUND)
- Message(FATAL_ERROR "Git repository detected, but git executable not found; failed to fetch ${prefix} version.")
- EndIf (NOT GIT_FOUND)
-
- # Fetch git version info
- git_util_describe(${prefix}_Describe ${dir} "*")
- If (NOT ${prefix}_Describe)
- Message(FATAL_ERROR "Failed to fetch git-describe for ${prefix}.")
- EndIf (NOT ${prefix}_Describe)
- If ("${${prefix}_Describe}" MATCHES "^${VERSION_REGEX_RELEASE}$")
- Set(${prefix}_IsRelease TRUE)
- Else ("${${prefix}_Describe}" MATCHES "^${VERSION_REGEX_RELEASE}$")
- Set(${prefix}_IsRelease FALSE)
- EndIf ("${${prefix}_Describe}" MATCHES "^${VERSION_REGEX_RELEASE}$")
- If (NOT ${prefix}_IsRelease)
- # We always want the long git-describe output on non-releases
- # for example: 83.0.1-0-g1234567
- git_util_describe(${prefix}_Describe ${dir} "*" --long)
- EndIf (NOT ${prefix}_IsRelease)
-
- Git_Util_Branch(${prefix}_Branch ${dir})
- If (${prefix}_IsRelease)
- Set(${prefix}_VERSION "${${prefix}_Describe}")
- Else (${prefix}_IsRelease)
- If (NOT ${prefix}_Branch)
- Message(FATAL_ERROR "Failed to fetch the git branch for ${prefix}.")
- EndIf (NOT ${prefix}_Branch)
- Set(${prefix}_VERSION "${${prefix}_Describe} ${${prefix}_Branch}")
- EndIf (${prefix}_IsRelease)
- parse_spring_version(${prefix} "${${prefix}_VERSION}")
- If ("${${prefix}_Branch}" STREQUAL "master")
- If (NOT "${${prefix}_COMMITS}" STREQUAL "" OR NOT "${${prefix}_HASH}" STREQUAL "")
- Message(AUTHOR_WARNING "Commit without a version tag found on branch master for ${prefix}; this indicates a tagging/branching/push error.")
- EndIf (NOT "${${prefix}_COMMITS}" STREQUAL "" OR NOT "${${prefix}_HASH}" STREQUAL "")
- EndIf ("${${prefix}_Branch}" STREQUAL "master")
- Else (EXISTS "${dir}/.git")
- # Try to fetch version through VERSION file
- get_version_from_file(${prefix}_VERSION "${dir}/VERSION")
- If (${${prefix}_VERSION-NOTFOUND})
- Message(FATAL_ERROR "Failed to fetch ${prefix} version.")
- Else (${${prefix}_VERSION-NOTFOUND})
- Message(STATUS "${prefix} version fetched from VERSION file: ${${prefix}_VERSION}")
- EndIf (${${prefix}_VERSION-NOTFOUND})
- EndIf (EXISTS "${dir}/.git")
+ Set(${prefix}_VERSION $ENV{PORTVERSION})
if(DEFINED ENV{CI})
Message(STATUS "Build on travis-ci detected, not checking version (git clone --depth=...)")

View File

@ -0,0 +1,13 @@
https://github.com/spring/spring/pull/557
--- rts/builds/dedicated/main.cpp.orig 2020-12-26 12:45:43 UTC
+++ rts/builds/dedicated/main.cpp
@@ -4,6 +4,8 @@
#ifdef _WIN32
#include <windows.h>
+#else
+#include <unistd.h>
#endif
#include "Game/GameSetup.h"

View File

@ -0,0 +1,11 @@
--- tools/mapcompile/src/mapdecompile.cpp.orig 2020-12-19 22:58:47 UTC
+++ tools/mapcompile/src/mapdecompile.cpp
@@ -1,7 +1,7 @@
/* This file is part of SpringMapConvNG (GPL v2 or later), see the LICENSE file */
#include "SMFMap.h"
-#include <IL/il.h>
+#include <il.h>
#include <iostream>
#include <string.h>

View File

@ -0,0 +1,12 @@
https://github.com/spring/pr-downloader/pull/140
--- tools/pr-downloader/src/Downloader/Rapid/Sdp.cpp.orig 2020-12-20 17:04:22 UTC
+++ tools/pr-downloader/src/Downloader/Rapid/Sdp.cpp
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <curl/curl.h>
#include <stdlib.h>
+#include <errno.h>
#include "Sdp.h"
#include "RapidDownloader.h"

View File

@ -0,0 +1,12 @@
https://github.com/spring/pr-downloader/pull/141
--- tools/pr-downloader/src/FileSystem/FileSystem.cpp.orig 2020-12-20 17:04:22 UTC
+++ tools/pr-downloader/src/FileSystem/FileSystem.cpp
@@ -18,6 +18,7 @@
#include <sys/stat.h>
#include <dirent.h>
#include <stdlib.h>
+#include <unistd.h>
#ifdef _WIN32
#include <windows.h>

View File

@ -1,93 +0,0 @@
--- rts/builds/dedicated/CMakeLists.txt 2014-10-07 16:09:51 -0400
+++ rts/builds/dedicated/CMakeLists.txt 2015-04-08 15:27:03 -0400
@@ -43,19 +43,6 @@
ENDIF (UNIX AND NOT MINGW)
-IF (MINGW OR APPLE)
- # Windows:
- # We still need these header files,
- # even if we are not going to link with SDL.
- # We have them available anyway (mingwlibs).
- # OS X:
- # Cocoa requires the SDL libary, whenever the SDL headers are used,
- # due to some #define magic, which is practically impossible to workaround.
- FIND_PACKAGE(SDL2 REQUIRED)
- INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
-ELSE (MINGW OR APPLE)
- # Use a direct copy of the GL and SDL headers,
- # as these may not be available on headless systems.
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/SDL2)
-ENDIF (MINGW OR APPLE)
+FIND_PACKAGE(SDL2 REQUIRED)
+INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
--- rts/builds/headless/CMakeLists.txt 2014-10-07 16:09:51 -0400
+++ rts/builds/headless/CMakeLists.txt 2015-04-08 16:31:25 -0400
@@ -14,22 +14,7 @@
include_directories(${OPENAL_INCLUDE_DIR})
-IF (MINGW OR APPLE)
- # Windows:
- # We still need these header files,
- # even if we are not going to link with gl, glu and SDL.
- # We have them available anyway (mingwlibs).
- # OS X:
- # Cocoa requires the SDL libary, whenever the SDL headers are used,
- # due to some #define magic, which is practically impossible to workaround.
- FIND_PACKAGE(OpenGL REQUIRED)
- FIND_PACKAGE(SDL2 REQUIRED)
- INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
-ELSE (MINGW OR APPLE)
- # Use a direct copy of the GL and SDL headers,
- # as these may not be available on headless systems.
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/SDL2)
-ENDIF (MINGW OR APPLE)
+FIND_PACKAGE(SDL2 REQUIRED)
+INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
# headlessstubs are our stubs that replace libGL, libGLU, libGLEW, libSDL (yes really!)
--- rts/lib/headlessStubs/CMakeLists.txt 2014-10-07 16:09:52 -0400
+++ rts/lib/headlessStubs/CMakeLists.txt 2015-04-08 14:40:20 -0400
@@ -7,16 +7,6 @@
)
-IF (WIN32)
- # We still need these header files,
- # even if we are not going to link with SDL.
- # We have them available anyway (mingwlibs).
- FIND_PACKAGE(SDL2 REQUIRED)
- INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
-ELSE (WIN32)
- # Use a direct copy of the GL and SDL headers,
- # as these may not be available on headless systems.
- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/include)
- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/include/SDL2)
-ENDIF (WIN32)
+FIND_PACKAGE(SDL2 REQUIRED)
+INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
ADD_LIBRARY(headlessStubs STATIC EXCLUDE_FROM_ALL ${headlessStubsSources})
--- tools/unitsync/CMakeLists.txt 2014-10-07 16:09:52 -0400
+++ tools/unitsync/CMakeLists.txt 2015-04-08 16:10:11 -0400
@@ -22,16 +22,6 @@
ENDIF (WIN32)
-IF (MINGW)
- # We still need these header files,
- # even if we are not going to link with SDL.
- # We have them available anyway (mingwlibs).
- FIND_PACKAGE(SDL2 REQUIRED)
- INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
-ELSE (MINGW)
- # Use a direct copy of the GL and SDL headers,
- # as these may not be available on headless systems.
- INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/SDL2)
-ENDIF (MINGW)
-
+FIND_PACKAGE(SDL2 REQUIRED)
+INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
ADD_DEFINITIONS(-DUNITSYNC)

View File

@ -1,13 +1,15 @@
%%PR_DOWNLOADER%%bin/pr-downloader
bin/mapcompile
bin/mapdecompile
bin/pr-downloader
bin/spring
bin/spring-dedicated
bin/spring-headless
lib/libunitsync.so
%%MANPAGES%%man/man6/spring-dedicated.6.gz
%%MANPAGES%%man/man6/spring-headless.6.gz
%%MANPAGES%%man/man6/spring-legacy.6.gz
%%MANPAGES%%man/man6/spring.6.gz
share/applications/spring.desktop
%%MANPAGES%%share/man/man6/spring-dedicated.6.gz
%%MANPAGES%%share/man/man6/spring-headless.6.gz
%%MANPAGES%%share/man/man6/spring-legacy.6.gz
%%MANPAGES%%share/man/man6/spring.6.gz
share/mime/packages/spring.xml
share/pixmaps/application-x-spring-demo.png
share/pixmaps/spring.png