From fa46f13b0920b4255781db55d9244a723975b1b2 Mon Sep 17 00:00:00 2001 From: Kaiser Date: Wed, 8 Dec 2021 18:06:26 -0500 Subject: [PATCH] feat(Core/Build): Patched to be buildable on FreeBSD 13.0-RELEASE (#9568) --- deps/g3dlite/include/G3D/System.h | 3 +-- deps/g3dlite/source/FileSystem.cpp | 8 ++++---- src/common/Utilities/Util.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/deps/g3dlite/include/G3D/System.h b/deps/g3dlite/include/G3D/System.h index 9ed88957d..10995247b 100644 --- a/deps/g3dlite/include/G3D/System.h +++ b/deps/g3dlite/include/G3D/System.h @@ -20,8 +20,7 @@ #include "G3D/BinaryFormat.h" #include "G3D/FileNotFound.h" #include - -#if defined(__aarch64__) +#if defined(__aarch64__) || defined(__FreeBSD__) #include #endif diff --git a/deps/g3dlite/source/FileSystem.cpp b/deps/g3dlite/source/FileSystem.cpp index 06e6ff00a..eb41522f7 100644 --- a/deps/g3dlite/source/FileSystem.cpp +++ b/deps/g3dlite/source/FileSystem.cpp @@ -26,9 +26,9 @@ // Needed for _findfirst # include # ifdef __MINGW32__ -# define stat64 stat +# define stat stat # else -# define stat64 _stat64 +# define stat _stat # endif #else # include @@ -580,8 +580,8 @@ bool FileSystem::_isNewer(const std::string& _src, const std::string& _dst) { int64 FileSystem::_size(const std::string& _filename) { const std::string& filename = FilePath::canonicalize(FilePath::expandEnvironmentVariables(_filename)); - struct stat64 st; - int result = stat64(filename.c_str(), &st); + struct stat st; + int result = stat(filename.c_str(), &st); if (result == -1) { #if _HAVE_ZIP /* G3DFIX: Use ZIP-library only if defined */ diff --git a/src/common/Utilities/Util.cpp b/src/common/Utilities/Util.cpp index 46e4c43bf..53af88440 100644 --- a/src/common/Utilities/Util.cpp +++ b/src/common/Utilities/Util.cpp @@ -89,6 +89,12 @@ time_t LocalTimeToUTCTime(time_t time) { #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) return time + _timezone; +#elif defined(__FreeBSD__) + struct tm tm; + + gmtime_r(&time, &tm); + tm.tm_isdst = -1; + return mktime(&tm); #else return time + timezone; #endif