push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
{ godot3-headless }:
godot3-headless.overrideAttrs (
self: base: {
pname = "godot3-debug-server";
godotBuildDescription = "debug server";
shouldBuildTools = false;
}
)

View File

@@ -0,0 +1,190 @@
{
lib,
stdenv,
alsa-lib,
alsa-plugins,
autoPatchelfHook,
fetchFromGitHub,
freetype,
installShellFiles,
libGLU,
libpulseaudio,
libX11,
libXcursor,
libXext,
libXfixes,
libXi,
libXinerama,
libXrandr,
libXrender,
makeWrapper,
openssl,
pkg-config,
scons,
udev,
yasm,
zlib,
}:
stdenv.mkDerivation (self: {
pname = "godot3";
version = "3.6";
godotBuildDescription = "X11 tools";
src = fetchFromGitHub {
owner = "godotengine";
repo = "godot";
rev = "${self.version}-stable";
sha256 = "sha256-4WQYO1BBDK9+eyblpI8qRgbBG4+qPRVZMjeAFAtot+0=";
};
# Fix PIE hardening: https://github.com/godotengine/godot/pull/50737
postPatch = ''
substituteInPlace platform/x11/detect.py \
--replace-fail 'env.Append(LINKFLAGS=["-no-pie"])' ""
'';
nativeBuildInputs = [
autoPatchelfHook
installShellFiles
makeWrapper
pkg-config
scons
];
buildInputs = [
alsa-lib
freetype
libGLU
libpulseaudio
libX11
libXcursor
libXext
libXfixes
libXi
libXinerama
libXrandr
libXrender
openssl
udev
yasm
zlib
];
shouldAddLinkFlagsToPulse = true;
patches = map (rp: ./patches + rp) [
# The version of SConstruct in the godot source appends the OS's PATH to the Scons PATH,
# but because it is an append, the Scons PATH takes precedence. The Scons PATH contains a
# bunch of standard Linux paths like /usr/bin, so if they happen to contain versions of any
# build-time dependencies of Godot, they will be used instead of the Nix version of them.
#
# This patch simply replaces the entire Scons environment (including the PATH) with that
# of the OS. This isn't as surgical as just fixing the PATH, but it seems to work, and
# seems to be the Nix community's current strategy when using Scons.
/SConstruct/dontClobberEnvironment.patch
# Fix compile error with mono 6.14
# https://github.com/godotengine/godot/pull/106578
/move-MonoGCHandle-into-gdmono-namespace.patch
];
enableParallelBuilding = true;
godotBuildPlatform = "x11";
shouldBuildTools = true;
godotBuildTarget = "release_debug";
lto = if self.godotBuildTarget == "release" then "full" else "none";
sconsFlags = [
"arch=${stdenv.hostPlatform.linuxArch}"
"platform=${self.godotBuildPlatform}"
"tools=${lib.boolToString self.shouldBuildTools}"
"target=${self.godotBuildTarget}"
"bits=${toString stdenv.hostPlatform.parsed.cpu.bits}"
"lto=${self.lto}"
];
shouldWrapBinary = self.shouldBuildTools;
shouldInstallManual = self.shouldBuildTools;
shouldPatchBinary = self.shouldBuildTools;
shouldInstallHeaders = self.shouldBuildTools;
shouldInstallShortcut = self.shouldBuildTools && self.godotBuildPlatform != "server";
outputs = [
"out"
]
++ lib.optional self.shouldInstallManual "man"
++ lib.optional self.shouldBuildTools "dev";
builtGodotBinNamePattern =
if self.godotBuildPlatform == "server" then "godot_server.*" else "godot.*";
godotBinInstallPath = "bin";
installedGodotBinName = self.pname;
installedGodotShortcutFileName = "org.godotengine.Godot3.desktop";
installedGodotShortcutDisplayName = "Godot Engine 3";
installPhase = ''
runHook preInstall
echo "Installing godot binaries."
outbin="$out/$godotBinInstallPath"
mkdir -p "$outbin"
cp -R bin/. "$outbin"
mv "$outbin"/$builtGodotBinNamePattern "$outbin/$installedGodotBinName"
if [ -n "$shouldWrapBinary" ]; then
wrapProgram "$outbin/$installedGodotBinName" \
--set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib
fi
if [ -n "$shouldInstallManual" ]; then
echo "Installing godot manual."
mansrc=misc/dist/linux
mv "$mansrc"/godot.6 "$mansrc"/godot3.6
installManPage "$mansrc"/godot3.6
fi
if [ -n "$shouldInstallHeaders" ]; then
echo "Installing godot headers."
mkdir -p "$dev"
cp -R modules/gdnative/include "$dev"
fi
if [ -n "$shouldInstallShortcut" ]; then
echo "Installing godot shortcut."
mkdir -p "$out"/share/{applications,icons/hicolor/scalable/apps}
cp misc/dist/linux/org.godotengine.Godot.desktop "$out"/share/applications/$installedGodotShortcutFileName
cp icon.svg "$out"/share/icons/hicolor/scalable/apps/godot.svg
cp icon.png "$out"/share/icons/godot.png
substituteInPlace "$out"/share/applications/$installedGodotShortcutFileName \
--replace "Exec=godot" "Exec=\"$outbin/$installedGodotBinName\"" \
--replace "Name=Godot Engine" "Name=$installedGodotShortcutDisplayName"
fi
runHook postInstall
'';
runtimeDependencies = lib.optionals self.shouldPatchBinary (
map lib.getLib [
alsa-lib
libpulseaudio
udev
]
);
meta = with lib; {
homepage = "https://godotengine.org";
description = "Free and Open Source 2D and 3D game engine (" + self.godotBuildDescription + ")";
license = licenses.mit;
platforms = [
"i686-linux"
"x86_64-linux"
"aarch64-linux"
];
maintainers = with maintainers; [
rotaerk
twey
];
};
})

View File

@@ -0,0 +1,30 @@
{ godot3 }:
godot3.overrideAttrs (
self: base: {
pname = "godot3-export-templates";
godotBuildDescription = "nix export templates";
# As described in default.nix, adding the link flags to pulseaudio in detect.py was necessary to
# allow the dlopen calls to succeed in Nix builds of godot. However, it seems that this *breaks*
# the export templates, resulting in programs exported from godot using these export templates to
# be unable to load this library.
shouldAddLinkFlagsToPulse = false;
shouldBuildTools = false;
godotBuildTarget = "release";
godotBinInstallPath = "share/godot/templates/${self.version}.stable";
installedGodotBinName = "linux_${self.godotBuildPlatform}_64_${self.godotBuildTarget}";
# https://docs.godotengine.org/en/stable/development/compiling/optimizing_for_size.html
# Stripping reduces the template size from around 500MB to 40MB for Linux.
# This also impacts the size of the exported games.
# This is added explicitly here because mkDerivation does not automatically
# strip binaries in the template directory.
stripAllList = (base.stripAllList or [ ]) ++ [ "share/godot/templates" ];
meta = base.meta // {
homepage = "https://docs.godotengine.org/en/stable/development/compiling/compiling_for_x11.html#building-export-templates";
};
}
)

View File

@@ -0,0 +1,9 @@
{ godot3 }:
godot3.overrideAttrs (
self: base: {
pname = "godot3-headless";
godotBuildDescription = "headless";
godotBuildPlatform = "server";
}
)

View File

@@ -0,0 +1,9 @@
{ godot3-mono-headless }:
godot3-mono-headless.overrideAttrs (
self: base: {
pname = "godot3-mono-debug-server";
godotBuildDescription = "mono debug server";
shouldBuildTools = false;
}
)

View File

@@ -0,0 +1,57 @@
{
godot3,
callPackage,
mkNugetDeps,
mono,
dotnet-sdk,
scons,
python311Packages,
}:
(godot3.override {
scons = scons.override {
python3Packages = python311Packages;
};
}).overrideAttrs
(
self: base: {
pname = "godot3-mono";
godotBuildDescription = "mono build";
nativeBuildInputs = base.nativeBuildInputs ++ [
mono
dotnet-sdk
];
glue = callPackage ./glue.nix { };
buildInputs = base.buildInputs ++ [
(mkNugetDeps {
name = "deps";
sourceFile = ./deps.json;
})
];
sconsFlags = base.sconsFlags ++ [
"module_mono_enabled=true"
"mono_prefix=${mono}"
];
postConfigure = ''
echo "Setting up buildhome."
mkdir buildhome
export HOME="$PWD"/buildhome
echo "Overlaying godot glue."
cp -R --no-preserve=mode "$glue"/. .
'';
installedGodotShortcutFileName = "org.godotengine.GodotMono3.desktop";
installedGodotShortcutDisplayName = "Godot Engine (Mono) 3";
passthru = {
make-deps = callPackage ./make-deps.nix { };
};
}
)

View File

@@ -0,0 +1,162 @@
[
{
"pname": "EnvDTE",
"version": "8.0.2",
"sha256": "1wdvjzdmqbqyqlaijpjc959vvdic12vqr3c5sffhbxi7m1si5k63"
},
{
"pname": "GodotTools.IdeMessaging",
"version": "1.1.1",
"sha256": "0v70acpw2yq9mx05jy2gmkqqdbpgj8rb29ny2f3bgvmw9g5qmq94"
},
{
"pname": "JetBrains.Annotations",
"version": "2019.1.3",
"sha256": "188b0qw6lih0k3ddnmimadzr3y1y6vh6ramgkjnyskqd43prjzc2"
},
{
"pname": "Microsoft.Build",
"version": "16.5.0",
"sha256": "0baihvnzanqhk125g0ass9hhsqgp55h770pjjmsxdvprv0aqq22i"
},
{
"pname": "Microsoft.Build.Framework",
"version": "16.5.0",
"sha256": "1xgr02r7s9i6s70n237hss4yi9zicssia3zd2ny6s8vyxb7jpdyb"
},
{
"pname": "Microsoft.NETCore.Platforms",
"version": "1.0.1",
"sha256": "01al6cfxp68dscl15z7rxfw9zvhm64dncsw09a1vmdkacsa2v6lr"
},
{
"pname": "Microsoft.NETCore.Platforms",
"version": "1.1.0",
"sha256": "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm"
},
{
"pname": "Microsoft.NETCore.Targets",
"version": "1.0.1",
"sha256": "0ppdkwy6s9p7x9jix3v4402wb171cdiibq7js7i13nxpdky7074p"
},
{
"pname": "Microsoft.NETFramework.ReferenceAssemblies",
"version": "1.0.0",
"sha256": "0na724xhvqm63vq9y18fl9jw9q2v99bdwr353378s5fsi11qzxp9"
},
{
"pname": "Microsoft.NETFramework.ReferenceAssemblies.net472",
"version": "1.0.0",
"sha256": "1bqinq2nxnpqxziypg1sqy3ly0nymxxjpn8fwkn3rl4vl6gdg3rc"
},
{
"pname": "Microsoft.VisualStudio.Setup.Configuration.Interop",
"version": "1.16.30",
"sha256": "14022lx03vdcqlvbbdmbsxg5pqfx1rfq2jywxlyaz9v68cvsb0g4"
},
{
"pname": "Mono.Cecil",
"version": "0.11.3",
"sha256": "0xcx7pk9y2n1hr15c0l1balzi69kw5gy8dk7sb8jwqyyvm35q4j3"
},
{
"pname": "NETStandard.Library",
"version": "2.0.3",
"sha256": "1fn9fxppfcg4jgypp2pmrpr6awl3qz1xmnri0cygpkwvyx27df1y"
},
{
"pname": "Newtonsoft.Json",
"version": "13.0.1",
"sha256": "0fijg0w6iwap8gvzyjnndds0q4b8anwxxvik7y8vgq97dram4srb"
},
{
"pname": "Semver",
"version": "2.0.6",
"sha256": "136sd6d3ys49dipvc1h3ivmp8ryd4p7fdmdrr28521cqpvkw5f1k"
},
{
"pname": "stdole",
"version": "7.0.3302",
"sha256": "1n8vbzlgyklazriwvb6kjyw5w0m9a1b3xsa0f0v29j03z23fx69p"
},
{
"pname": "System.Buffers",
"version": "4.4.0",
"sha256": "183f8063w8zqn99pv0ni0nnwh7fgx46qzxamwnans55hhs2l0g19"
},
{
"pname": "System.Collections.Immutable",
"version": "1.5.0",
"sha256": "1d5gjn5afnrf461jlxzawcvihz195gayqpcfbv6dd7pxa9ialn06"
},
{
"pname": "System.Globalization",
"version": "4.0.11",
"sha256": "070c5jbas2v7smm660zaf1gh0489xanjqymkvafcs4f8cdrs1d5d"
},
{
"pname": "System.IO",
"version": "4.1.0",
"sha256": "1g0yb8p11vfd0kbkyzlfsbsp5z44lwsvyc0h3dpw6vqnbi035ajp"
},
{
"pname": "System.Memory",
"version": "4.5.3",
"sha256": "0naqahm3wljxb5a911d37mwjqjdxv9l0b49p5dmfyijvni2ppy8a"
},
{
"pname": "System.Numerics.Vectors",
"version": "4.4.0",
"sha256": "0rdvma399070b0i46c4qq1h2yvjj3k013sqzkilz4bz5cwmx1rba"
},
{
"pname": "System.Reflection",
"version": "4.1.0",
"sha256": "1js89429pfw79mxvbzp8p3q93il6rdff332hddhzi5wqglc4gml9"
},
{
"pname": "System.Reflection.Primitives",
"version": "4.0.1",
"sha256": "1bangaabhsl4k9fg8khn83wm6yial8ik1sza7401621jc6jrym28"
},
{
"pname": "System.Resources.ResourceManager",
"version": "4.0.1",
"sha256": "0b4i7mncaf8cnai85jv3wnw6hps140cxz8vylv2bik6wyzgvz7bi"
},
{
"pname": "System.Runtime",
"version": "4.1.0",
"sha256": "02hdkgk13rvsd6r9yafbwzss8kr55wnj8d5c7xjnp8gqrwc8sn0m"
},
{
"pname": "System.Runtime.CompilerServices.Unsafe",
"version": "4.5.2",
"sha256": "1vz4275fjij8inf31np78hw50al8nqkngk04p3xv5n4fcmf1grgi"
},
{
"pname": "System.Runtime.Serialization.Primitives",
"version": "4.1.1",
"sha256": "042rfjixknlr6r10vx2pgf56yming8lkjikamg3g4v29ikk78h7k"
},
{
"pname": "System.Text.Encoding",
"version": "4.0.11",
"sha256": "1dyqv0hijg265dwxg6l7aiv74102d6xjiwplh2ar1ly6xfaa4iiw"
},
{
"pname": "System.Threading.Tasks",
"version": "4.0.11",
"sha256": "0nr1r41rak82qfa5m0lhk9mp0k93bvfd7bbd9sdzwx9mb36g28p5"
},
{
"pname": "System.Threading.Tasks.Dataflow",
"version": "4.9.0",
"sha256": "1g6s9pjg4z8iy98df60y9a01imdqy59zd767vz74rrng78jl2dk5"
},
{
"pname": "System.Threading.Thread",
"version": "4.0.0",
"sha256": "1gxxm5fl36pjjpnx1k688dcw8m9l7nmf802nxis6swdaw8k54jzc"
}
]

View File

@@ -0,0 +1,30 @@
{ godot3-mono }:
godot3-mono.overrideAttrs (
self: base: {
pname = "godot3-mono-export-templates";
godotBuildDescription = "nix mono export templates";
# As described in default.nix, adding the link flags to pulseaudio in detect.py was necessary to
# allow the dlopen calls to succeed in Nix builds of godot. However, it seems that this *breaks*
# the export templates, resulting in programs exported from godot using these export templates to
# be unable to load this library.
shouldAddLinkFlagsToPulse = false;
shouldBuildTools = false;
godotBuildTarget = "release";
godotBinInstallPath = "share/godot/templates/${self.version}.stable.mono";
installedGodotBinName = "linux_${self.godotBuildPlatform}_64_${self.godotBuildTarget}";
# https://docs.godotengine.org/en/stable/development/compiling/optimizing_for_size.html
# Stripping reduces the template size from around 500MB to 40MB for Linux.
# This also impacts the size of the exported games.
# This is added explicitly here because mkDerivation does not automatically
# strip binaries in the template directory.
stripAllList = (base.stripAllList or [ ]) ++ [ "share/godot/templates" ];
meta = base.meta // {
homepage = "https://docs.godotengine.org/en/stable/development/compiling/compiling_with_mono.html#export-templates";
};
}
)

View File

@@ -0,0 +1,76 @@
{
godot3,
mono,
scons,
python311Packages,
}:
(godot3.override {
scons = scons.override {
python3Packages = python311Packages;
};
}).overrideAttrs
(
self: base: {
pname = "godot3-mono-glue";
godotBuildDescription = "mono glue";
godotBuildPlatform = "server";
sconsFlags = base.sconsFlags ++ [
"module_mono_enabled=true"
"mono_glue=false" # Indicates not to expect already existing glue.
"mono_prefix=${mono}"
];
nativeBuildInputs = base.nativeBuildInputs ++ [ mono ];
patches =
base.patches
++ map (rp: ./patches + rp) [
# When building godot mono, a "glue version" gets baked into it, and into the mono glue code
# generated by it. Godot mono export templates are also get a glue version baked in. If you
# export a godot mono project using an export template for which the glue version doesn't
# match that of the godot mono tool itself, then the resulting game will fail with an error
# saying "The assembly 'GodotSharp' is out of sync." Thus, if we want our build of godot mono
# to be compatible with the official export templates, we need to ensure it is built with the
# same glue version as the official build.
#
# A python script in the godot source, i.e. modules/mono/build_scripts/gen_cs_glue_version.py,
# is used by the build process to generate the glue version number. The official version of it
# does so based on the latest modified time of all the C# files in the GodotSharp solution. This
# is problematic because it is difficult to reproduce the exact timestamps that the files had
# when the official build was created. This is further complicated by the fact that nix clears
# the timestamps on the source files when they're unpacked. Thus, we can't simply regenerate the
# official glue version by building from the official source.
#
# To address this, we are patching the python script with a hard-coded glue version number. This
# patch file needs to be updated for every new version of godot, so to enforce this, the godot
# version is baked in to the file name, causing the build to fail until the patch is updated.
#
# The correct glue version number for a given godot version is obtained by running the official
# build of that version of godot with the --generate-mono-glue flag. This generates the mono
# glue files. One of those files, mono_glue.gen.cpp, has a function called get_cs_glue_version()
# which contains a hard-coded number. This is the glue version to put in the patch file.
#
# For convenience, the accompanying update-glue-version.sh script automates this work. Run it by
# passing the godot version as an argument, e.g. "3.5.2".
"/gen_cs_glue_version.py/hardcodeGlueVersion_${self.version}.patch"
];
outputs = [ "out" ];
installPhase = ''
runHook preInstall
glue="$out"/modules/mono/glue
mkdir -p "$glue"
bin/godot_server.x11.opt.tools.*.mono --generate-mono-glue "$glue"
runHook postInstall
'';
meta = base.meta // {
homepage = "https://docs.godotengine.org/en/stable/development/compiling/compiling_with_mono.html#generate-the-glue";
};
}
)

View File

@@ -0,0 +1,9 @@
{ godot3-mono }:
godot3-mono.overrideAttrs (
self: base: {
pname = "godot3-mono-headless";
godotBuildDescription = "mono headless";
godotBuildPlatform = "server";
}
)

View File

@@ -0,0 +1,67 @@
{
godot3-mono,
nuget-to-json,
}:
godot3-mono.overrideAttrs (
self: base: {
pname = "godot3-mono-make-deps";
nativeBuildInputs = base.nativeBuildInputs ++ [
nuget-to-json
];
nugetDeps = null;
nugetSource = null;
nugetConfig = null;
keepNugetConfig = true;
outputs = [ "out" ];
buildPhase = " ";
installPhase = ''echo "No output intended. Run make-deps.sh instead." > $out'';
# This script is used to update the accompanying deps.json file, a JSON file listing the
# nuget packages that the godot-mono code depends on, along with their sha256 hashes. This
# file is referenced by the godot-mono derivation and needs to be updated every time the
# godot version is updated. The way it works is:
#
# 1) Creates and navigates to a temporary directory and then explicitly runs the unpack,
# patch, and configure phases from the godot-mono derivation.
# 2) Instead of building at this point, a nuget restore is performed, downloading all the
# nuget dependencies of godot-mono into a local folder.
# 3) Once these have been downloaded, the nuget-to-json tool is used to generate a JSON
# array listing the locally obtained nuget packages, along with their sha256 hashes.
# 4) This JSON array is saved as deps.json in the PWD.
#
# This process is impure, because it entails downloading files with unknown hashes, so it
# is run manually by the maintainer within a nix-shell environment. Running the accompanying
# make-deps.sh instead simplifies this.
makeDeps = ''
set -e
outdir="$(pwd)"
wrkdir="$(mktemp -d)"
trap 'rm -rf -- "$wrkdir"' EXIT
pushd "$wrkdir" > /dev/null
unpackPhase
cd source
patchPhase
configurePhase
# Without RestorePackagesPath set, it restores packages to a temp directory. Specifying
# a path ensures we have a place to run nuget-to-json.
nugetRestore() { dotnet msbuild -t:Restore -p:RestorePackagesPath=nugetPackages $1; }
nugetRestore modules/mono/glue/GodotSharp/GodotSharp.sln
nugetRestore modules/mono/editor/GodotTools/GodotTools.sln
nuget-to-json nugetPackages > "$outdir"/deps.json
popd > /dev/null
'';
meta = base.meta // {
description = "Derivation with no output that exists to provide an environment for make-deps.sh";
};
}
)

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
nix-shell "$(git rev-parse --show-toplevel)" -A godot3-mono.make-deps --run 'eval "$makeDeps"'

View File

@@ -0,0 +1,22 @@
diff --git a/modules/mono/build_scripts/gen_cs_glue_version.py b/modules/mono/build_scripts/gen_cs_glue_version.py
index 98bbb4d9be..5189f2551b 100644
--- a/modules/mono/build_scripts/gen_cs_glue_version.py
+++ b/modules/mono/build_scripts/gen_cs_glue_version.py
@@ -1,16 +1,5 @@
def generate_header(solution_dir, version_header_dst):
- import os
-
- latest_mtime = 0
- for root, dirs, files in os.walk(solution_dir, topdown=True):
- dirs[:] = [d for d in dirs if d not in ["Generated"]] # Ignored generated files
- files = [f for f in files if f.endswith(".cs")]
- for file in files:
- filepath = os.path.join(root, file)
- mtime = os.path.getmtime(filepath)
- latest_mtime = mtime if mtime > latest_mtime else latest_mtime
-
- glue_version = int(latest_mtime) # The latest modified time will do for now
+ glue_version = 1725828088
with open(version_header_dst, "w") as version_header:
version_header.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")

View File

@@ -0,0 +1,9 @@
{ godot3-mono-debug-server }:
godot3-mono-debug-server.overrideAttrs (
self: base: {
pname = "godot3-mono-server";
godotBuildDescription = "mono server";
godotBuildTarget = "release";
}
)

View File

@@ -0,0 +1,39 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p steam-run unzip wget
# This script updates the hard-coded glue_version in:
#
# patches/gen_cs_glue_version.py/hardcodeGlueVersionFor{version}.patch
#
# It does so by pulling it from the official build.
set -e
[ -z "$1" ] && echo "Godot version not specified. Exiting." && exit 1
gdversion=$1
# Download and extract the official stable 64-bit X11 mono build of Godot.
gddir="$(mktemp -d)"
trap 'rm -rf -- "$gddir"' EXIT
wget -P "$gddir" https://downloads.tuxfamily.org/godotengine/$gdversion/mono/Godot_v$gdversion-stable_mono_x11_64.zip
unzip "$gddir"/Godot_v$gdversion-stable_mono_x11_64.zip -d "$gddir"
# Generate the mono glue from the official build.
gluedir="$(mktemp -d)"
trap 'rm -rf -- "$gluedir"' EXIT
steam-run "$gddir"/Godot_v$gdversion-stable_mono_x11_64/Godot_v$gdversion-stable_mono_x11.64 --generate-mono-glue "$gluedir"
# Extract the glue version.
glueversion=$(grep -Po '(?<=get_cs_glue_version\(\) \{ return )[0-9]+(?=; \})' "$gluedir"/mono_glue.gen.cpp)
patchdir=./patches/gen_cs_glue_version.py/
patchprefix=hardcodeGlueVersion_
newpatchname=$patchprefix$gdversion.patch
# Update the patch with the obtained glue version.
sed -i "s/^+ glue_version = [0-9]\+$/+ glue_version = $glueversion/" $patchdir/$patchprefix*.patch
mv $patchdir/$patchprefix*.patch $patchdir/$patchprefix$gdversion.patch
echo "Updated $patchdir/$patchprefix$gdversion.patch with glue_version: $glueversion"

View File

@@ -0,0 +1,20 @@
diff --git a/SConstruct b/SConstruct
index 057ec7628c..760be89fff 100644
--- a/SConstruct
+++ b/SConstruct
@@ -67,14 +67,7 @@ elif platform_arg == "javascript":
elif os.name == "nt" and methods.get_cmdline_bool("use_mingw", False):
custom_tools = ["mingw"]
-# We let SCons build its default ENV as it includes OS-specific things which we don't
-# want to have to pull in manually.
-# Then we prepend PATH to make it take precedence, while preserving SCons' own entries.
-env_base = Environment(tools=custom_tools)
-env_base.PrependENVPath("PATH", os.getenv("PATH"))
-env_base.PrependENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
-if "TERM" in os.environ: # Used for colored output.
- env_base["ENV"]["TERM"] = os.environ["TERM"]
+env_base = Environment(ENV = os.environ, tools=custom_tools)
env_base.disabled_modules = []
env_base.use_ptrcall = False

View File

@@ -0,0 +1,403 @@
From 7f90c622f5f04ad6aed5729913684a64827b751f Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Sun, 18 May 2025 20:56:50 -0300
Subject: [PATCH] mono: move MonoGCHandle into gdmono namespace
This conflicts with ::MonoGCHandle in mono 6.14 (maintained by winehq).
---
modules/mono/csharp_script.cpp | 44 +++++++++++-----------
modules/mono/csharp_script.h | 10 ++---
modules/mono/glue/base_object_glue.cpp | 4 +-
modules/mono/mono_gc_handle.cpp | 4 ++
modules/mono/mono_gc_handle.h | 4 ++
modules/mono/mono_gd/gd_mono_cache.cpp | 4 +-
modules/mono/mono_gd/gd_mono_cache.h | 2 +-
modules/mono/mono_gd/gd_mono_internals.cpp | 4 +-
modules/mono/mono_gd/gd_mono_utils.cpp | 4 +-
modules/mono/signal_awaiter_utils.cpp | 2 +-
modules/mono/signal_awaiter_utils.h | 4 +-
11 files changed, 47 insertions(+), 39 deletions(-)
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index fa041f4cba..2ad9722eca 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -653,7 +653,7 @@ void CSharpLanguage::pre_unsafe_unreference(Object *p_obj) {
void CSharpLanguage::frame() {
if (gdmono && gdmono->is_runtime_initialized() && gdmono->get_core_api_assembly() != NULL) {
- const Ref<MonoGCHandle> &task_scheduler_handle = GDMonoCache::cached_data.task_scheduler_handle;
+ const Ref<gdmono::MonoGCHandle> &task_scheduler_handle = GDMonoCache::cached_data.task_scheduler_handle;
if (task_scheduler_handle.is_valid()) {
MonoObject *task_scheduler = task_scheduler_handle->get_target();
@@ -1189,15 +1189,15 @@ void CSharpLanguage::set_language_index(int p_idx) {
lang_idx = p_idx;
}
-void CSharpLanguage::release_script_gchandle(Ref<MonoGCHandle> &p_gchandle) {
+void CSharpLanguage::release_script_gchandle(Ref<gdmono::MonoGCHandle> &p_gchandle) {
if (!p_gchandle->is_released()) { // Do not lock unnecessarily
MutexLock lock(get_singleton()->script_gchandle_release_mutex);
p_gchandle->release();
}
}
-void CSharpLanguage::release_script_gchandle(MonoObject *p_expected_obj, Ref<MonoGCHandle> &p_gchandle) {
- uint32_t pinned_gchandle = MonoGCHandle::new_strong_handle_pinned(p_expected_obj); // We might lock after this, so pin it
+void CSharpLanguage::release_script_gchandle(MonoObject *p_expected_obj, Ref<gdmono::MonoGCHandle> &p_gchandle) {
+ uint32_t pinned_gchandle = gdmono::MonoGCHandle::new_strong_handle_pinned(p_expected_obj); // We might lock after this, so pin it
if (!p_gchandle->is_released()) { // Do not lock unnecessarily
MutexLock lock(get_singleton()->script_gchandle_release_mutex);
@@ -1213,7 +1213,7 @@ void CSharpLanguage::release_script_gchandle(MonoObject *p_expected_obj, Ref<Mon
}
}
- MonoGCHandle::free_handle(pinned_gchandle);
+ gdmono::MonoGCHandle::free_handle(pinned_gchandle);
}
CSharpLanguage::CSharpLanguage() {
@@ -1267,7 +1267,7 @@ bool CSharpLanguage::setup_csharp_script_binding(CSharpScriptBinding &r_script_b
r_script_binding.inited = true;
r_script_binding.type_name = type_name;
r_script_binding.wrapper_class = type_class; // cache
- r_script_binding.gchandle = MonoGCHandle::create_strong(mono_object);
+ r_script_binding.gchandle = gdmono::MonoGCHandle::create_strong(mono_object);
r_script_binding.owner = p_object;
// Tie managed to unmanaged
@@ -1351,7 +1351,7 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) {
CRASH_COND(!data);
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
- Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
+ Ref<gdmono::MonoGCHandle> &gchandle = script_binding.gchandle;
if (!script_binding.inited)
return;
@@ -1368,9 +1368,9 @@ void CSharpLanguage::refcount_incremented_instance_binding(Object *p_object) {
return; // Called after the managed side was collected, so nothing to do here
// Release the current weak handle and replace it with a strong handle.
- uint32_t strong_gchandle = MonoGCHandle::new_strong_handle(target);
+ uint32_t strong_gchandle = gdmono::MonoGCHandle::new_strong_handle(target);
gchandle->release();
- gchandle->set_handle(strong_gchandle, MonoGCHandle::STRONG_HANDLE);
+ gchandle->set_handle(strong_gchandle, gdmono::MonoGCHandle::STRONG_HANDLE);
}
}
@@ -1386,7 +1386,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
CRASH_COND(!data);
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
- Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
+ Ref<gdmono::MonoGCHandle> &gchandle = script_binding.gchandle;
int refcount = ref_owner->reference_get_count();
@@ -1404,9 +1404,9 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
return refcount == 0; // Called after the managed side was collected, so nothing to do here
// Release the current strong handle and replace it with a weak handle.
- uint32_t weak_gchandle = MonoGCHandle::new_weak_handle(target);
+ uint32_t weak_gchandle = gdmono::MonoGCHandle::new_weak_handle(target);
gchandle->release();
- gchandle->set_handle(weak_gchandle, MonoGCHandle::WEAK_HANDLE);
+ gchandle->set_handle(weak_gchandle, gdmono::MonoGCHandle::WEAK_HANDLE);
return false;
}
@@ -1414,7 +1414,7 @@ bool CSharpLanguage::refcount_decremented_instance_binding(Object *p_object) {
return refcount == 0;
}
-CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpScript *p_script, const Ref<MonoGCHandle> &p_gchandle) {
+CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpScript *p_script, const Ref<gdmono::MonoGCHandle> &p_gchandle) {
CSharpInstance *instance = memnew(CSharpInstance);
Reference *ref = Object::cast_to<Reference>(p_owner);
@@ -1832,7 +1832,7 @@ MonoObject *CSharpInstance::_internal_new_managed() {
}
// Tie managed to unmanaged
- gchandle = MonoGCHandle::create_strong(mono_object);
+ gchandle = gdmono::MonoGCHandle::create_strong(mono_object);
if (base_ref)
_reference_owner_unsafe(); // Here, after assigning the gchandle (for the refcount_incremented callback)
@@ -1902,9 +1902,9 @@ void CSharpInstance::refcount_incremented() {
// so the owner must hold the managed side alive again to avoid it from being GCed.
// Release the current weak handle and replace it with a strong handle.
- uint32_t strong_gchandle = MonoGCHandle::new_strong_handle(gchandle->get_target());
+ uint32_t strong_gchandle = gdmono::MonoGCHandle::new_strong_handle(gchandle->get_target());
gchandle->release();
- gchandle->set_handle(strong_gchandle, MonoGCHandle::STRONG_HANDLE);
+ gchandle->set_handle(strong_gchandle, gdmono::MonoGCHandle::STRONG_HANDLE);
}
}
@@ -1925,9 +1925,9 @@ bool CSharpInstance::refcount_decremented() {
// the managed instance takes responsibility of deleting the owner when GCed.
// Release the current strong handle and replace it with a weak handle.
- uint32_t weak_gchandle = MonoGCHandle::new_weak_handle(gchandle->get_target());
+ uint32_t weak_gchandle = gdmono::MonoGCHandle::new_weak_handle(gchandle->get_target());
gchandle->release();
- gchandle->set_handle(weak_gchandle, MonoGCHandle::WEAK_HANDLE);
+ gchandle->set_handle(weak_gchandle, gdmono::MonoGCHandle::WEAK_HANDLE);
return false;
}
@@ -2298,7 +2298,7 @@ bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_upda
return false;
}
- tmp_pinned_gchandle = MonoGCHandle::new_strong_handle_pinned(tmp_object); // pin it (not sure if needed)
+ tmp_pinned_gchandle = gdmono::MonoGCHandle::new_strong_handle_pinned(tmp_object); // pin it (not sure if needed)
GDMonoMethod *ctor = script_class->get_method(CACHED_STRING_NAME(dotctor), 0);
@@ -2313,7 +2313,7 @@ bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_upda
if (ctor_exc) {
// TODO: Should we free 'tmp_native' if the exception was thrown after its creation?
- MonoGCHandle::free_handle(tmp_pinned_gchandle);
+ gdmono::MonoGCHandle::free_handle(tmp_pinned_gchandle);
tmp_object = NULL;
ERR_PRINT("Exception thrown from constructor of temporary MonoObject:");
@@ -2409,7 +2409,7 @@ bool CSharpScript::_update_exports(PlaceHolderScriptInstance *p_instance_to_upda
GDMonoUtils::debug_print_unhandled_exception(exc);
}
- MonoGCHandle::free_handle(tmp_pinned_gchandle);
+ gdmono::MonoGCHandle::free_handle(tmp_pinned_gchandle);
tmp_object = NULL;
if (tmp_native && !base_ref) {
@@ -2970,7 +2970,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
}
// Tie managed to unmanaged
- instance->gchandle = MonoGCHandle::create_strong(mono_object);
+ instance->gchandle = gdmono::MonoGCHandle::create_strong(mono_object);
if (instance->base_ref)
instance->_reference_owner_unsafe(); // Here, after assigning the gchandle (for the refcount_incremented callback)
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 3be55848d5..7b3981ef90 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -220,7 +220,7 @@ class CSharpInstance : public ScriptInstance {
bool destructing_script_instance;
Ref<CSharpScript> script;
- Ref<MonoGCHandle> gchandle;
+ Ref<gdmono::MonoGCHandle> gchandle;
bool _reference_owner_unsafe();
@@ -236,7 +236,7 @@ class CSharpInstance : public ScriptInstance {
// Do not use unless you know what you are doing
friend void GDMonoInternals::tie_managed_to_unmanaged(MonoObject *, Object *);
- static CSharpInstance *create_for_managed_type(Object *p_owner, CSharpScript *p_script, const Ref<MonoGCHandle> &p_gchandle);
+ static CSharpInstance *create_for_managed_type(Object *p_owner, CSharpScript *p_script, const Ref<gdmono::MonoGCHandle> &p_gchandle);
void _call_multilevel(MonoObject *p_mono_object, const StringName &p_method, const Variant **p_args, int p_argcount);
@@ -293,7 +293,7 @@ struct CSharpScriptBinding {
bool inited;
StringName type_name;
GDMonoClass *wrapper_class;
- Ref<MonoGCHandle> gchandle;
+ Ref<gdmono::MonoGCHandle> gchandle;
Object *owner;
};
@@ -371,8 +371,8 @@ public:
_FORCE_INLINE_ EditorPlugin *get_godotsharp_editor() const { return godotsharp_editor; }
#endif
- static void release_script_gchandle(Ref<MonoGCHandle> &p_gchandle);
- static void release_script_gchandle(MonoObject *p_expected_obj, Ref<MonoGCHandle> &p_gchandle);
+ static void release_script_gchandle(Ref<gdmono::MonoGCHandle> &p_gchandle);
+ static void release_script_gchandle(MonoObject *p_expected_obj, Ref<gdmono::MonoGCHandle> &p_gchandle);
bool debug_break(const String &p_error, bool p_allow_continue = true);
bool debug_break_parse(const String &p_file, int p_line, const String &p_error);
diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp
index 7a3ec459de..4931583884 100644
--- a/modules/mono/glue/base_object_glue.cpp
+++ b/modules/mono/glue/base_object_glue.cpp
@@ -70,7 +70,7 @@ void godot_icall_Object_Disposed(MonoObject *p_obj, Object *p_ptr) {
if (data) {
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
if (script_binding.inited) {
- Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
+ Ref<gdmono::MonoGCHandle> &gchandle = script_binding.gchandle;
if (gchandle.is_valid()) {
CSharpLanguage::release_script_gchandle(p_obj, gchandle);
}
@@ -117,7 +117,7 @@ void godot_icall_Reference_Disposed(MonoObject *p_obj, Object *p_ptr, MonoBoolea
if (data) {
CSharpScriptBinding &script_binding = ((Map<Object *, CSharpScriptBinding>::Element *)data)->get();
if (script_binding.inited) {
- Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
+ Ref<gdmono::MonoGCHandle> &gchandle = script_binding.gchandle;
if (gchandle.is_valid()) {
CSharpLanguage::release_script_gchandle(p_obj, gchandle);
}
diff --git a/modules/mono/mono_gc_handle.cpp b/modules/mono/mono_gc_handle.cpp
index eb2227dd78..e70c701331 100644
--- a/modules/mono/mono_gc_handle.cpp
+++ b/modules/mono/mono_gc_handle.cpp
@@ -32,6 +32,8 @@
#include "mono_gd/gd_mono.h"
+namespace gdmono {
+
uint32_t MonoGCHandle::new_strong_handle(MonoObject *p_object) {
return mono_gchandle_new(p_object, /* pinned: */ false);
}
@@ -76,3 +78,5 @@ MonoGCHandle::MonoGCHandle(uint32_t p_handle, HandleType p_handle_type) {
MonoGCHandle::~MonoGCHandle() {
release();
}
+
+} // namespace gdmono
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index 5f99a46479..28fcbd7a78 100644
--- a/modules/mono/mono_gc_handle.h
+++ b/modules/mono/mono_gc_handle.h
@@ -35,6 +35,8 @@
#include "core/reference.h"
+namespace gdmono {
+
class MonoGCHandle : public Reference {
GDCLASS(MonoGCHandle, Reference);
@@ -72,4 +74,6 @@ public:
~MonoGCHandle();
};
+} // namespace gdmono
+
#endif // MONO_GC_HANDLE_H
diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp
index 2ece9d0f36..976a8f2ff2 100644
--- a/modules/mono/mono_gd/gd_mono_cache.cpp
+++ b/modules/mono/mono_gd/gd_mono_cache.cpp
@@ -178,7 +178,7 @@ void CachedData::clear_godot_api_cache() {
// End of MarshalUtils methods
- task_scheduler_handle = Ref<MonoGCHandle>();
+ task_scheduler_handle = Ref<gdmono::MonoGCHandle>();
}
#define GODOT_API_CLASS(m_class) (GDMono::get_singleton()->get_core_api_assembly()->get_class(BINDINGS_NAMESPACE, #m_class))
@@ -300,7 +300,7 @@ void update_godot_api_cache() {
// TODO Move to CSharpLanguage::init() and do handle disposal
MonoObject *task_scheduler = mono_object_new(mono_domain_get(), GODOT_API_CLASS(GodotTaskScheduler)->get_mono_ptr());
GDMonoUtils::runtime_object_init(task_scheduler, GODOT_API_CLASS(GodotTaskScheduler));
- cached_data.task_scheduler_handle = MonoGCHandle::create_strong(task_scheduler);
+ cached_data.task_scheduler_handle = gdmono::MonoGCHandle::create_strong(task_scheduler);
cached_data.godot_api_cache_updated = true;
}
diff --git a/modules/mono/mono_gd/gd_mono_cache.h b/modules/mono/mono_gd/gd_mono_cache.h
index 2ed8482552..a4e05bbf5b 100644
--- a/modules/mono/mono_gd/gd_mono_cache.h
+++ b/modules/mono/mono_gd/gd_mono_cache.h
@@ -149,7 +149,7 @@ struct CachedData {
// End of MarshalUtils methods
- Ref<MonoGCHandle> task_scheduler_handle;
+ Ref<gdmono::MonoGCHandle> task_scheduler_handle;
bool corlib_cache_updated;
bool godot_api_cache_updated;
diff --git a/modules/mono/mono_gd/gd_mono_internals.cpp b/modules/mono/mono_gd/gd_mono_internals.cpp
index 4d2209ccec..a0102335b7 100644
--- a/modules/mono/mono_gd/gd_mono_internals.cpp
+++ b/modules/mono/mono_gd/gd_mono_internals.cpp
@@ -71,7 +71,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
script_binding.inited = true;
script_binding.type_name = NATIVE_GDMONOCLASS_NAME(klass);
script_binding.wrapper_class = klass;
- script_binding.gchandle = ref ? MonoGCHandle::create_weak(managed) : MonoGCHandle::create_strong(managed);
+ script_binding.gchandle = ref ? gdmono::MonoGCHandle::create_weak(managed) : gdmono::MonoGCHandle::create_strong(managed);
script_binding.owner = unmanaged;
if (ref) {
@@ -101,7 +101,7 @@ void tie_managed_to_unmanaged(MonoObject *managed, Object *unmanaged) {
return;
}
- Ref<MonoGCHandle> gchandle = ref ? MonoGCHandle::create_weak(managed) : MonoGCHandle::create_strong(managed);
+ Ref<gdmono::MonoGCHandle> gchandle = ref ? gdmono::MonoGCHandle::create_weak(managed) : gdmono::MonoGCHandle::create_strong(managed);
Ref<CSharpScript> script = CSharpScript::create_for_managed_type(klass, native);
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 4b6b0af21f..0f6545c6ef 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -83,7 +83,7 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
}
}
- Ref<MonoGCHandle> &gchandle = script_binding.gchandle;
+ Ref<gdmono::MonoGCHandle> &gchandle = script_binding.gchandle;
ERR_FAIL_COND_V(gchandle.is_null(), NULL);
MonoObject *target = gchandle->get_target();
@@ -103,7 +103,7 @@ MonoObject *unmanaged_get_managed(Object *unmanaged) {
MonoObject *mono_object = GDMonoUtils::create_managed_for_godot_object(script_binding.wrapper_class, script_binding.type_name, unmanaged);
ERR_FAIL_NULL_V(mono_object, NULL);
- gchandle->set_handle(MonoGCHandle::new_strong_handle(mono_object), MonoGCHandle::STRONG_HANDLE);
+ gchandle->set_handle(gdmono::MonoGCHandle::new_strong_handle(mono_object), gdmono::MonoGCHandle::STRONG_HANDLE);
// Tie managed to unmanaged
Reference *ref = Object::cast_to<Reference>(unmanaged);
diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp
index 6c7bb1028c..f3adf4cd77 100644
--- a/modules/mono/signal_awaiter_utils.cpp
+++ b/modules/mono/signal_awaiter_utils.cpp
@@ -117,7 +117,7 @@ void SignalAwaiterHandle::_bind_methods() {
}
SignalAwaiterHandle::SignalAwaiterHandle(MonoObject *p_managed) :
- MonoGCHandle(MonoGCHandle::new_strong_handle(p_managed), STRONG_HANDLE) {
+ gdmono::MonoGCHandle(gdmono::MonoGCHandle::new_strong_handle(p_managed), STRONG_HANDLE) {
#ifdef DEBUG_ENABLED
conn_target_id = 0;
#endif
diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h
index 5a8154b001..8cf20e98fd 100644
--- a/modules/mono/signal_awaiter_utils.h
+++ b/modules/mono/signal_awaiter_utils.h
@@ -39,8 +39,8 @@ namespace SignalAwaiterUtils {
Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p_target, MonoObject *p_awaiter);
}
-class SignalAwaiterHandle : public MonoGCHandle {
- GDCLASS(SignalAwaiterHandle, MonoGCHandle);
+class SignalAwaiterHandle : public gdmono::MonoGCHandle {
+ GDCLASS(SignalAwaiterHandle, gdmono::MonoGCHandle);
bool completed;
--
2.49.0

View File

@@ -0,0 +1,9 @@
{ godot3-debug-server }:
godot3-debug-server.overrideAttrs (
self: base: {
pname = "godot3-server";
godotBuildDescription = "server";
godotBuildTarget = "release";
}
)