From 539c20a200aba6cf326d502986f3c7fd42e5be32 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 18 Aug 2020 15:03:09 +0200 Subject: [PATCH] Add support for PLATFORM_SUFFIX define So that we can set it like this: CXXFLAGS='-DPLATFORM_SUFFIX="steam"' CPPFLAGS='-DPLATFORM_SUFFIX="steam"' make --- src/base/detect.h | 30 ++++++++++++++++++------------ src/engine/client/http.cpp | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/base/detect.h b/src/base/detect.h index 65b69764f..48b263ced 100644 --- a/src/base/detect.h +++ b/src/base/detect.h @@ -16,12 +16,12 @@ #define CONF_FAMILY_WINDOWS 1 #define CONF_FAMILY_STRING "windows" #define CONF_PLATFORM_WIN64 1 - #define CONF_PLATFORM_STRING "win64" + #define PLATFORM_STRING "win64" #elif defined(WIN32) || defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) #define CONF_FAMILY_WINDOWS 1 #define CONF_FAMILY_STRING "windows" #define CONF_PLATFORM_WIN32 1 - #define CONF_PLATFORM_STRING "win32" + #define PLATFORM_STRING "win32" #endif /* unix family */ @@ -29,49 +29,49 @@ #define CONF_FAMILY_UNIX 1 #define CONF_FAMILY_STRING "unix" #define CONF_PLATFORM_FREEBSD 1 - #define CONF_PLATFORM_STRING "freebsd" + #define PLATFORM_STRING "freebsd" #endif #if defined(__NetBSD__) #define CONF_FAMILY_UNIX 1 #define CONF_FAMILY_STRING "unix" #define CONF_PLATFORM_NETBSD 1 - #define CONF_PLATFORM_STRING "netbsd" + #define PLATFORM_STRING "netbsd" #endif #if defined(__OpenBSD__) #define CONF_FAMILY_UNIX 1 #define CONF_FAMILY_STRING "unix" #define CONF_PLATFORM_OPENBSD 1 - #define CONF_PLATFORM_STRING "openbsd" + #define PLATFORM_STRING "openbsd" #endif #if defined(__LINUX__) || defined(__linux__) #define CONF_FAMILY_UNIX 1 #define CONF_FAMILY_STRING "unix" #define CONF_PLATFORM_LINUX 1 - #define CONF_PLATFORM_STRING "linux" + #define PLATFORM_STRING "linux" #endif #if defined(__GNU__) || defined(__gnu__) #define CONF_FAMILY_UNIX 1 #define CONF_FAMILY_STRING "unix" #define CONF_PLATFORM_HURD 1 - #define CONF_PLATFORM_STRING "gnu" + #define PLATFORM_STRING "gnu" #endif #if defined(MACOSX) || defined(__APPLE__) || defined(__DARWIN__) #define CONF_FAMILY_UNIX 1 #define CONF_FAMILY_STRING "unix" #define CONF_PLATFORM_MACOSX 1 - #define CONF_PLATFORM_STRING "macosx" + #define PLATFORM_STRING "macosx" #endif #if defined(__sun) #define CONF_FAMILY_UNIX 1 #define CONF_FAMILY_STRING "unix" #define CONF_PLATFORM_SOLARIS 1 - #define CONF_PLATFORM_STRING "solaris" + #define PLATFORM_STRING "solaris" #endif /* beos family */ @@ -79,7 +79,7 @@ #define CONF_FAMILY_BEOS 1 #define CONF_FAMILY_STRING "beos" #define CONF_PLATFORM_BEOS 1 - #define CONF_PLATFORM_STRING "beos" + #define PLATFORM_STRING "beos" #endif @@ -156,10 +156,16 @@ #define CONF_FAMILY_STRING "unknown" #endif -#ifndef CONF_PLATFORM_STRING -#define CONF_PLATFORM_STRING "unknown" +#ifndef PLATFORM_STRING +#define PLATFORM_STRING "unknown" #endif +#ifndef PLATFORM_SUFFIX +#define PLATFORM_SUFFIX "" +#endif + +#define CONF_PLATFORM_STRING PLATFORM_STRING PLATFORM_SUFFIX + #ifndef CONF_ARCH_STRING #define CONF_ARCH_STRING "unknown" #endif diff --git a/src/engine/client/http.cpp b/src/engine/client/http.cpp index 3be17e5cd..a3dbe4a3a 100644 --- a/src/engine/client/http.cpp +++ b/src/engine/client/http.cpp @@ -136,7 +136,7 @@ int CRequest::RunImpl(CURL *pHandle) curl_easy_setopt(pHandle, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(pHandle, CURLOPT_URL, m_aUrl); curl_easy_setopt(pHandle, CURLOPT_NOSIGNAL, 1L); - curl_easy_setopt(pHandle, CURLOPT_USERAGENT, "DDNet " GAME_RELEASE_VERSION " (" CONF_PLATFORM_STRING "; " CONF_ARCH_STRING ")"); + curl_easy_setopt(pHandle, CURLOPT_USERAGENT, GAME_NAME " " GAME_RELEASE_VERSION " (" CONF_PLATFORM_STRING "; " CONF_ARCH_STRING ")"); // We only trust our own custom-selected CAs for our own servers. // Other servers can use any CA trusted by the system.