Merge pull request #196881 from shiryel/godot4

This commit is contained in:
Sandro 2022-10-25 16:40:17 +02:00 committed by GitHub
commit b4c6c117b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 143 additions and 4 deletions

View file

@ -0,0 +1,125 @@
{ stdenv
, lib
, fetchFromGitHub
, installShellFiles
, autoPatchelfHook
, pkg-config
, scons
, vulkan-loader
, libX11
, libXcursor
, libXinerama
, libXi
, libXrandr
, libXext
, libXfixes
, libGLU
, freetype
, alsa-lib
, libpulseaudio
, dbus
, speechd
, fontconfig
, udev
, withPulseaudio ? false
, withDbus ? true
, withSpeechd ? false
, withFontconfig ? true
, withUdev ? true
, withTouch ? true
}:
let
# Options from godot/platform/linuxbsd/detect.py
options = {
pulseaudio = withPulseaudio;
dbus = withDbus; # Use D-Bus to handle screensaver and portal desktop settings
speechd = withSpeechd; # Use Speech Dispatcher for Text-to-Speech support
fontconfig = withFontconfig; # Use fontconfig for system fonts support
udev = withUdev; # Use udev for gamepad connection callbacks
touch = withTouch; # Enable touch events
};
in
stdenv.mkDerivation rec {
pname = "godot";
version = "4.0-beta3";
src = fetchFromGitHub {
owner = "godotengine";
repo = "godot";
rev = "01ae26d31befb6679ecd92cd3c73aa5a76162e95";
sha256 = "sha256-Q+zMviGevezjcQKJPOm7zAu4liJ5z8Rl73TYmjRR3MY=";
};
nativeBuildInputs = [
pkg-config
autoPatchelfHook
installShellFiles
];
buildInputs = [
scons
libGLU
libX11
libXcursor
libXinerama
libXi
libXrandr
libXext
libXfixes
]
++ runtimeDependencies
# Necessary to make godot see fontconfig.lib and dbus.lib
++ lib.optional withFontconfig fontconfig
++ lib.optional withDbus dbus;
runtimeDependencies = [
vulkan-loader
alsa-lib
]
++ lib.optional withPulseaudio libpulseaudio
++ lib.optional withDbus dbus.lib
++ lib.optional withSpeechd speechd
++ lib.optional withFontconfig fontconfig.lib
++ lib.optional withUdev udev;
patches = [
# Godot expects to find xfixes inside xi, but nix's pkg-config only
# gives the libs for the requested package (ignoring the propagated-build-inputs)
./xfixes.patch
];
enableParallelBuilding = true;
sconsFlags = "platform=linuxbsd target=editor production=true";
preConfigure = ''
sconsFlags+=" ${
lib.concatStringsSep " "
(lib.mapAttrsToList (k: v: "${k}=${builtins.toJSON v}") options)
}"
'';
outputs = [ "out" "man" ];
installPhase = ''
mkdir -p "$out/bin"
cp bin/godot.* $out/bin/godot
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/"
substituteInPlace "$out/share/applications/org.godotengine.Godot.desktop" \
--replace "Exec=godot" "Exec=$out/bin/godot"
cp icon.svg "$out/share/icons/hicolor/scalable/apps/godot.svg"
cp icon.png "$out/share/icons/godot.png"
'';
meta = with lib; {
homepage = "https://godotengine.org";
description = "Free and Open Source 2D and 3D game engine";
license = licenses.mit;
platforms = [ "i686-linux" "x86_64-linux" ];
maintainers = with maintainers; [ twey shiryel ];
};
}

View file

@ -0,0 +1,12 @@
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index ac69f3806b..14acbf5c58 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -191,6 +191,7 @@ def configure(env: "Environment"):
env.ParseConfig("pkg-config xrandr --cflags --libs")
env.ParseConfig("pkg-config xrender --cflags --libs")
env.ParseConfig("pkg-config xi --cflags --libs")
+ env.ParseConfig("pkg-config xfixes --cflags --libs")
if env["touch"]:
env.Append(CPPDEFINES=["TOUCH_ENABLED"])

View file

@ -7269,13 +7269,15 @@ with pkgs;
gocryptfs = callPackage ../tools/filesystems/gocryptfs { }; gocryptfs = callPackage ../tools/filesystems/gocryptfs { };
godot = callPackage ../development/tools/godot {}; godot_4 = callPackage ../development/tools/godot/4 { };
godot-export-templates = callPackage ../development/tools/godot/export-templates.nix { }; godot = callPackage ../development/tools/godot/3 { };
godot-headless = callPackage ../development/tools/godot/headless.nix { }; godot-export-templates = callPackage ../development/tools/godot/3/export-templates.nix { };
godot-server = callPackage ../development/tools/godot/server.nix { }; godot-headless = callPackage ../development/tools/godot/3/headless.nix { };
godot-server = callPackage ../development/tools/godot/3/server.nix { };
go-mtpfs = callPackage ../tools/filesystems/go-mtpfs { }; go-mtpfs = callPackage ../tools/filesystems/go-mtpfs { };