From 0fa9a2f46a949cdeb21edf60f85c59baaacd7a39 Mon Sep 17 00:00:00 2001 From: jankes44 Date: Mon, 22 Dec 2025 01:38:43 +0000 Subject: [PATCH] add handling for other linux distros --- src/db/CMakeLists.txt | 7 +++++-- src/game/CMakeLists.txt | 7 +++++-- src/game/ClientPackageCryptInfo.cpp | 2 +- src/game/main.cpp | 12 +++++++++--- src/libthecore/fdwatch.h | 2 +- src/libthecore/main.cpp | 2 ++ src/libthecore/signal.cpp | 2 +- src/qc/CMakeLists.txt | 7 +++++-- src/qc/qc.cpp | 1 + 9 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/db/CMakeLists.txt b/src/db/CMakeLists.txt index ac37748..578edd7 100644 --- a/src/db/CMakeLists.txt +++ b/src/db/CMakeLists.txt @@ -16,7 +16,10 @@ target_link_libraries(db ) if (WIN32) - target_link_libraries(db ws2_32) + target_link_libraries(db ws2_32) else() - target_link_libraries(db pthread md) + target_link_libraries(db pthread) + if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_link_libraries(db md) + endif() endif() diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index 00ec51c..b68cb0e 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -18,7 +18,10 @@ target_link_libraries(game ) if (WIN32) - target_link_libraries(game ws2_32) + target_link_libraries(game ws2_32) else() - target_link_libraries(game pthread md) + target_link_libraries(game pthread) + if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_link_libraries(game md) + endif() endif() diff --git a/src/game/ClientPackageCryptInfo.cpp b/src/game/ClientPackageCryptInfo.cpp index 32d3d12..5681df8 100644 --- a/src/game/ClientPackageCryptInfo.cpp +++ b/src/game/ClientPackageCryptInfo.cpp @@ -2,7 +2,7 @@ #include "ClientPackageCryptInfo.h" #include "common/stl.h" -#ifndef OS_FREEBSD +#ifdef OS_WINDOWS #include "libthecore/xdirent.h" #endif diff --git a/src/game/main.cpp b/src/game/main.cpp index 4536fd8..5779650 100644 --- a/src/game/main.cpp +++ b/src/game/main.cpp @@ -520,7 +520,9 @@ int start(int argc, char **argv) printf("IP %s\n", g_szPublicIP); optind++; - optreset = 1; + #ifdef OS_FREEBSD + optreset = 1; + #endif break; case 'p': // port @@ -535,7 +537,9 @@ int start(int argc, char **argv) printf("port %d\n", mother_port); optind++; - optreset = 1; + #ifdef OS_FREEBSD + optreset = 1; + #endif break; // LOCALE_SERVICE @@ -544,7 +548,9 @@ int start(int argc, char **argv) if (optind < argc) { st_localeServiceName = argv[optind++]; - optreset = 1; + #ifdef OS_FREEBSD + optreset = 1; + #endif } } break; diff --git a/src/libthecore/fdwatch.h b/src/libthecore/fdwatch.h index 9b9a77f..39829a9 100644 --- a/src/libthecore/fdwatch.h +++ b/src/libthecore/fdwatch.h @@ -1,6 +1,6 @@ #pragma once -#ifndef OS_WINDOWS +#ifndef __USE_SELECT__ typedef struct fdwatch FDWATCH; typedef struct fdwatch * LPFDWATCH; diff --git a/src/libthecore/main.cpp b/src/libthecore/main.cpp index 6ebdc5a..4d3cdc9 100644 --- a/src/libthecore/main.cpp +++ b/src/libthecore/main.cpp @@ -49,7 +49,9 @@ int thecore_init(int fps, HEARTFUNC heartbeat_func) srand(time(0)); #else srandom(time(0) + getpid() + getuid()); +#ifdef OS_FREEBSD srandomdev(); +#endif #endif log_init(); diff --git a/src/libthecore/signal.cpp b/src/libthecore/signal.cpp index e6ae8a2..2856993 100644 --- a/src/libthecore/signal.cpp +++ b/src/libthecore/signal.cpp @@ -4,7 +4,7 @@ void signal_setup() {} void signal_timer_disable() {} void signal_timer_enable(int timeout_seconds) {} -#elif OS_FREEBSD +#else #define RETSIGTYPE void RETSIGTYPE reap(int sig) diff --git a/src/qc/CMakeLists.txt b/src/qc/CMakeLists.txt index 7ef5c64..414a429 100644 --- a/src/qc/CMakeLists.txt +++ b/src/qc/CMakeLists.txt @@ -7,7 +7,10 @@ target_link_libraries(qc ) if (WIN32) - target_link_libraries(qc ws2_32) + target_link_libraries(qc ws2_32) else() - target_link_libraries(qc pthread md) + target_link_libraries(qc pthread) + if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_link_libraries(qc md) + endif() endif() diff --git a/src/qc/qc.cpp b/src/qc/qc.cpp index 81b14d2..e4aafb2 100644 --- a/src/qc/qc.cpp +++ b/src/qc/qc.cpp @@ -29,6 +29,7 @@ extern "C" #include #include #include +#include #include "crc32.h"