Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 73 additions & 21 deletions .github/workflows/build-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,17 +279,6 @@ jobs:

make

# FNA (Only built on Linux, due to being platform agnostic)
- uses: actions/setup-dotnet@v4
if: ${{ matrix.platform == 'linux' }}
with:
dotnet-version: '8'

- name: Build FNA
if: ${{ matrix.platform == 'linux' }}
working-directory: source/FNA
run: dotnet build -c ${{ env.BUILD_TYPE }} FNA.NetFramework.csproj

# Upload
- name: Copy binaries (Windows)
if: ${{ matrix.platform == 'windows' }}
Expand All @@ -312,8 +301,6 @@ jobs:
- name: Copy binaries (Linux)
if: ${{ matrix.platform == 'linux' }}
run: |
cp source/FNA/bin/${{ env.BUILD_TYPE }}/net4.0/FNA.dll FNA.dll
cp source/FNA/bin/${{ env.BUILD_TYPE }}/net4.0/FNA.pdb FNA.pdb
cp ${{ env.SDL2_DIR }}/lib/libSDL2-2.0.so.0 libSDL2-2.0.so.0
cp source/FNA/lib/FAudio/build/libFAudio.so.0 libFAudio.so.0
cp source/FNA/lib/FNA3D/build/libFNA3D.so.0 libFNA3D.so.0
Expand Down Expand Up @@ -349,13 +336,71 @@ jobs:
with:
name: fnalibs-linux-x86_64
path: |
FNA.dll
FNA.pdb
libSDL2-2.0.so.0
libFAudio.so.0
libFNA3D.so.0
libtheorafile.so

build-managed-libs:
name: Managed Libraries
runs-on: ubuntu-latest
defaults:
run:
shell: sh

steps:
- name: Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
source
patches
submodules: recursive

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: source/MonoMod/global.json

- name: Install SN
run: sudo apt install -y mono-devel

- name: Build MonoMod
working-directory: source/MonoMod
run: |
dotnet publish -c ${{ env.BUILD_TYPE }} -f ${{ env.NET_FRAMEWORK }} src/MonoMod.Utils/MonoMod.Utils.csproj
dotnet publish -c ${{ env.BUILD_TYPE }} -f ${{ env.NET_FRAMEWORK }} src/MonoMod.Patcher/MonoMod.Patcher.csproj
dotnet publish -c ${{ env.BUILD_TYPE }} -f ${{ env.NET_FRAMEWORK }} src/MonoMod.RuntimeDetour/MonoMod.RuntimeDetour.csproj
dotnet publish -c ${{ env.BUILD_TYPE }} -f ${{ env.NET_FRAMEWORK }} src/MonoMod.RuntimeDetour.HookGen/MonoMod.RuntimeDetour.HookGen.csproj

- name: Build NLua
working-directory: source/NLua
run: dotnet publish -c ${{ env.BUILD_TYPE }} build/net6.0/NLua.net6.0.csproj

- name: Build FNA
working-directory: source/FNA
run: dotnet build -c ${{ env.BUILD_TYPE }} FNA.NetFramework.csproj

- name: Copy artifacts
run: |
MM_DIR=$(echo "${{ env.BUILD_TYPE }} ${{ env.NET_FRAMEWORK }}" | awk '{print tolower($1) "_" $2}')
mkdir all_artifacts
cp source/MonoMod/artifacts/publish/MonoMod.Utils/$MM_DIR/* all_artifacts
cp source/MonoMod/artifacts/publish/MonoMod.Patcher/$MM_DIR/* all_artifacts
cp source/MonoMod/artifacts/publish/MonoMod.RuntimeDetour/$MM_DIR/* all_artifacts
cp source/MonoMod/artifacts/publish/MonoMod.RuntimeDetour.HookGen/$MM_DIR/* all_artifacts

cp -r source/NLua/lib/${{ env.BUILD_TYPE }}/net6.0/publish/* all_artifacts

cp source/FNA/bin/${{ env.BUILD_TYPE }}/net4.0/FNA.dll all_artifacts
cp source/FNA/bin/${{ env.BUILD_TYPE }}/net4.0/FNA.pdb all_artifacts

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: managed-libraries
path: all_artifacts

build-piton:
strategy:
matrix:
Expand Down Expand Up @@ -430,7 +475,7 @@ jobs:
generate-lib-ext:
name: Generate lib-ext
runs-on: ubuntu-latest
needs: [build-fnalibs, build-piton]
needs: [build-fnalibs, build-managed-libs, build-piton]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -472,6 +517,8 @@ jobs:
mkdir -p ../lib-ext/lib64-win-x64
mkdir -p ../lib-ext/lib64-osx
mkdir -p ../lib-ext/lib64-linux

mkdir -p ../lib-ext/piton

### Vendored files
cp README_lib-ext.md ../lib-ext/README.md
Expand All @@ -492,8 +539,8 @@ jobs:
pushd ../lib-ext

### Vanilla overrides
cp ../binaries/fnalibs-linux-x86_64/FNA.dll lib-vanilla
cp ../binaries/fnalibs-linux-x86_64/FNA.pdb lib-vanilla
cp ../binaries/managed-libraries/FNA.dll lib-vanilla
cp ../binaries/managed-libraries/FNA.pdb lib-vanilla

# Windows x86
cp ../binaries/fnalibs-windows-i686/FNA3D.dll lib-vanilla
Expand All @@ -516,8 +563,10 @@ jobs:
cp ../binaries/fnalibs-linux-x86_64/libtheorafile.so lib-vanilla/lib64

### Everest Libraries
mv ../binaries/fnalibs-linux-x86_64/FNA.dll .
mv ../binaries/fnalibs-linux-x86_64/FNA.pdb .
mv ../binaries/managed-libraries/FNA.dll .
mv ../binaries/managed-libraries/FNA.pdb .

mv ../binaries/managed-libraries/* .

mv ../binaries/fnalibs-windows-i686/* lib64-win-x86
mv ../binaries/fnalibs-windows-x86_64/* lib64-win-x64
Expand All @@ -530,7 +579,10 @@ jobs:
cp ../binaries/discord_game_sdk/lib/x86_64/discord_game_sdk.so lib64-linux/libdiscord_game_sdk.so

### Piton
mv ../binaries/piton-apphosts piton
mv ../binaries/piton-apphosts-i686-pc-windows-msvc/* piton
mv ../binaries/piton-apphosts-x86_64-pc-windows-msvc/* piton
mv ../binaries/piton-apphosts-x86_64-unknown-linux-gnu/* piton
mv ../binaries/piton-apphosts-x86_64-apple-darwin/* piton

- name: Display the new structure
run: ls -R ../lib-ext
Expand Down
12 changes: 9 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[submodule "FNA"]
[submodule "source/FNA"]
path = source/FNA
url = https://github.com/FNA-XNA/FNA
[submodule "SDL2"]
[submodule "source/SDL2"]
path = source/SDL2
url = https://github.com/libsdl-org/SDL/
[submodule "Piton"]
[submodule "source/Piton"]
path = source/Piton
url = https://github.com/Popax21/Piton
[submodule "source/MoltenVK"]
Expand All @@ -19,3 +19,9 @@
[submodule "source/SDL_GameControllerDB"]
path = source/SDL_GameControllerDB
url = https://github.com/mdqinc/SDL_GameControllerDB
[submodule "source/MonoMod"]
path = source/MonoMod
url = https://github.com/MonoMod/MonoMod/
[submodule "source/NLua"]
path = source/NLua
url = https://github.com/NLua/NLua/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ These libraries are open source and are built in CI.
- MoltenVK `1.2.11`
- Vulkan Loader `1.3.296`
- Piton [21c7868](https://github.com/Popax21/Piton/tree/21c7868d06007f0c5e7d9030a0109fe892df1bf3)
- NLua `1.6.2` with patches
- MonoMod [be053cf](https://github.com/MonoMod/MonoMod/tree/be053cf084f320a0cd5b516288e1e332b855471d)

### Closed-Source Libraries
These libraries are closed source and cannot be _built_ in CI.
Expand Down
113 changes: 113 additions & 0 deletions patches/NLua_FixTracebackLeak.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
From cafdb0330111df64e008d74c679abc7edf951ef6 Mon Sep 17 00:00:00 2001
From: Wartori54 <wartori54@gmail.com>
Date: Wed, 23 Oct 2024 23:43:40 +0200
Subject: [PATCH] Remove debug.traceback references from stack after PCall
with UseTraceback enabled

---
src/Lua.cs | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/src/Lua.cs b/src/Lua.cs
index ad3d107..b622b0e 100644
--- a/src/Lua.cs
+++ b/src/Lua.cs
@@ -496,10 +496,12 @@ namespace NLua
ThrowExceptionFromError(oldTop);

int errorFunctionIndex = 0;
+ int errorFunctionAbsoluteIndex = -1;

if (UseTraceback)
{
errorFunctionIndex = PushDebugTraceback(_luaState, 0);
+ errorFunctionAbsoluteIndex = _luaState.GetTop() + errorFunctionIndex + 1;
oldTop++;
}

@@ -512,6 +514,9 @@ namespace NLua
}
finally
{
+ if (errorFunctionAbsoluteIndex != -1)
+ _luaState.Remove(errorFunctionAbsoluteIndex);
+
_executing = false;
}
}
@@ -531,10 +536,12 @@ namespace NLua
ThrowExceptionFromError(oldTop);

int errorFunctionIndex = 0;
+ int errorFunctionAbsoluteIndex = -1;

if (UseTraceback)
{
errorFunctionIndex = PushDebugTraceback(_luaState, 0);
+ errorFunctionAbsoluteIndex = _luaState.GetTop() + errorFunctionIndex + 1;
oldTop++;
}

@@ -547,6 +554,9 @@ namespace NLua
}
finally
{
+ if (errorFunctionAbsoluteIndex != -1)
+ _luaState.Remove(errorFunctionAbsoluteIndex);
+
_executing = false;
}
}
@@ -565,9 +575,11 @@ namespace NLua
_executing = true;

int errorFunctionIndex = 0;
+ int errorFunctionAbsoluteIndex = -1;
if (UseTraceback)
{
errorFunctionIndex = PushDebugTraceback(_luaState, 0);
+ errorFunctionAbsoluteIndex = _luaState.GetTop() + errorFunctionIndex + 1;
oldTop++;
}

@@ -580,6 +592,9 @@ namespace NLua
}
finally
{
+ if (errorFunctionAbsoluteIndex != -1)
+ _luaState.Remove(errorFunctionAbsoluteIndex);
+
_executing = false;
}
}
@@ -820,12 +835,14 @@ namespace NLua

_executing = true;

+ int errfunctionAbs = -1;
try
{
int errfunction = 0;
if (UseTraceback)
{
errfunction = PushDebugTraceback(_luaState, nArgs);
+ errfunctionAbs = _luaState.GetTop() + errfunction + 1;
oldTop++;
}

@@ -835,6 +852,12 @@ namespace NLua
}
finally
{
+ if (errfunctionAbs != -1)
+ {
+ _luaState.Remove(errfunctionAbs);
+ oldTop--;
+ }
+
_executing = false;
}

--
2.49.0

Loading