mirror of
https://github.com/alterware/master-server.git
synced 2025-07-04 02:01:51 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
ba269b6a63
|
|||
6ed6d552ec
|
|||
da27f374ef
|
|||
32a000195f
|
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
@ -75,7 +75,7 @@ jobs:
|
|||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
name: Build Linux
|
name: Build Linux
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -94,18 +94,12 @@ jobs:
|
|||||||
# NOTE - If LFS ever starts getting used during builds, switch this to true!
|
# NOTE - If LFS ever starts getting used during builds, switch this to true!
|
||||||
lfs: false
|
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)
|
- name: Install dependencies (x86)
|
||||||
if: matrix.arch == 'x86'
|
if: matrix.arch == 'x86'
|
||||||
run: |
|
run: |
|
||||||
sudo dpkg --add-architecture i386
|
sudo dpkg --add-architecture i386
|
||||||
sudo apt-get update
|
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
|
- name: Install Premake5
|
||||||
uses: diamante0018/setup-premake@master
|
uses: diamante0018/setup-premake@master
|
||||||
@ -116,22 +110,14 @@ jobs:
|
|||||||
uses: rui314/setup-mold@staging
|
uses: rui314/setup-mold@staging
|
||||||
|
|
||||||
- name: Generate project files
|
- name: Generate project files
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
run: premake5 gmake2
|
run: premake5 gmake2
|
||||||
|
|
||||||
- name: Set up problem matching
|
- name: Set up problem matching
|
||||||
uses: ammaraskar/gcc-problem-matcher@master
|
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
|
- name: Build ${{matrix.arch}} ${{matrix.configuration}} binaries
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
run: |
|
run: |
|
||||||
pushd build
|
pushd build
|
||||||
make config=${{matrix.configuration}}_${{matrix.arch}} -j$(nproc)
|
make config=${{matrix.configuration}}_${{matrix.arch}} -j$(nproc)
|
||||||
@ -153,6 +139,7 @@ jobs:
|
|||||||
- debug
|
- debug
|
||||||
- release
|
- release
|
||||||
arch:
|
arch:
|
||||||
|
- x64
|
||||||
- arm64
|
- arm64
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files
|
- name: Check out files
|
||||||
@ -244,7 +231,7 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3.6.1
|
uses: docker/setup-buildx-action@v3.8.0
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v3.3.0
|
uses: docker/login-action@v3.3.0
|
||||||
@ -253,7 +240,7 @@ jobs:
|
|||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- id: meta
|
- id: meta
|
||||||
uses: docker/metadata-action@v5.5.1
|
uses: docker/metadata-action@v5.6.1
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
alterware/master-server
|
alterware/master-server
|
||||||
@ -263,7 +250,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and Push Docker Image
|
- name: Build and Push Docker Image
|
||||||
id: build-and-push
|
id: build-and-push
|
||||||
uses: docker/build-push-action@v6.7.0
|
uses: docker/build-push-action@v6.13.0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
|
26
README.md
26
README.md
@ -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
|
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
|
## Build
|
||||||
- Install [Premake5][premake5-link] and add it to your system PATH
|
- Install [Premake5][premake5-link] and add it to your system PATH
|
||||||
- Clone this repository using [Git][git-link]
|
- Clone this repository using [Git][git-link]
|
||||||
@ -23,10 +46,9 @@ Requirements for Unix systems:
|
|||||||
- Dependencies: Ensure the LLVM C++ Standard library is installed
|
- 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
|
- 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
|
- 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
|
[docker-link]: https://www.docker.com
|
||||||
[premake5-link]: https://premake.github.io
|
[premake5-link]: https://premake.github.io
|
||||||
[git-link]: https://git-scm.com
|
[git-link]: https://git-scm.com
|
||||||
[mold-link]: https://github.com/rui314/mold
|
[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
2
deps/GSL
vendored
Submodule deps/GSL updated: f1a494cfd2...355982daf6
2
deps/libtomcrypt
vendored
2
deps/libtomcrypt
vendored
Submodule deps/libtomcrypt updated: fc6b42025b...54f0456559
2
deps/libtommath
vendored
2
deps/libtommath
vendored
Submodule deps/libtommath updated: 5809141a3a...5938524c60
14
deps/premake/libtomcrypt.lua
vendored
14
deps/premake/libtomcrypt.lua
vendored
@ -47,6 +47,8 @@ function libtomcrypt.project()
|
|||||||
"LTC_SOURCE",
|
"LTC_SOURCE",
|
||||||
"_LIB",
|
"_LIB",
|
||||||
"USE_LTM",
|
"USE_LTM",
|
||||||
|
"LTC_NO_TEST",
|
||||||
|
"LTC_NO_PROTOTYPES"
|
||||||
}
|
}
|
||||||
|
|
||||||
removedefines {
|
removedefines {
|
||||||
@ -54,15 +56,13 @@ function libtomcrypt.project()
|
|||||||
"_USRDLL",
|
"_USRDLL",
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.istarget("darwin") then
|
filter { "system:macosx", "platforms:arm64" }
|
||||||
filter "platforms:x64"
|
|
||||||
buildoptions "-march=native"
|
|
||||||
filter {}
|
|
||||||
|
|
||||||
filter "platforms:arm64"
|
|
||||||
buildoptions "-mcpu=apple-m1"
|
buildoptions "-mcpu=apple-m1"
|
||||||
filter {}
|
filter {}
|
||||||
end
|
|
||||||
|
filter { "system:macosx", "platforms:x64" }
|
||||||
|
buildoptions "-mcpu=x86-64"
|
||||||
|
filter {}
|
||||||
|
|
||||||
warnings "Off"
|
warnings "Off"
|
||||||
kind "StaticLib"
|
kind "StaticLib"
|
||||||
|
2
deps/rapidjson
vendored
2
deps/rapidjson
vendored
Submodule deps/rapidjson updated: 7c73dd7de7...24b5e7a8b2
2
deps/zlib
vendored
2
deps/zlib
vendored
Submodule deps/zlib updated: d476828316...ef24c4c750
@ -85,6 +85,11 @@ if os.istarget("linux") then
|
|||||||
filter {}
|
filter {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
filter { "system:macosx", "platforms:x64" }
|
||||||
|
buildoptions "-arch x86_64"
|
||||||
|
linkoptions "-arch x86_64"
|
||||||
|
filter {}
|
||||||
|
|
||||||
filter { "system:macosx", "platforms:arm64" }
|
filter { "system:macosx", "platforms:arm64" }
|
||||||
buildoptions "-arch arm64"
|
buildoptions "-arch arm64"
|
||||||
linkoptions "-arch arm64"
|
linkoptions "-arch arm64"
|
||||||
|
@ -65,11 +65,7 @@ namespace console
|
|||||||
{
|
{
|
||||||
static thread_local char buffer[0x1000];
|
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);
|
const int count = vsnprintf(buffer, sizeof(buffer), message, *ap);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (count < 0) return {};
|
if (count < 0) return {};
|
||||||
return {buffer, static_cast<size_t>(count)};
|
return {buffer, static_cast<size_t>(count)};
|
||||||
|
@ -39,7 +39,7 @@ int main(const int argc, const char** argv)
|
|||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
console::error("Fatal error: %s\n", e.what());
|
console::error("Fatal error: %s", e.what());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,10 +41,12 @@ namespace
|
|||||||
const auto location = utils::env::get_value("AW_STATS_LOCATION");
|
const auto location = utils::env::get_value("AW_STATS_LOCATION");
|
||||||
if (location.empty())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console::info("Writing stats to %s", location.c_str());
|
||||||
|
|
||||||
utils::io::write_file(location, root_data);
|
utils::io::write_file(location, root_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,7 @@ namespace utils::string
|
|||||||
|
|
||||||
while (true)
|
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);
|
const auto res = vsnprintf(entry->buffer_, entry->size_, format, ap);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (res > 0) break; // Success
|
if (res > 0) break; // Success
|
||||||
if (res == 0) return nullptr; // Error
|
if (res == 0) return nullptr; // Error
|
||||||
|
Reference in New Issue
Block a user