1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: godot: Update to 4.5.

Godot 4.5 has some issues with system files taking precedence over ones
included in the "thirdparty" directory; see
<https://github.com/godotengine/godot/pull/111094> for discussion.  This was
further motivation to use the upstream default of enabling volk, unbundling
it, and dropping the vulkan-loader input.  The volk files are already patched
to correctly load libvulkan.

* gnu/packages/game-development.scm (godot): Update to 4.5.
[source]: Add patch to unbundle libjpeg-turbo.  Update snippet to preserve
accesskit, grisu2, smaa, and remove volk.
[arguments]<#:scons-flags>: Disable builtin libjpeg-turbo and sdl.
<#:phases>: In fix-dlopen-paths phase remove libudev and volk patching.  Add
phase unbundle-volk.
[inputs]: Add libjpeg-turbo-3, sdl3, and vulkan-volk.  Remove vulkan-loader.
* gnu/packages/patches/godot-libjpeg-turbo-unbundle.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: I3feb071ecfdb7312e9d6d8c2213a1448481753dc
This commit is contained in:
John Kehayias
2025-10-03 17:47:43 -04:00
parent 488a1bae65
commit d260134255
3 changed files with 244 additions and 16 deletions

View File

@@ -1511,6 +1511,7 @@ dist_patch_DATA = \
%D%/packages/patches/go-github-com-warpfork-go-wish-fix-tests.patch \
%D%/packages/patches/go-github-com-wraparound-wrap-free-fonts.patch \
%D%/packages/patches/go-skip-gc-test.patch \
%D%/packages/patches/godot-libjpeg-turbo-unbundle.patch \
%D%/packages/patches/gourmet-sqlalchemy-compat.patch \
%D%/packages/patches/gpaste-fix-paths.patch \
%D%/packages/patches/gpm-glibc-2.26.patch \

View File

@@ -2382,7 +2382,7 @@ scripted in a Python-like language.")
(define-public godot
(package
(name "godot")
(version "4.4.1")
(version "4.5")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -2391,7 +2391,10 @@ scripted in a Python-like language.")
(file-name (git-file-name name version))
(sha256
(base32
"0fdq69jisrvihmdir2pg6wf4mfqgqg3c0szc58mgci2lqlm4l684"))
"0s9ymgy9cwnk4v35qpn9fm993pn64h1i5k9khpd7mqs6023hl8i4"))
;; TODO: Remove this patch on next update as it was merged post
;; 4.5 release.
(patches (search-patches "godot-libjpeg-turbo-unbundle.patch"))
(modules '((guix build utils)
(ice-9 ftw)
(srfi srfi-1)))
@@ -2403,6 +2406,7 @@ scripted in a Python-like language.")
(with-directory-excursion "thirdparty"
(let* ((preserved-files
'("README.md"
"accesskit"
"amd-fsr"
"amd-fsr2"
"assimp"
@@ -2424,6 +2428,9 @@ scripted in a Python-like language.")
;; which is no longer in the glslang output
;; after the most recent update.
"glslang"
;; This is part of the simdjson package though
;; modified by Godot.
"grisu2"
"jolt_physics"
"jpeg-compressor"
"libktx"
@@ -2442,6 +2449,7 @@ scripted in a Python-like language.")
"pvrtccompressor"
"recastnavigation"
"rvo2"
"smaa"
"spirv-reflect"
"squish"
"stb_rect_pack"
@@ -2449,7 +2457,7 @@ scripted in a Python-like language.")
"tinyexr"
"ufbx"
"vhacd"
"volk"
;; Godot uses a specific (patched) version.
"vulkan"
"xatlas")))
(for-each delete-file-recursively
@@ -2460,9 +2468,6 @@ scripted in a Python-like language.")
(arguments
(list
#:scons-flags #~`("platform=linuxbsd" "target=editor" "production=yes"
;; XXX: There may be advantages to enabling volk,
;; requiring unbundling and patching to use our input.
"use_volk=no"
;; Avoid using many of the bundled libs.
;; Note: These options can be found in the SConstruct file.
"builtin_brotli=no"
@@ -2475,6 +2480,7 @@ scripted in a Python-like language.")
"builtin_graphite=no"
"builtin_harfbuzz=no"
"builtin_icu4c=no"
"builtin_libjpeg_turbo=no"
"builtin_libogg=no"
"builtin_libpng=no"
"builtin_libtheora=no"
@@ -2483,6 +2489,7 @@ scripted in a Python-like language.")
"builtin_mbedtls=no"
"builtin_pcre2=no"
"builtin_pcre2_with_jit=no"
"builtin_sdl=no"
"builtin_wslay=no"
"builtin_zlib=no"
"builtin_zstd=no")
@@ -2504,7 +2511,6 @@ scripted in a Python-like language.")
"drivers/pulseaudio/pulse-so_wrap.c"
"platform/linuxbsd/dbus-so_wrap.c"
"platform/linuxbsd/fontconfig-so_wrap.c"
"platform/linuxbsd/libudev-so_wrap.c"
"platform/linuxbsd/speechd-so_wrap.c"
"platform/linuxbsd/wayland/dynwrappers/libdecor-so_wrap.c"
"platform/linuxbsd/wayland/dynwrappers/wayland-client-core-so_wrap.c"
@@ -2518,14 +2524,11 @@ scripted in a Python-like language.")
"platform/linuxbsd/x11/dynwrappers/xlib-so_wrap.c"
"platform/linuxbsd/x11/dynwrappers/xrandr-so_wrap.c"
"platform/linuxbsd/x11/dynwrappers/xrender-so_wrap.c"
"platform/linuxbsd/xkbcommon-so_wrap.c"
"thirdparty/volk/volk.c"
"thirdparty/volk/volk.c"))
"platform/linuxbsd/xkbcommon-so_wrap.c"))
(libs '("libasound.so.2"
"libpulse.so.0"
"libdbus-1.so.3"
"libfontconfig.so.1"
"libudev.so.1"
"libspeechd.so.2"
"libdecor-0.so.0"
"libwayland-client.so.0"
@@ -2539,9 +2542,7 @@ scripted in a Python-like language.")
"libX11.so.6"
"libXrandr.so.2"
"libXrender.so.1"
"libxkbcommon.so.0"
"libvulkan.so.1"
"libvulkan.so")))
"libxkbcommon.so.0")))
(for-each (lambda (file lib)
(substitute* file
(((string-append "dlopen\\(\"" lib "\""))
@@ -2581,7 +2582,14 @@ scripted in a Python-like language.")
#$(this-package-input "wayland-protocols") "/share/wayland-protocols"))
(("#thirdparty/wayland")
(string-append
#$(this-package-input "wayland") "/share/wayland")))))
#$(this-package-input "wayland") "/share/wayland")))))
(add-after 'unbundle-wayland 'unbundle-volk
(lambda _
(let ((volk-dir "thirdparty/volk"))
(mkdir-p volk-dir)
(copy-recursively (string-append #$(this-package-input "vulkan-volk")
"/include")
volk-dir))))
(replace 'install
(lambda* (#:key inputs #:allow-other-keys)
(let ((zenity (search-input-file inputs "bin/zenity")))
@@ -2631,6 +2639,7 @@ scripted in a Python-like language.")
harfbuzz
icu4c
libdecor
libjpeg-turbo-3
libtheora
libvorbis
libvpx
@@ -2647,8 +2656,9 @@ scripted in a Python-like language.")
opusfile
pcre2
pulseaudio
sdl3
speech-dispatcher
vulkan-loader
vulkan-volk
wayland
wayland-protocols
wslay

View File

@@ -0,0 +1,217 @@
From 6d8aa8582f5c312cd5aab396f90904df1ddc0567 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Mon, 15 Sep 2025 23:43:13 +0200
Subject: [PATCH] Linux: Allow unbundling libjpeg-turbo to use system package
---
modules/jpg/SCsub | 182 ++++++++++++++++++------------------
platform/linuxbsd/detect.py | 3 +
2 files changed, 93 insertions(+), 92 deletions(-)
diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub
index e5b1bc19c0b9..a45b5eff33f1 100644
--- a/modules/jpg/SCsub
+++ b/modules/jpg/SCsub
@@ -8,98 +8,96 @@ env_jpg = env_modules.Clone()
thirdparty_obj = []
-thirdparty_dir = "#thirdparty/libjpeg-turbo"
-
-thirdparty_sources_common = [
- "jaricom.c",
- "jcapimin.c",
- "jcarith.c",
- "jchuff.c",
- "jcicc.c",
- "jcinit.c",
- "jcmarker.c",
- "jcmaster.c",
- "jcomapi.c",
- "jcparam.c",
- "jcphuff.c",
- "jctrans.c",
- "jdapimin.c",
- "jdarith.c",
- "jdatadst.c",
- "jdatadst-tj.c",
- "jdatasrc.c",
- "jdatasrc-tj.c",
- "jdhuff.c",
- "jdicc.c",
- "jdinput.c",
- "jdmarker.c",
- "jdmaster.c",
- "jdphuff.c",
- "jdtrans.c",
- "jerror.c",
- "jfdctflt.c",
- "jmemmgr.c",
- "jmemnobs.c",
- "jpeg_nbits.c",
- "transupp.c",
- "turbojpeg.c",
-]
-
-thirdparty_sources_bit_dependent = [
- "jcapistd.c",
- "jccoefct.c",
- "jccolor.c",
- "jcdctmgr.c",
- "jcmainct.c",
- "jcprepct.c",
- "jcsample.c",
- "jdcoefct.c",
- "jdcolor.c",
- "jdapistd.c",
- "jddctmgr.c",
- "jdmainct.c",
- "jdmerge.c",
- "jdpostct.c",
- "jdsample.c",
- "jfdctfst.c",
- "jfdctint.c",
- "jidctflt.c",
- "jidctfst.c",
- "jidctint.c",
- "jidctred.c",
- "jutils.c",
- "jquant1.c",
- "jquant2.c",
-]
-
-thirdparty_sources_by_bits = {
- 8: list(thirdparty_sources_bit_dependent),
- 12: list(thirdparty_sources_bit_dependent),
-}
-
-
-def source_paths(files):
- return [thirdparty_dir + "/src/" + f for f in files]
-
-
-env_jpg.Prepend(CPPEXTPATH=[thirdparty_dir + "/src"])
-
-
-def add_bit_depth(bit_depth: int):
- env_bit_depth = env_jpg.Clone()
- env_bit_depth.disable_warnings()
- env_bit_depth["OBJSUFFIX"] = f"_{bit_depth}{env_bit_depth['OBJSUFFIX']}"
- env_bit_depth.Append(CPPDEFINES=[f"BITS_IN_JSAMPLE={bit_depth}"])
- env_bit_depth.add_source_files(thirdparty_obj, source_paths(thirdparty_sources_by_bits[bit_depth]))
-
-
-add_bit_depth(8)
-add_bit_depth(12)
-
-env_thirdparty = env_jpg.Clone()
-env_thirdparty.disable_warnings()
-env_thirdparty.add_source_files(thirdparty_obj, source_paths(thirdparty_sources_common))
-env.modules_sources += thirdparty_obj
+if env["builtin_libjpeg_turbo"]:
+ thirdparty_dir = "#thirdparty/libjpeg-turbo"
+
+ thirdparty_sources_common = [
+ "jaricom.c",
+ "jcapimin.c",
+ "jcarith.c",
+ "jchuff.c",
+ "jcicc.c",
+ "jcinit.c",
+ "jcmarker.c",
+ "jcmaster.c",
+ "jcomapi.c",
+ "jcparam.c",
+ "jcphuff.c",
+ "jctrans.c",
+ "jdapimin.c",
+ "jdarith.c",
+ "jdatadst.c",
+ "jdatadst-tj.c",
+ "jdatasrc.c",
+ "jdatasrc-tj.c",
+ "jdhuff.c",
+ "jdicc.c",
+ "jdinput.c",
+ "jdmarker.c",
+ "jdmaster.c",
+ "jdphuff.c",
+ "jdtrans.c",
+ "jerror.c",
+ "jfdctflt.c",
+ "jmemmgr.c",
+ "jmemnobs.c",
+ "jpeg_nbits.c",
+ "transupp.c",
+ "turbojpeg.c",
+ ]
+
+ thirdparty_sources_bit_dependent = [
+ "jcapistd.c",
+ "jccoefct.c",
+ "jccolor.c",
+ "jcdctmgr.c",
+ "jcmainct.c",
+ "jcprepct.c",
+ "jcsample.c",
+ "jdcoefct.c",
+ "jdcolor.c",
+ "jdapistd.c",
+ "jddctmgr.c",
+ "jdmainct.c",
+ "jdmerge.c",
+ "jdpostct.c",
+ "jdsample.c",
+ "jfdctfst.c",
+ "jfdctint.c",
+ "jidctflt.c",
+ "jidctfst.c",
+ "jidctint.c",
+ "jidctred.c",
+ "jutils.c",
+ "jquant1.c",
+ "jquant2.c",
+ ]
+
+ thirdparty_sources_by_bits = {
+ 8: list(thirdparty_sources_bit_dependent),
+ 12: list(thirdparty_sources_bit_dependent),
+ }
+
+ def source_paths(files):
+ return [thirdparty_dir + "/src/" + f for f in files]
+
+ env_jpg.Prepend(CPPEXTPATH=[thirdparty_dir + "/src"])
+
+ def add_bit_depth(bit_depth: int):
+ env_bit_depth = env_jpg.Clone()
+ env_bit_depth.disable_warnings()
+ env_bit_depth["OBJSUFFIX"] = f"_{bit_depth}{env_bit_depth['OBJSUFFIX']}"
+ env_bit_depth.Append(CPPDEFINES=[f"BITS_IN_JSAMPLE={bit_depth}"])
+ env_bit_depth.add_source_files(thirdparty_obj, source_paths(thirdparty_sources_by_bits[bit_depth]))
+
+ add_bit_depth(8)
+ add_bit_depth(12)
+
+ env_thirdparty = env_jpg.Clone()
+ env_thirdparty.disable_warnings()
+ env_thirdparty.add_source_files(thirdparty_obj, source_paths(thirdparty_sources_common))
+ env.modules_sources += thirdparty_obj
+
# Godot source files
diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py
index df4dbddedd36..fbb3cdf1f13c 100644
--- a/platform/linuxbsd/detect.py
+++ b/platform/linuxbsd/detect.py
@@ -278,6 +278,9 @@ def configure(env: "SConsEnvironment"):
if not env["builtin_libwebp"]:
env.ParseConfig("pkg-config libwebp --cflags --libs")
+ if not env["builtin_libjpeg_turbo"]:
+ env.ParseConfig("pkg-config libturbojpeg --cflags --libs")
+
if not env["builtin_mbedtls"]:
# mbedTLS only provides a pkgconfig file since 3.6.0, but we still support 2.28.x,
# so fallback to manually specifying LIBS if it fails.