4 Commits
0.0.7 ... 0.0.8

Author SHA1 Message Date
ba269b6a63 build: add back x64 macos build 2025-02-08 18:27:35 +01:00
6ed6d552ec build: downgrade ubuntu 2025-02-06 12:05:46 +01:00
da27f374ef chore: remove _s functions 2025-02-06 11:48:54 +01:00
32a000195f chore: update deps 2025-01-17 14:37:17 +01:00
13 changed files with 54 additions and 46 deletions

View File

@ -75,7 +75,7 @@ jobs:
build-linux:
name: Build Linux
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
@ -94,18 +94,12 @@ jobs:
# NOTE - If LFS ever starts getting used during builds, switch this to true!
lfs: false
- name: Install dependencies (arm64)
if: matrix.arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get -y install crossbuild-essential-arm64
- name: Install dependencies (x86)
if: matrix.arch == 'x86'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install gcc-multilib g++-multilib
sudo apt-get install gcc-multilib g++-multilib -y
- name: Install Premake5
uses: diamante0018/setup-premake@master
@ -116,22 +110,14 @@ jobs:
uses: rui314/setup-mold@staging
- name: Generate project files
working-directory: ${{ github.workspace }}
run: premake5 gmake2
- name: Set up problem matching
uses: ammaraskar/gcc-problem-matcher@master
- name: Set up CC environment variable
if: matrix.arch == 'arm64'
run: |
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Set up CXX environment variable
if: matrix.arch == 'arm64'
run: |
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
- name: Build ${{matrix.arch}} ${{matrix.configuration}} binaries
working-directory: ${{ github.workspace }}
run: |
pushd build
make config=${{matrix.configuration}}_${{matrix.arch}} -j$(nproc)
@ -153,6 +139,7 @@ jobs:
- debug
- release
arch:
- x64
- arm64
steps:
- name: Check out files
@ -244,7 +231,7 @@ jobs:
shell: bash
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3.6.1
uses: docker/setup-buildx-action@v3.8.0
- name: Login to DockerHub
uses: docker/login-action@v3.3.0
@ -253,7 +240,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5.5.1
uses: docker/metadata-action@v5.6.1
with:
images: |
alterware/master-server
@ -263,7 +250,7 @@ jobs:
- name: Build and Push Docker Image
id: build-and-push
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.13.0
with:
context: .
platforms: linux/amd64

View File

@ -11,6 +11,29 @@ Run using [Docker][docker-link]
docker run -p 20810:20810/udp -e AW_STATS_LOCATION=<UTF-8 C-string> alterware/master-server:latest
```
or run as a systemd service
```
[Unit]
Description=AlterWare Master Server
After=network.target
[Service]
Type=simple
ExecStart=<working dir>/alterware-master
WorkingDirectory=<working dir>
Environment="AW_STATS_LOCATION=/var/www/<domain name>/html/stats.json"
StandardOutput=null
Restart=on-failure
RestartSec=10
KillMode=process
User=<username>
Group=<group name>
[Install]
WantedBy=multi-user.target
```
## Build
- Install [Premake5][premake5-link] and add it to your system PATH
- Clone this repository using [Git][git-link]
@ -23,10 +46,9 @@ Requirements for Unix systems:
- Dependencies: Ensure the LLVM C++ Standard library is installed
- Alternative compilers: If you opt for a different compiler such as GCC, use the [Mold][mold-link] linker
- Customization: Modifications to the Premake5.lua script may be required
- Platform support: Details regarding supported platforms are available in [build.yml][build-link]
- Platform support: Details regarding supported platforms are available in [build.yml](.github/workflows/build.yml). Linux ARM64 should be supported out of the box even if it's not present in the CI scripts
[docker-link]: https://www.docker.com
[premake5-link]: https://premake.github.io
[git-link]: https://git-scm.com
[mold-link]: https://github.com/rui314/mold
[build-link]: https://github.com/alterware/master-server/blob/master/.github/workflows/build.yml

2
deps/GSL vendored

Submodule deps/GSL updated: f1a494cfd2...355982daf6

View File

@ -47,6 +47,8 @@ function libtomcrypt.project()
"LTC_SOURCE",
"_LIB",
"USE_LTM",
"LTC_NO_TEST",
"LTC_NO_PROTOTYPES"
}
removedefines {
@ -54,15 +56,13 @@ function libtomcrypt.project()
"_USRDLL",
}
if os.istarget("darwin") then
filter "platforms:x64"
buildoptions "-march=native"
filter {}
filter { "system:macosx", "platforms:arm64" }
buildoptions "-mcpu=apple-m1"
filter {}
filter "platforms:arm64"
buildoptions "-mcpu=apple-m1"
filter {}
end
filter { "system:macosx", "platforms:x64" }
buildoptions "-mcpu=x86-64"
filter {}
warnings "Off"
kind "StaticLib"

2
deps/rapidjson vendored

2
deps/zlib vendored

Submodule deps/zlib updated: d476828316...ef24c4c750

View File

@ -85,6 +85,11 @@ if os.istarget("linux") then
filter {}
end
filter { "system:macosx", "platforms:x64" }
buildoptions "-arch x86_64"
linkoptions "-arch x86_64"
filter {}
filter { "system:macosx", "platforms:arm64" }
buildoptions "-arch arm64"
linkoptions "-arch arm64"

View File

@ -65,11 +65,7 @@ namespace console
{
static thread_local char buffer[0x1000];
#ifdef _WIN32
const int count = vsnprintf_s(buffer, _TRUNCATE, message, *ap);
#else
const int count = vsnprintf(buffer, sizeof(buffer), message, *ap);
#endif
if (count < 0) return {};
return {buffer, static_cast<size_t>(count)};

View File

@ -39,7 +39,7 @@ int main(const int argc, const char** argv)
}
catch (std::exception& e)
{
console::error("Fatal error: %s\n", e.what());
console::error("Fatal error: %s", e.what());
return -1;
}

View File

@ -41,10 +41,12 @@ namespace
const auto location = utils::env::get_value("AW_STATS_LOCATION");
if (location.empty())
{
console::error("The environment variable 'AW_STATS_LOCATION' is not set. Please set 'AW_STATS_LOCATION' to specify the save location for 'stats.json'\n");
console::error("The environment variable 'AW_STATS_LOCATION' is not set. Please set 'AW_STATS_LOCATION' to specify the save location for 'stats.json'");
return;
}
console::info("Writing stats to %s", location.c_str());
utils::io::write_file(location, root_data);
}
}

View File

@ -29,11 +29,7 @@ namespace utils::string
while (true)
{
#ifdef _WIN32
const auto res = vsnprintf_s(entry->buffer_, entry->size_, _TRUNCATE, format, ap);
#else
const auto res = vsnprintf(entry->buffer_, entry->size_, format, ap);
#endif
if (res > 0) break; // Success
if (res == 0) return nullptr; // Error