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";
}
)

View File

@@ -0,0 +1,11 @@
{
version = "4.3-stable";
hash = "sha256-MzElflwXHWLgPtoOIhPLA00xX8eEdQsexZaGIEOzbj0=";
default = {
exportTemplatesHash = "sha256-9fENuvVqeQg0nmS5TqjCyTwswR+xAUyVZbaKK7Q3uSI=";
};
mono = {
exportTemplatesHash = "sha256-pkDZfkJHiDtY05TGERwTNDES88SbuFfZVYb5hln6O+U=";
nugetDeps = ./deps.json;
};
}

1307
pkgs/development/tools/godot/4.3/deps.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
{
version = "4.4.1-stable";
hash = "sha256-O4TdPYu1K2zWKMBP/7xd0UPLDb7/4dBnkGM7QydD3Yo=";
default = {
exportTemplatesHash = "sha256-eo0UreSJ/U0i8XgZMCH+iodqnlEGjtTd4m2sOuTFmog=";
};
mono = {
exportTemplatesHash = "sha256-tk0WS5axndcXWhuj86blg+nU3FB7PRMzVj8ka1gRgj4=";
nugetDeps = ./deps.json;
};
}

1307
pkgs/development/tools/godot/4.4/deps.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,11 @@
{
version = "4.5-stable";
hash = "sha256-ENDgZBM/bgL+Wlvy6GhE8a5Lyj44OqH7nOF3y74Bf/8=";
default = {
exportTemplatesHash = "sha256-N12DtmF5T5F0bS3sm1aamdTST4WnDE7ABoqvsYtVHVM=";
};
mono = {
exportTemplatesHash = "sha256-rRGCBdiuMEurhPqTdZC9G0OpVnu3+CvneGeMiRzoWLs=";
nugetDeps = ./deps.json;
};
}

1317
pkgs/development/tools/godot/4.5/deps.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
From 42f89dd50dde0896d6c55282c82db9af41cd12d8 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Wed, 26 Mar 2025 09:52:17 -0300
Subject: [PATCH] CSharpLanguage: fix crash in reload_assemblies after editor
shutdown
---
modules/mono/csharp_script.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 36c8a40ed9..2b161fb69b 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1001,8 +1001,10 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
#ifdef TOOLS_ENABLED
// FIXME: Hack to refresh editor in order to display new properties and signals. See if there is a better alternative.
if (Engine::get_singleton()->is_editor_hint()) {
- InspectorDock::get_inspector_singleton()->update_tree();
- NodeDock::get_singleton()->update_lists();
+ if (InspectorDock::get_singleton())
+ InspectorDock::get_inspector_singleton()->update_tree();
+ if (NodeDock::get_singleton())
+ NodeDock::get_singleton()->update_lists();
}
#endif
}
--
2.48.1

View File

@@ -0,0 +1,25 @@
From 6d43e80c0a455fea5dcb656967e73f755ecdd645 Mon Sep 17 00:00:00 2001
From: David McFarland <corngood@gmail.com>
Date: Sun, 9 Mar 2025 19:42:33 -0300
Subject: [PATCH] Linux: fix missing library with builtin_glslang=false
---
platform/linuxbsd/detect.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index b5e80f4a4d..8389096e26 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -472,7 +472,7 @@ def configure(env: "SConsEnvironment"):
env.ParseConfig("pkg-config vulkan --cflags --libs")
if not env["builtin_glslang"]:
# No pkgconfig file so far, hardcode expected lib name.
- env.Append(LIBS=["glslang", "SPIRV"])
+ env.Append(LIBS=["glslang", "glslang-default-resource-limits", "SPIRV"])
if env["opengl3"]:
env.Append(CPPDEFINES=["GLES3_ENABLED"])
--
2.47.1

View File

@@ -0,0 +1,716 @@
{
alsa-lib,
autoPatchelfHook,
buildPackages,
callPackage,
dbus,
dotnetCorePackages,
embree,
enet,
exportTemplatesHash,
fetchFromGitHub,
fetchpatch,
fontconfig,
freetype,
glib,
glslang,
graphite2,
harfbuzz,
hash,
icu,
installShellFiles,
lib,
libdecor,
libGL,
libjpeg_turbo,
libpulseaudio,
libtheora,
libwebp,
libX11,
libXcursor,
libXext,
libXfixes,
libXi,
libXinerama,
libxkbcommon,
libXrandr,
libXrender,
makeWrapper,
mbedtls,
miniupnpc,
openxr-loader,
pcre2,
perl,
pkg-config,
recastnavigation,
runCommand,
scons,
sdl3,
speechd-minimal,
stdenv,
stdenvNoCC,
testers,
udev,
updateScript,
version,
vulkan-loader,
wayland,
wayland-scanner,
withAlsa ? true,
withDbus ? true,
withFontconfig ? true,
withMono ? false,
nugetDeps ? null,
withPlatform ? "linuxbsd",
withPrecision ? "single",
withPulseaudio ? true,
withSpeechd ? true,
withTouch ? true,
withUdev ? true,
# Wayland in Godot requires X11 until upstream fix is merged
# https://github.com/godotengine/godot/pull/73504
withWayland ? true,
withX11 ? true,
wslay,
zstd,
}:
assert lib.asserts.assertOneOf "withPrecision" withPrecision [
"single"
"double"
];
let
mkSconsFlagsFromAttrSet = lib.mapAttrsToList (
k: v: if builtins.isString v then "${k}=${v}" else "${k}=${builtins.toJSON v}"
);
arch = stdenv.hostPlatform.linuxArch;
dotnet-sdk = if withMono then dotnetCorePackages.sdk_8_0-source else null;
dotnet-sdk_alt = if withMono then dotnetCorePackages.sdk_9_0-source else null;
dottedVersion = lib.replaceStrings [ "-" ] [ "." ] version + lib.optionalString withMono ".mono";
mkTarget =
target:
let
editor = target == "editor";
suffix = lib.optionalString withMono "-mono" + lib.optionalString (!editor) "-template";
binary = lib.concatStringsSep "." (
[
"godot"
withPlatform
target
]
++ lib.optional (withPrecision != "single") withPrecision
++ [ arch ]
++ lib.optional withMono "mono"
);
mkTests =
pkg: dotnet-sdk:
{
version = testers.testVersion {
package = pkg;
version = dottedVersion;
};
}
// lib.optionalAttrs editor (
let
project-src =
runCommand "${pkg.name}-project-src"
{
nativeBuildInputs = [ pkg ] ++ lib.optional (dotnet-sdk != null) dotnet-sdk;
}
(
''
mkdir "$out"
cd "$out"
touch project.godot
cat >create-scene.gd <<'EOF'
extends SceneTree
func _initialize():
var node = Node.new()
var script = ResourceLoader.load("res://test.gd")
node.set_script(script)
''
+ lib.optionalString withMono ''
${""}
var monoNode = Node.new()
var monoScript = ResourceLoader.load("res://Test.cs")
monoNode.set_script(monoScript)
node.add_child(monoNode)
monoNode.owner = node
''
+ ''
var scene = PackedScene.new()
var scenePath = "res://test.tscn"
scene.pack(node)
node.free()
var x = ResourceSaver.save(scene, scenePath)
ProjectSettings["application/run/main_scene"] = scenePath
ProjectSettings.save()
quit()
EOF
cat >test.gd <<'EOF'
extends Node
func _ready():
print("Hello, World!")
get_tree().quit()
EOF
cat >export_presets.cfg <<'EOF'
[preset.0]
name="build"
platform="Linux"
runnable=true
export_filter="all_resources"
include_filter=""
exclude_filter=""
[preset.0.options]
binary_format/architecture="${arch}"
EOF
''
+ lib.optionalString withMono ''
cat >Test.cs <<'EOF'
using Godot;
using System;
public partial class Test : Node
{
public override void _Ready()
{
GD.Print("Hello, Mono!");
GetTree().Quit();
}
}
EOF
sdk_version=$(basename ${pkg}/share/nuget/packages/godot.net.sdk/*)
cat >UnnamedProject.csproj <<EOF
<Project Sdk="Godot.NET.Sdk/$sdk_version">
<PropertyGroup>
<TargetFramework>net${lib.versions.majorMinor (lib.defaultTo pkg.dotnet-sdk dotnet-sdk).version}</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
</Project>
EOF
configureNuget
dotnet new sln -n UnnamedProject
message=$(dotnet sln add UnnamedProject.csproj)
echo "$message"
# dotnet sln doesn't return an error when it fails to add the project
[[ $message == "Project \`UnnamedProject.csproj\` added to the solution." ]]
rm nuget.config
''
);
export-tests = lib.makeExtensible (final: {
inherit (pkg) export-template;
export = stdenvNoCC.mkDerivation {
name = "${final.export-template.name}-export";
nativeBuildInputs = [ pkg ] ++ lib.optional (dotnet-sdk != null) dotnet-sdk;
src = project-src;
buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
mkdir -p $HOME/.local/share/godot/
ln -s "${final.export-template}"/share/godot/export_templates "$HOME"/.local/share/godot/
godot${suffix} --headless --build-solutions -s create-scene.gd
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p "$out"/bin
godot${suffix} --headless --export-release build "$out"/bin/test
runHook postInstall
'';
};
run = runCommand "${final.export.name}-runs" { passthru = { inherit (final) export; }; } (
''
(
set -eo pipefail
HOME=$(mktemp -d)
"${final.export}"/bin/test --headless | tail -n+3 | (
''
+ lib.optionalString withMono ''
# indent
read output
if [[ "$output" != "Hello, Mono!" ]]; then
echo "unexpected output: $output" >&2
exit 1
fi
''
+ ''
read output
if [[ "$output" != "Hello, World!" ]]; then
echo "unexpected output: $output" >&2
exit 1
fi
)
touch "$out"
)
''
);
});
in
{
export-runs = export-tests.run;
export-bin-runs =
(export-tests.extend (
final: prev: {
export-template = pkg.export-templates-bin;
export = prev.export.overrideAttrs (prev: {
nativeBuildInputs = prev.nativeBuildInputs or [ ] ++ [
autoPatchelfHook
];
# stripping dlls results in:
# Failed to load System.Private.CoreLib.dll (error code 0x8007000B)
stripExclude = lib.optional withMono [ "*.dll" ];
runtimeDependencies =
prev.runtimeDependencies or [ ]
++ map lib.getLib [
alsa-lib
libpulseaudio
libX11
libXcursor
libXext
libXi
libXrandr
udev
vulkan-loader
];
});
}
)).run;
}
);
attrs = finalAttrs: rec {
pname = "godot${suffix}";
inherit version;
src = fetchFromGitHub {
owner = "godotengine";
repo = "godot";
tag = version;
inherit hash;
# Required for the commit hash to be included in the version number.
#
# `methods.py` reads the commit hash from `.git/HEAD` and manually follows
# refs.
#
# See also 'hash' in
# https://docs.godotengine.org/en/stable/classes/class_engine.html#class-engine-method-get-version-info
leaveDotGit = true;
# Only keep HEAD, because leaveDotGit is non-deterministic:
# https://github.com/NixOS/nixpkgs/issues/8567
postFetch = ''
hash=$(git -C "$out" rev-parse HEAD)
rm -r "$out"/.git
mkdir "$out"/.git
echo "$hash" > "$out"/.git/HEAD
'';
};
outputs = [
"out"
]
++ lib.optional editor "man";
separateDebugInfo = true;
# Set the build name which is part of the version. In official downloads, this
# is set to 'official'. When not specified explicitly, it is set to
# 'custom_build'. Other platforms packaging Godot (Gentoo, Arch, Flatpack
# etc.) usually set this to their name as well.
#
# See also 'methods.py' in the Godot repo and 'build' in
# https://docs.godotengine.org/en/stable/classes/class_engine.html#class-engine-method-get-version-info
BUILD_NAME = "nixpkgs";
preConfigure = lib.optionalString (editor && withMono) ''
# TODO: avoid pulling in dependencies of windows-only project
dotnet sln modules/mono/editor/GodotTools/GodotTools.sln \
remove modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/GodotTools.OpenVisualStudio.csproj
dotnet restore modules/mono/glue/GodotSharp/GodotSharp.sln
dotnet restore modules/mono/editor/GodotTools/GodotTools.sln
dotnet restore modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk.sln
'';
# From: https://github.com/godotengine/godot/blob/4.2.2-stable/SConstruct
sconsFlags = mkSconsFlagsFromAttrSet (
{
# Options from 'SConstruct'
precision = withPrecision; # Floating-point precision level
production = true; # Set defaults to build Godot for use in production
platform = withPlatform;
inherit target;
debug_symbols = true;
# Options from 'platform/linuxbsd/detect.py'
alsa = withAlsa;
dbus = withDbus; # Use D-Bus to handle screensaver and portal desktop settings
fontconfig = withFontconfig; # Use fontconfig for system fonts support
pulseaudio = withPulseaudio; # Use PulseAudio
speechd = withSpeechd; # Use Speech Dispatcher for Text-to-Speech support
touch = withTouch; # Enable touch events
udev = withUdev; # Use udev for gamepad connection callbacks
wayland = withWayland; # Compile with Wayland support
x11 = withX11; # Compile with X11 support
module_mono_enabled = withMono;
# aliasing bugs exist with hardening+LTO
# https://github.com/godotengine/godot/pull/104501
ccflags = "-fno-strict-aliasing";
linkflags = "-Wl,--build-id";
# libraries that aren't available in nixpkgs
builtin_msdfgen = true;
builtin_rvo2_2d = true;
builtin_rvo2_3d = true;
builtin_xatlas = true;
# using system clipper2 is currently not implemented
builtin_clipper2 = true;
use_sowrap = false;
}
// lib.optionalAttrs (lib.versionOlder version "4.4") {
# libraries that aren't available in nixpkgs
builtin_squish = true;
# broken with system packages
builtin_miniupnpc = true;
}
// lib.optionalAttrs (lib.versionAtLeast version "4.5") {
redirect_build_objects = false; # Avoid copying build objects to output
}
);
enableParallelBuilding = true;
strictDeps = true;
patches = [
./Linux-fix-missing-library-with-builtin_glslang-false.patch
]
++ lib.optionals (lib.versionOlder version "4.4") [
(fetchpatch {
name = "wayland-header-fix.patch";
url = "https://github.com/godotengine/godot/commit/6ce71f0fb0a091cffb6adb4af8ab3f716ad8930b.patch";
hash = "sha256-hgAtAtCghF5InyGLdE9M+9PjPS1BWXWGKgIAyeuqkoU=";
})
# Fix a crash in the mono test project build. It no longer seems to
# happen in 4.4, but an existing fix couldn't be identified.
./CSharpLanguage-fix-crash-in-reload_assemblies-after-.patch
]
++ lib.optional (lib.versionAtLeast version "4.5") ./fix-freetype-link-error.patch;
postPatch = ''
# this stops scons from hiding e.g. NIX_CFLAGS_COMPILE
perl -pi -e '{ $r += s:(env = Environment\(.*):\1\nenv["ENV"] = os.environ: } END { exit ($r != 1) }' SConstruct
# disable all builtin libraries by default
perl -pi -e '{ $r |= s:(opts.Add\(BoolVariable\("builtin_.*, )True(\)\)):\1False\2: } END { exit ($r != 1) }' SConstruct
substituteInPlace platform/linuxbsd/detect.py \
--replace-fail /usr/include/recastnavigation ${lib.escapeShellArg (lib.getDev recastnavigation)}/include/recastnavigation
substituteInPlace thirdparty/glad/egl.c \
--replace-fail \
'static const char *NAMES[] = {"libEGL.so.1", "libEGL.so"}' \
'static const char *NAMES[] = {"${lib.getLib libGL}/lib/libEGL.so"}'
substituteInPlace thirdparty/glad/gl.c \
--replace-fail \
'static const char *NAMES[] = {"libGLESv2.so.2", "libGLESv2.so"}' \
'static const char *NAMES[] = {"${lib.getLib libGL}/lib/libGLESv2.so"}' \
substituteInPlace thirdparty/glad/gl{,x}.c \
--replace-fail \
'"libGL.so.1"' \
'"${lib.getLib libGL}/lib/libGL.so"'
substituteInPlace thirdparty/volk/volk.c \
--replace-fail \
'dlopen("libvulkan.so.1"' \
'dlopen("${lib.getLib vulkan-loader}/lib/libvulkan.so"'
'';
depsBuildBuild = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
buildPackages.stdenv.cc
pkg-config
];
buildInputs = [
embree
enet
freetype
glslang
graphite2
(harfbuzz.override { withIcu = true; })
icu
libtheora
libwebp
mbedtls
miniupnpc
openxr-loader
pcre2
recastnavigation
wslay
zstd
]
++ lib.optionals (lib.versionAtLeast version "4.5") [
libjpeg_turbo
sdl3
]
++ lib.optionals (editor && withMono) dotnet-sdk.packages
++ lib.optional withAlsa alsa-lib
++ lib.optional (withX11 || withWayland) libxkbcommon
++ lib.optionals withX11 [
libX11
libXcursor
libXext
libXfixes
libXi
libXinerama
libXrandr
libXrender
]
++ lib.optionals withWayland [
libdecor
wayland
]
++ lib.optionals withDbus [
dbus
]
++ lib.optionals withFontconfig [
fontconfig
]
++ lib.optional withPulseaudio libpulseaudio
++ lib.optionals withSpeechd [
speechd-minimal
glib
]
++ lib.optional withUdev udev;
nativeBuildInputs = [
installShellFiles
perl
pkg-config
scons
]
++ lib.optionals withWayland [ wayland-scanner ]
++ lib.optional (editor && withMono) [
makeWrapper
dotnet-sdk
];
postBuild = lib.optionalString (editor && withMono) ''
echo "Generating Glue"
bin/${binary} --headless --generate-mono-glue modules/mono/glue
echo "Building C#/.NET Assemblies"
python modules/mono/build_scripts/build_assemblies.py --godot-output-dir bin --precision=${withPrecision}
'';
installPhase = ''
runHook preInstall
mkdir -p "$out"/{bin,libexec}
cp -r bin/* "$out"/libexec
cd "$out"/bin
ln -s ../libexec/${binary} godot${lib.versions.majorMinor version}${suffix}
ln -s godot${lib.versions.majorMinor version}${suffix} godot${lib.versions.major version}${suffix}
ln -s godot${lib.versions.major version}${suffix} godot${suffix}
cd -
''
+ (
if editor then
''
installManPage misc/dist/linux/godot.6
mkdir -p "$out"/share/{applications,icons/hicolor/scalable/apps}
cp misc/dist/linux/org.godotengine.Godot.desktop \
"$out/share/applications/org.godotengine.Godot${lib.versions.majorMinor version}${suffix}.desktop"
substituteInPlace "$out/share/applications/org.godotengine.Godot${lib.versions.majorMinor version}${suffix}.desktop" \
--replace-fail "Exec=godot" "Exec=$out/bin/godot${suffix}" \
--replace-fail "Godot Engine" "Godot Engine ${
lib.versions.majorMinor version + lib.optionalString withMono " (Mono)"
}"
cp icon.svg "$out/share/icons/hicolor/scalable/apps/godot.svg"
cp icon.png "$out/share/icons/godot.png"
''
+ lib.optionalString withMono ''
mkdir -p "$out"/share/nuget
mv "$out"/libexec/GodotSharp/Tools/nupkgs "$out"/share/nuget/source
wrapProgram "$out"/libexec/${binary} \
--prefix NUGET_FALLBACK_PACKAGES ';' "$out"/share/nuget/packages/
''
else
let
template =
(lib.replaceStrings
[ "template" ]
[
{
linuxbsd = "linux";
}
.${withPlatform}
]
target
)
+ "."
+ arch;
in
''
templates="$out"/share/godot/export_templates/${dottedVersion}
mkdir -p "$templates"
ln -s "$out"/libexec/${binary} "$templates"/${template}
''
)
+ ''
runHook postInstall
'';
passthru = {
inherit updateScript;
tests =
mkTests finalAttrs.finalPackage dotnet-sdk
// lib.optionalAttrs (editor && withMono) {
sdk-override = mkTests finalAttrs.finalPackage dotnet-sdk_alt;
};
}
// lib.optionalAttrs editor {
export-template = mkTarget "template_release";
export-templates-bin = (
callPackage ./export-templates-bin.nix {
inherit version withMono;
godot = finalAttrs.finalPackage;
hash = exportTemplatesHash;
}
);
};
requiredSystemFeatures = [
# fixes: No space left on device
"big-parallel"
];
meta = {
changelog = "https://github.com/godotengine/godot/releases/tag/${version}";
description = "Free and Open Source 2D and 3D game engine";
homepage = "https://godotengine.org";
license = lib.licenses.mit;
platforms = [
"x86_64-linux"
"aarch64-linux"
]
++ lib.optional (!withMono) "i686-linux";
maintainers = with lib.maintainers; [
shiryel
corngood
];
mainProgram = "godot${suffix}";
};
};
unwrapped = stdenv.mkDerivation (
if (editor && withMono) then
dotnetCorePackages.addNuGetDeps {
inherit nugetDeps;
overrideFetchAttrs = old: rec {
runtimeIds = map (system: dotnetCorePackages.systemToDotnetRid system) old.meta.platforms;
buildInputs =
old.buildInputs
++ lib.concatLists (lib.attrValues (lib.getAttrs runtimeIds dotnet-sdk.targetPackages));
};
} attrs
else
attrs
);
wrapper =
if (editor && withMono) then
stdenv.mkDerivation (finalAttrs: {
__structuredAttrs = true;
pname = finalAttrs.unwrapped.pname + "-wrapper";
inherit (finalAttrs.unwrapped) version outputs meta;
inherit unwrapped dotnet-sdk;
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
strictDeps = true;
installPhase = ''
runHook preInstall
mkdir -p "$out"/{bin,libexec,share/applications,nix-support}
cp -d "$unwrapped"/bin/* "$out"/bin/
ln -s "$unwrapped"/libexec/* "$out"/libexec/
ln -s "$unwrapped"/share/nuget "$out"/share/
cp "$unwrapped/share/applications/org.godotengine.Godot${lib.versions.majorMinor version}${suffix}.desktop" \
"$out/share/applications/org.godotengine.Godot${lib.versions.majorMinor version}${suffix}.desktop"
substituteInPlace "$out/share/applications/org.godotengine.Godot${lib.versions.majorMinor version}${suffix}.desktop" \
--replace-fail "Exec=$unwrapped/bin/godot${suffix}" "Exec=$out/bin/godot${suffix}"
ln -s "$unwrapped"/share/icons $out/share/
# ensure dotnet hooks get run
echo "${finalAttrs.dotnet-sdk}" >> "$out"/nix-support/propagated-build-inputs
wrapProgram "$out"/libexec/${binary} \
--prefix PATH : "${lib.makeBinPath [ finalAttrs.dotnet-sdk ]}"
runHook postInstall
'';
postFixup = lib.concatMapStringsSep "\n" (output: ''
[[ -e "''$${output}" ]] || ln -s "${unwrapped.${output}}" "''$${output}"
'') finalAttrs.unwrapped.outputs;
passthru = unwrapped.passthru // {
tests = mkTests finalAttrs.finalPackage null // {
unwrapped = lib.recurseIntoAttrs unwrapped.tests;
sdk-override = lib.recurseIntoAttrs (
mkTests (finalAttrs.finalPackage.overrideAttrs { dotnet-sdk = dotnet-sdk_alt; }) null
);
};
};
})
else
unwrapped;
in
wrapper;
in
mkTarget "editor"

View File

@@ -0,0 +1,81 @@
# TODO:
# - combine binary and source tests
# - filter builtInputs by builtin_ flags
{
callPackage,
lib,
nix-update-script,
fetchzip,
}:
let
mkGodotPackages =
versionPrefix:
let
attrs = import (./. + "/${versionPrefix}/default.nix");
updateScript = [
./update.sh
versionPrefix
(builtins.unsafeGetAttrPos "version" attrs).file
];
in
lib.recurseIntoAttrs rec {
godot = callPackage ./common.nix {
inherit updateScript;
inherit (attrs)
version
hash
;
inherit (attrs.default)
exportTemplatesHash
;
};
godot-mono = godot.override {
withMono = true;
inherit (attrs.mono)
exportTemplatesHash
nugetDeps
;
};
export-template = godot.export-template;
export-template-mono = godot-mono.export-template;
export-templates-bin = godot.export-templates-bin;
export-templates-mono-bin = godot-mono.export-templates-bin;
};
in
rec {
godot3 = callPackage ./3 { };
godot3-export-templates = callPackage ./3/export-templates.nix { };
godot3-headless = callPackage ./3/headless.nix { };
godot3-debug-server = callPackage ./3/debug-server.nix { };
godot3-server = callPackage ./3/server.nix { };
godot3-mono = callPackage ./3/mono { };
godot3-mono-export-templates = callPackage ./3/mono/export-templates.nix { };
godot3-mono-headless = callPackage ./3/mono/headless.nix { };
godot3-mono-debug-server = callPackage ./3/mono/debug-server.nix { };
godot3-mono-server = callPackage ./3/mono/server.nix { };
godotPackages_4_3 = mkGodotPackages "4.3";
godotPackages_4_4 = mkGodotPackages "4.4";
godotPackages_4_5 = mkGodotPackages "4.5";
godotPackages_4 = godotPackages_4_5;
godotPackages = godotPackages_4;
godot_4_3 = godotPackages_4_3.godot;
godot_4_3-mono = godotPackages_4_3.godot-mono;
godot_4_3-export-templates-bin = godotPackages_4_3.export-templates-bin;
godot_4_4 = godotPackages_4_4.godot;
godot_4_4-mono = godotPackages_4_4.godot-mono;
godot_4_4-export-templates-bin = godotPackages_4_4.export-templates-bin;
godot_4_5 = godotPackages_4_5.godot;
godot_4_5-mono = godotPackages_4_5.godot-mono;
godot_4_5-export-templates-bin = godotPackages_4_5.export-templates-bin;
godot_4 = godotPackages_4.godot;
godot_4-mono = godotPackages_4.godot-mono;
godot_4-export-templates-bin = godotPackages_4.export-templates-bin;
godot = godotPackages.godot;
godot-mono = godotPackages.godot-mono;
godot-export-templates-bin = godotPackages.export-templates-bin;
}

View File

@@ -0,0 +1,54 @@
{
fetchurl,
godot,
hash,
lib,
stdenvNoCC,
unzip,
version,
withMono ? false,
}:
# Export templates is necessary for setting up Godot engine, it's used when exporting projects.
# Godot applications/games packages needs to reference export templates.
# Export templates version should be kept in sync with Godot version.
# https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html#export-templates
let
self = stdenvNoCC.mkDerivation {
pname = "godot-export-templates${lib.optionalString withMono "-mono"}-bin";
version = version;
src = fetchurl {
url = "https://github.com/godotengine/godot/releases/download/${version}/Godot_v${version}${lib.optionalString withMono "_mono"}_export_templates.tpz";
inherit hash;
};
nativeBuildInputs = [
unzip
];
unpackPhase = ''
runHook preUnpack
unzip -q "$src"
runHook postUnpack
'';
installPhase = ''
templates="$out"/share/godot/export_templates
mkdir -p "$templates"
read version < templates/version.txt
mv templates "$templates/$version"
'';
meta = {
inherit (godot.meta)
changelog
description
homepage
license
maintainers
;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
};
in
self

View File

@@ -0,0 +1,16 @@
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 0a52ef46c5..c932900037 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -62,9 +62,9 @@ if env["builtin_freetype"]:
if env["brotli"]:
env_freetype.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
- env_freetype.Prepend(CPPEXTPATH=[thirdparty_dir + "/include"])
+ env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"])
# Also needed in main env for scene/
- env.Prepend(CPPEXTPATH=[thirdparty_dir + "/include"])
+ env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"])

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. --pure -i bash -p bash nix nix-update git cacert common-updater-scripts
set -euo pipefail
versionPrefix=$1
file=$2
attr=godotPackages_${versionPrefix/./_}
prev_version=$(nix eval --raw -f. "$attr".godot)
nix-update "$attr".godot \
--version-regex "($versionPrefix\\b.*-stable)" \
--override-filename "$2" \
--src-only
[[ $(nix eval --raw -f. "$attr".godot) != "$prev_version" ]] || exit 0
fetch_deps=$(nix build -f. "$attr".godot-mono.fetch-deps --print-out-paths --no-link)
"$fetch_deps"
update-source-version "$attr".godot.export-templates-bin --ignore-same-version --file="$file"
update-source-version "$attr".godot-mono.export-templates-bin --ignore-same-version --file="$file"