about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/godot
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
committerAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
commit99fcaeccb89621dd492203ce1f2d551c06f228ed (patch)
tree41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/pkgs/development/tools/godot
parent59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff)
parent75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff)
downloadnixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/config/console.nix
	nixpkgs/nixos/modules/services/mail/mailman.nix
	nixpkgs/nixos/modules/services/mail/public-inbox.nix
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/nixos/modules/services/networking/ssh/sshd.nix
	nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix
	nixpkgs/pkgs/applications/networking/irc/weechat/default.nix
	nixpkgs/pkgs/applications/window-managers/sway/default.nix
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
	nixpkgs/pkgs/development/interpreters/python/default.nix
	nixpkgs/pkgs/development/node-packages/overrides.nix
	nixpkgs/pkgs/development/tools/b4/default.nix
	nixpkgs/pkgs/servers/dict/dictd-db.nix
	nixpkgs/pkgs/servers/mail/public-inbox/default.nix
	nixpkgs/pkgs/tools/security/pinentry/default.nix
	nixpkgs/pkgs/tools/text/unoconv/default.nix
	nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/development/tools/godot')
-rw-r--r--nixpkgs/pkgs/development/tools/godot/3/default.nix (renamed from nixpkgs/pkgs/development/tools/godot/default.nix)24
-rw-r--r--nixpkgs/pkgs/development/tools/godot/3/dont_clobber_environment.patch23
-rw-r--r--nixpkgs/pkgs/development/tools/godot/3/export-templates.nix (renamed from nixpkgs/pkgs/development/tools/godot/export-templates.nix)10
-rw-r--r--nixpkgs/pkgs/development/tools/godot/3/headless.nix (renamed from nixpkgs/pkgs/development/tools/godot/headless.nix)2
-rw-r--r--nixpkgs/pkgs/development/tools/godot/3/pkg_config_additions.patch (renamed from nixpkgs/pkgs/development/tools/godot/pkg_config_additions.patch)25
-rw-r--r--nixpkgs/pkgs/development/tools/godot/3/server.nix (renamed from nixpkgs/pkgs/development/tools/godot/server.nix)2
-rw-r--r--nixpkgs/pkgs/development/tools/godot/4/default.nix132
-rw-r--r--nixpkgs/pkgs/development/tools/godot/dont_clobber_environment.patch19
8 files changed, 194 insertions, 43 deletions
diff --git a/nixpkgs/pkgs/development/tools/godot/default.nix b/nixpkgs/pkgs/development/tools/godot/3/default.nix
index 1bf38bbacf36..84b3d60ea325 100644
--- a/nixpkgs/pkgs/development/tools/godot/default.nix
+++ b/nixpkgs/pkgs/development/tools/godot/3/default.nix
@@ -16,6 +16,8 @@
 , freetype
 , openssl
 , alsa-lib
+, alsa-plugins
+, makeWrapper
 , libGLU
 , zlib
 , yasm
@@ -31,16 +33,16 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "godot";
-  version = "3.4.4";
+  version = "3.5.2";
 
   src = fetchFromGitHub {
     owner = "godotengine";
     repo = "godot";
     rev = "${version}-stable";
-    sha256 = "sha256-3AESLzqozi7Fc80u8Ml3ergZMkIhHy4tNlRe/3FsE6k=";
+    sha256 = "sha256-C+1J5N0ETL1qKust+2xP9uB4x9NwrMqIm8aFAivVYQw=";
   };
 
-  nativeBuildInputs = [ pkg-config ];
+  nativeBuildInputs = [ pkg-config makeWrapper ];
   buildInputs = [
     scons
     udev
@@ -65,7 +67,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  sconsFlags = "target=release_debug platform=x11";
+  sconsFlags = [ "target=release_debug" "platform=x11" ];
   preConfigure = ''
     sconsFlags+=" ${
       lib.concatStringsSep " "
@@ -77,7 +79,10 @@ stdenv.mkDerivation rec {
 
   installPhase = ''
     mkdir -p "$out/bin"
-    cp bin/godot.* $out/bin/godot
+    cp bin/godot.* $out/bin/godot3
+
+    wrapProgram "$out/bin/godot3" \
+      --set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib
 
     mkdir "$dev"
     cp -r modules/gdnative/include $dev
@@ -86,18 +91,19 @@ stdenv.mkDerivation rec {
     cp misc/dist/linux/godot.6 "$man/share/man/man6/"
 
     mkdir -p "$out"/share/{applications,icons/hicolor/scalable/apps}
-    cp misc/dist/linux/org.godotengine.Godot.desktop "$out/share/applications/"
+    cp misc/dist/linux/org.godotengine.Godot.desktop "$out/share/applications/org.godotengine.Godot3.desktop"
     cp icon.svg "$out/share/icons/hicolor/scalable/apps/godot.svg"
     cp icon.png "$out/share/icons/godot.png"
-    substituteInPlace "$out/share/applications/org.godotengine.Godot.desktop" \
-      --replace "Exec=godot" "Exec=$out/bin/godot"
+    substituteInPlace "$out/share/applications/org.godotengine.Godot3.desktop" \
+      --replace "Exec=godot" "Exec=$out/bin/godot3" \
+      --replace "Godot Engine" "Godot Engine 3"
   '';
 
   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" ];
+    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];
     maintainers = with maintainers; [ twey ];
   };
 }
diff --git a/nixpkgs/pkgs/development/tools/godot/3/dont_clobber_environment.patch b/nixpkgs/pkgs/development/tools/godot/3/dont_clobber_environment.patch
new file mode 100644
index 000000000000..cfd3113a6aae
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/godot/3/dont_clobber_environment.patch
@@ -0,0 +1,23 @@
+scons does not use os environment by default:
+  https://scons.org/doc/2.1.0/HTML/scons-user/x1750.html
+
+nixpkgs' cc-wrapper on the other hand relies on various NIX_* variables
+to be passed through like NIX_CFLAGS_COMPILE_BEFORE.
+--- 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
diff --git a/nixpkgs/pkgs/development/tools/godot/export-templates.nix b/nixpkgs/pkgs/development/tools/godot/3/export-templates.nix
index bfcf3e3b3dca..74a78573a983 100644
--- a/nixpkgs/pkgs/development/tools/godot/export-templates.nix
+++ b/nixpkgs/pkgs/development/tools/godot/3/export-templates.nix
@@ -3,13 +3,21 @@
 # https://docs.godotengine.org/en/stable/development/compiling/compiling_for_x11.html#building-export-templates
 godot.overrideAttrs (oldAttrs: rec {
   pname = "godot-export-templates";
-  sconsFlags = "target=release platform=x11 tools=no";
+  sconsFlags = [ "target=release" "platform=x11" "tools=no" ];
   installPhase = ''
     # The godot export command expects the export templates at
     # .../share/godot/templates/3.2.3.stable with 3.2.3 being the godot version.
     mkdir -p "$out/share/godot/templates/${oldAttrs.version}.stable"
     cp bin/godot.x11.opt.64 $out/share/godot/templates/${oldAttrs.version}.stable/linux_x11_64_release
   '';
+
+  # 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 = (oldAttrs.stripAllList or []) ++ [ "share/godot/templates" ];
+
   outputs = [ "out" ];
   meta.description =
     "Free and Open Source 2D and 3D game engine (export templates)";
diff --git a/nixpkgs/pkgs/development/tools/godot/headless.nix b/nixpkgs/pkgs/development/tools/godot/3/headless.nix
index a8d640eba1aa..3e43a4f27f0c 100644
--- a/nixpkgs/pkgs/development/tools/godot/headless.nix
+++ b/nixpkgs/pkgs/development/tools/godot/3/headless.nix
@@ -1,7 +1,7 @@
 { godot, lib }:
 godot.overrideAttrs (oldAttrs: rec {
   pname = "godot-headless";
-  sconsFlags = "target=release_debug platform=server tools=yes";
+  sconsFlags = [ "target=release_debug" "platform=server" "tools=yes" ];
   installPhase = ''
     mkdir -p "$out/bin"
     cp bin/godot_server.* $out/bin/godot-headless
diff --git a/nixpkgs/pkgs/development/tools/godot/pkg_config_additions.patch b/nixpkgs/pkgs/development/tools/godot/3/pkg_config_additions.patch
index f5ab667f1808..23506a604a9e 100644
--- a/nixpkgs/pkgs/development/tools/godot/pkg_config_additions.patch
+++ b/nixpkgs/pkgs/development/tools/godot/3/pkg_config_additions.patch
@@ -1,32 +1,33 @@
 diff --git a/platform/x11/detect.py b/platform/x11/detect.py
-index 91652aad55..d12389f9f2 100644
+index 98c9ddb..0cc2bff 100644
 --- a/platform/x11/detect.py
 +++ b/platform/x11/detect.py
-@@ -218,6 +218,11 @@ def configure(env):
+@@ -255,6 +255,10 @@ def configure(env):
      env.ParseConfig("pkg-config xrender --cflags --libs")
      env.ParseConfig("pkg-config xi --cflags --libs")
-
-+    env.ParseConfig("pkg-config xext --cflags --libs")
+ 
 +    env.ParseConfig("pkg-config xfixes --cflags --libs")
 +    env.ParseConfig("pkg-config glu --cflags --libs")
 +    env.ParseConfig("pkg-config zlib --cflags --libs")
 +
      if env["touch"]:
          env.Append(CPPDEFINES=["TOUCH_ENABLED"])
-
-@@ -323,6 +328,7 @@ def configure(env):
-         print("Enabling ALSA")
+ 
+@@ -359,7 +363,7 @@ def configure(env):
+     if os.system("pkg-config --exists alsa") == 0:  # 0 means found
          env["alsa"] = True
          env.Append(CPPDEFINES=["ALSA_ENABLED", "ALSAMIDI_ENABLED"])
+-        env.ParseConfig("pkg-config alsa --cflags")  # Only cflags, we dlopen the library.
 +        env.ParseConfig("pkg-config alsa --cflags --libs")
      else:
-         print("ALSA libraries not found, disabling driver")
-
-@@ -340,6 +346,7 @@ def configure(env):
+         print("Warning: ALSA libraries not found. Disabling the ALSA audio driver.")
+ 
+@@ -375,7 +379,7 @@ def configure(env):
+         if env["udev"]:
              if os.system("pkg-config --exists libudev") == 0:  # 0 means found
-                 print("Enabling udev support")
                  env.Append(CPPDEFINES=["UDEV_ENABLED"])
+-                env.ParseConfig("pkg-config libudev --cflags")  # Only cflags, we dlopen the library.
 +                env.ParseConfig("pkg-config libudev --cflags --libs")
              else:
-                 print("libudev development libraries not found, disabling udev support")
+                 print("Warning: libudev development libraries not found. Disabling controller hotplugging support.")
      else:
diff --git a/nixpkgs/pkgs/development/tools/godot/server.nix b/nixpkgs/pkgs/development/tools/godot/3/server.nix
index 4254dc746b66..06adf1bbfeb7 100644
--- a/nixpkgs/pkgs/development/tools/godot/server.nix
+++ b/nixpkgs/pkgs/development/tools/godot/3/server.nix
@@ -1,7 +1,7 @@
 { godot, lib }:
 godot.overrideAttrs (oldAttrs: rec {
   pname = "godot-server";
-  sconsFlags = "target=release platform=server tools=no";
+  sconsFlags = [ "target=release" "platform=server" "tools=no" ];
   installPhase = ''
     mkdir -p "$out/bin"
     cp bin/godot_server.* $out/bin/godot-server
diff --git a/nixpkgs/pkgs/development/tools/godot/4/default.nix b/nixpkgs/pkgs/development/tools/godot/4/default.nix
new file mode 100644
index 000000000000..8e77a7e9e298
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/godot/4/default.nix
@@ -0,0 +1,132 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, pkg-config
+, autoPatchelfHook
+, installShellFiles
+, scons
+, vulkan-loader
+, libGL
+, libX11
+, libXcursor
+, libXinerama
+, libXext
+, libXrandr
+, libXrender
+, libXi
+, libXfixes
+, libxkbcommon
+, alsa-lib
+, libpulseaudio
+, dbus
+, speechd
+, fontconfig
+, udev
+, withPlatform ? "linuxbsd"
+, withTarget ? "editor"
+, withPrecision ? "single"
+, withPulseaudio ? true
+, withDbus ? true
+, withSpeechd ? true
+, withFontconfig ? true
+, withUdev ? true
+, withTouch ? true
+}:
+
+assert lib.asserts.assertOneOf "withPrecision" withPrecision [ "single" "double" ];
+
+let
+  options = {
+    # Options from 'godot/SConstruct'
+    platform = withPlatform;
+    target = withTarget;
+    precision = withPrecision; # Floating-point precision level
+
+    # Options from 'godot/platform/linuxbsd/detect.py'
+    pulseaudio = withPulseaudio; # Use PulseAudio
+    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.3-stable";
+
+  src = fetchFromGitHub {
+    owner = "godotengine";
+    repo = "godot";
+    rev = version;
+    hash = "sha256-g9+CV3HsiJqiSJpZvK0N7BqKzp2Pvi6otjRLsFdmWGk=";
+  };
+
+  nativeBuildInputs = [
+    pkg-config
+    autoPatchelfHook
+    installShellFiles
+  ];
+
+  buildInputs = [
+    scons
+  ];
+
+  runtimeDependencies = [
+    vulkan-loader
+    libGL
+    libX11
+    libXcursor
+    libXinerama
+    libXext
+    libXrandr
+    libXrender
+    libXi
+    libXfixes
+    libxkbcommon
+    alsa-lib
+  ]
+  ++ lib.optional withPulseaudio libpulseaudio
+  ++ lib.optional withDbus dbus
+  ++ lib.optional withDbus dbus.lib
+  ++ lib.optional withSpeechd speechd
+  ++ lib.optional withFontconfig fontconfig
+  ++ lib.optional withFontconfig fontconfig.lib
+  ++ lib.optional withUdev udev;
+
+  enableParallelBuilding = true;
+
+  # Options from 'godot/SConstruct' and 'godot/platform/linuxbsd/detect.py'
+  sconsFlags = [ "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/godot4
+
+    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.Godot4.desktop"
+    substituteInPlace "$out/share/applications/org.godotengine.Godot4.desktop" \
+      --replace "Exec=godot" "Exec=$out/bin/godot4" \
+      --replace "Godot Engine" "Godot Engine 4"
+    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" "aarch64-linux" ];
+    maintainers = with maintainers; [ twey shiryel ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/godot/dont_clobber_environment.patch b/nixpkgs/pkgs/development/tools/godot/dont_clobber_environment.patch
deleted file mode 100644
index 74e1241513ba..000000000000
--- a/nixpkgs/pkgs/development/tools/godot/dont_clobber_environment.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff --git a/SConstruct b/SConstruct
-index d138c7b250..c925bf908e 100644
---- a/SConstruct
-+++ b/SConstruct
-@@ -65,10 +65,10 @@ elif platform_arg == "javascript":
- # 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"]
-+for k in ("TERM", "PATH", "PKG_CONFIG_PATH"):
-+    if (k in os.environ):
-+        env_base["ENV"][k] = os.environ[k]
-+
-
- env_base.disabled_modules = []
- env_base.use_ptrcall = False