Skip to content

Commit

Permalink
macOS: rename MTA_LIB_EXTENSION to .dylib
Browse files Browse the repository at this point in the history
Also add net build support to install_data.lua
  • Loading branch information
qaisjp committed May 21, 2019
1 parent 0db1c3d commit c65b97f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Server/mods/deathmatch/logic/CPerfStat.LibMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Server/sdk/MTAPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -82,7 +82,7 @@ typedef int socklen_t;
#include <ncurses.h>
#elif __has_include(<ncursesw/curses.h>)
#include <ncursesw/curses.h>
#else
#else
#include <ncurses.h>
#endif

Expand Down
7 changes: 6 additions & 1 deletion linux-install-data.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 10 additions & 1 deletion utils/buildactions/install_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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")
Expand All @@ -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")
Expand Down

2 comments on commit c65b97f

@onikyannn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to download from "https://mirror.mtasa.com/bdata/net.dylib" give 404 error.

@qaisjp
Copy link
Contributor Author

@qaisjp qaisjp commented on c65b97f Feb 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short answer: Yes, unfortunately we do not have a macOS build server.


Long answer: Yes, unfortunately we do not have a macOS build server.

To compile on the build server, we could try one of the following things:

Alternatively, we could take advantage of GitHub Actions' pricing model for private repositories:

  • Free accounts (can now create private repos with up to 3 collaborators) have 2,000 minutes free per month
  • Pro accounts have 3,000 minutes free per month

So, that's about 200 to 300 builds per month, depending on which developer hosts the mirror. Assuming a, say, 10 minute build time + Actions only being used for macOS builds.

Also, the net library probably doesn't compile on macOS.

Please sign in to comment.