about summary refs log tree commit diff
path: root/pkgs/development/tools/godot
diff options
context:
space:
mode:
authorShiryel <contact@shiryel.com>2022-10-20 01:34:44 -0300
committerShiryel <contact@shiryel.com>2022-10-23 18:00:52 -0300
commite149ae24298a0052d66795726fcb624315612fa8 (patch)
tree7fffb06857330d262199422a85a073aa1b37f7de /pkgs/development/tools/godot
parent2bf9d4fbe9f7c87ce70770a6c6fde40766055a12 (diff)
godot_4: init at 4.0-beta3
Diffstat (limited to 'pkgs/development/tools/godot')
-rw-r--r--pkgs/development/tools/godot/3/default.nix (renamed from pkgs/development/tools/godot/default.nix)0
-rw-r--r--pkgs/development/tools/godot/3/dont_clobber_environment.patch (renamed from pkgs/development/tools/godot/dont_clobber_environment.patch)0
-rw-r--r--pkgs/development/tools/godot/3/export-templates.nix (renamed from pkgs/development/tools/godot/export-templates.nix)0
-rw-r--r--pkgs/development/tools/godot/3/headless.nix (renamed from pkgs/development/tools/godot/headless.nix)0
-rw-r--r--pkgs/development/tools/godot/3/pkg_config_additions.patch (renamed from pkgs/development/tools/godot/pkg_config_additions.patch)0
-rw-r--r--pkgs/development/tools/godot/3/server.nix (renamed from pkgs/development/tools/godot/server.nix)0
-rw-r--r--pkgs/development/tools/godot/4/default.nix125
-rw-r--r--pkgs/development/tools/godot/4/xfixes.patch12
8 files changed, 137 insertions, 0 deletions
diff --git a/pkgs/development/tools/godot/default.nix b/pkgs/development/tools/godot/3/default.nix
index 97c9786e8fd22..97c9786e8fd22 100644
--- a/pkgs/development/tools/godot/default.nix
+++ b/pkgs/development/tools/godot/3/default.nix
diff --git a/pkgs/development/tools/godot/dont_clobber_environment.patch b/pkgs/development/tools/godot/3/dont_clobber_environment.patch
index 74e1241513ba8..74e1241513ba8 100644
--- a/pkgs/development/tools/godot/dont_clobber_environment.patch
+++ b/pkgs/development/tools/godot/3/dont_clobber_environment.patch
diff --git a/pkgs/development/tools/godot/export-templates.nix b/pkgs/development/tools/godot/3/export-templates.nix
index 74a78573a9837..74a78573a9837 100644
--- a/pkgs/development/tools/godot/export-templates.nix
+++ b/pkgs/development/tools/godot/3/export-templates.nix
diff --git a/pkgs/development/tools/godot/headless.nix b/pkgs/development/tools/godot/3/headless.nix
index 3e43a4f27f0c9..3e43a4f27f0c9 100644
--- a/pkgs/development/tools/godot/headless.nix
+++ b/pkgs/development/tools/godot/3/headless.nix
diff --git a/pkgs/development/tools/godot/pkg_config_additions.patch b/pkgs/development/tools/godot/3/pkg_config_additions.patch
index 23506a604a9e6..23506a604a9e6 100644
--- a/pkgs/development/tools/godot/pkg_config_additions.patch
+++ b/pkgs/development/tools/godot/3/pkg_config_additions.patch
diff --git a/pkgs/development/tools/godot/server.nix b/pkgs/development/tools/godot/3/server.nix
index 06adf1bbfeb7f..06adf1bbfeb7f 100644
--- a/pkgs/development/tools/godot/server.nix
+++ b/pkgs/development/tools/godot/3/server.nix
diff --git a/pkgs/development/tools/godot/4/default.nix b/pkgs/development/tools/godot/4/default.nix
new file mode 100644
index 0000000000000..177e2448cc31f
--- /dev/null
+++ b/pkgs/development/tools/godot/4/default.nix
@@ -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 ];
+  };
+}
diff --git a/pkgs/development/tools/godot/4/xfixes.patch b/pkgs/development/tools/godot/4/xfixes.patch
new file mode 100644
index 0000000000000..b3d0b7aa3cc58
--- /dev/null
+++ b/pkgs/development/tools/godot/4/xfixes.patch
@@ -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"])