From c65b97f9fda726ab746a98827bb935ccc3064a28 Mon Sep 17 00:00:00 2001 From: Qais Patankar Date: Tue, 21 May 2019 01:37:05 +0100 Subject: [PATCH] macOS: rename MTA_LIB_EXTENSION to `.dylib` Also add net build support to install_data.lua --- Server/mods/deathmatch/logic/CPerfStat.LibMemory.cpp | 2 ++ Server/sdk/MTAPlatform.h | 4 ++-- linux-install-data.sh | 7 ++++++- utils/buildactions/install_data.lua | 11 ++++++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Server/mods/deathmatch/logic/CPerfStat.LibMemory.cpp b/Server/mods/deathmatch/logic/CPerfStat.LibMemory.cpp index 9755128675..e597217246 100644 --- a/Server/mods/deathmatch/logic/CPerfStat.LibMemory.cpp +++ b/Server/mods/deathmatch/logic/CPerfStat.LibMemory.cpp @@ -218,6 +218,8 @@ void CPerfStatLibMemoryImpl::GetLibMemoryStats(CPerfStatResult* pResult, const s #endif #ifdef WIN32 info.strName += ".dll"; + #elif defined(__APPLE__) + info.strName += ".dylib"; #else info.strName += ".so"; #endif diff --git a/Server/sdk/MTAPlatform.h b/Server/sdk/MTAPlatform.h index b80348ea4f..bf2a209eb6 100644 --- a/Server/sdk/MTAPlatform.h +++ b/Server/sdk/MTAPlatform.h @@ -34,7 +34,7 @@ extern "C" bool g_bNoTopBar; #define MTA_LIB_EXTENSION ".so" #elif defined(__APPLE__) #define MTA_OS_STRING "macOS" - #define MTA_LIB_EXTENSION ".so" + #define MTA_LIB_EXTENSION ".dylib" #else #error "Unsupported operating system" #endif @@ -82,7 +82,7 @@ typedef int socklen_t; #include #elif __has_include() #include - #else + #else #include #endif diff --git a/linux-install-data.sh b/linux-install-data.sh index 72411fe54f..c12b14208d 100755 --- a/linux-install-data.sh +++ b/linux-install-data.sh @@ -1,6 +1,11 @@ #!/bin/bash -PREMAKE5=utils/premake5 +# Find premake binary location +if [ "$(uname)" == "Darwin" ]; then + PREMAKE5=utils/premake5-macos +else + PREMAKE5=utils/premake5 +fi # Install data files $PREMAKE5 install_data diff --git a/utils/buildactions/install_data.lua b/utils/buildactions/install_data.lua index 78af50a200..441a56a1dc 100644 --- a/utils/buildactions/install_data.lua +++ b/utils/buildactions/install_data.lua @@ -13,6 +13,8 @@ local NETC_PATH_WIN = "https://mirror.mtasa.com/bdata/netc.dll" local NET_PATH_X86_LINUX = "https://mirror.mtasa.com/bdata/net.so" local NET_PATH_X64_LINUX = "https://mirror.mtasa.com/bdata/net_64.so" +local NET_PATH_X64_MACOS = "https://mirror.mtasa.com/bdata/net.dylib" + newaction { trigger = "install_data", description = "Installs data files", @@ -32,7 +34,7 @@ newaction { -- Make sure server/x64 directory exists os.mkdir(BIN_DIR.."/server/x64") - + if os.host() == "windows" then http.download_print_errors(NET_PATH_X86_WIN, BIN_DIR.."/server/net.dll") http.download_print_errors(NET_PATH_X64_WIN, BIN_DIR.."/server/x64/net.dll") @@ -41,6 +43,13 @@ newaction { os.copyfile(BIN_DIR.."/MTA/netc.dll", BIN_DIR.."/MTA/netc_d.dll") os.copyfile(BIN_DIR.."/server/net.dll", BIN_DIR.."/server/net_d.dll") os.copyfile(BIN_DIR.."/server/x64/net.dll", BIN_DIR.."/server/x64/net_d.dll") + elseif os.host() == "macosx" then + local c = string.char(27) + print(string.format("Listen, I ain't leaving here till you tell me where the macOS net builds are.\n " .. + " So come on bub, for old times' sake, huh?\n\t%s[45m%s[37mDid you just call me... BLOB?%s[0m\n", c,c,c,c)) + + http.download_print_errors(NET_PATH_X64_MACOS, BIN_DIR.."/server/x64/net.dylib") + os.copyfile(BIN_DIR.."/server/x64/net.dylib", BIN_DIR.."/server/x64/net_d.dylib") else http.download_print_errors(NET_PATH_X86_LINUX, BIN_DIR.."/server/net.so") http.download_print_errors(NET_PATH_X64_LINUX, BIN_DIR.."/server/x64/net.so")