From 09e73683a2c303016fa57bf5d84a8e997d4c0a30 Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Fri, 14 Jul 2023 11:08:31 -0400 Subject: gnu: godot: Update to 4.1. Rename godot@3 to godot-lts. * gnu/packages/game-development.scm (godot): Update to 4.1. [source]: Update snippet: remove embree and enet; add amd-fsr, astcenc, basis_universal, brotli, linuxbsd_headers, etcpak, meshoptimizer, msdfgen, noise, openxr, rvo2, spirv-reflect, thorvg, volk, vulkan. [arguments]: Remove #:scons. Update #:scons-flags to unbundle more libraries. [phases]: Remove 'build-headless phase (headless is no longer has a separate build). Add 'fix-dl-open-paths and 'unbundle-xkbcommon phases. In 'install phase, remove headless output. Update 'wrap phase to remove eudev. [outputs]: Remove headless. [inputs]: Add dbus, embree, enet, fontconfig, glslang, libpng, harfbuzz, icu4c, libxkbcommon, openxr, speech-dispatcher, vulkan-loader, zlib. Remove bullet. Rename freetype to freetype-with-brotli. (godot-lts): New variable. godot@3 is the LTS release. * gnu/packages/games.scm (superstarfighter)[native-inputs]: Use it. [inputs]: Use it. --- gnu/packages/game-development.scm | 255 +++++++++++++++++++++++++++++++++++++- 1 file changed, 254 insertions(+), 1 deletion(-) (limited to 'gnu/packages/game-development.scm') diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm index eebe8ecbf4..f97c126441 100644 --- a/gnu/packages/game-development.scm +++ b/gnu/packages/game-development.scm @@ -28,6 +28,7 @@ ;;; Copyright © 2022 Felix Gruber ;;; Copyright © 2022 Jai Vetrivelan ;;; Copyright © 2022 dan +;;; Copyright © 2023 John Kehayias ;;; ;;; This file is part of GNU Guix. ;;; @@ -54,6 +55,7 @@ #:use-module (guix git-download) #:use-module (guix svn-download) #:use-module (guix utils) + #:use-module (guix build utils) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system python) @@ -86,6 +88,7 @@ #:use-module (gnu packages graphviz) #:use-module (gnu packages gtk) #:use-module (gnu packages guile) + #:use-module (gnu packages icu4c) #:use-module (gnu packages image) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) @@ -95,6 +98,7 @@ #:use-module (gnu packages multiprecision) #:use-module (gnu packages music) #:use-module (gnu packages ncurses) + #:use-module (gnu packages networking) #:use-module (gnu packages pcre) #:use-module (gnu packages pkg-config) #:use-module (gnu packages pulseaudio) @@ -105,12 +109,14 @@ #:use-module (gnu packages readline) #:use-module (gnu packages qt) #:use-module (gnu packages sdl) + #:use-module (gnu packages speech) #:use-module (gnu packages sphinx) #:use-module (gnu packages stb) #:use-module (gnu packages texinfo) #:use-module (gnu packages textutils) #:use-module (gnu packages tls) #:use-module (gnu packages video) + #:use-module (gnu packages vulkan) #:use-module (gnu packages web) #:use-module (gnu packages wxwidgets) #:use-module (gnu packages xdisorg) @@ -1812,7 +1818,7 @@ games.") (home-page "https://openmw.org") (license license:gpl3))) -(define-public godot +(define-public godot-lts (package (name "godot") (version "3.4.2") @@ -1982,6 +1988,253 @@ provide high-quality 3D rendering, it contains an animation editor, and can be scripted in a Python-like language.") (license license:expat))) +(define-public godot + (package + (name "godot") + (version "4.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/godotengine/godot") + (commit (string-append version "-stable")))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0rc34w4nb1qwmxk7ijcm689kk4gdxrmgzbj4qqz8gkqhysn8mnmz")) + (modules '((guix build utils) + (ice-9 ftw) + (srfi srfi-1))) + (snippet + '(begin + ;; Keep only those bundled files we have not (yet) replaced + ;; with Guix versions. Note that some of these may be + ;; modified; see "thirdparty/README.md". + (with-directory-excursion "thirdparty" + (let* ((preserved-files + '("README.md" + "amd-fsr" + "assimp" + "astcenc" + "basis_universal" + ;; TODO: Can unbundle once + ;; + ;; is merged + "brotli" + ;; Godot needs ca-certificates.crt, but that is + ;; not available in build environment + "certs" + "cvtt" + "linuxbsd_headers" + "etc2comp" + "etcpak" + "fonts" + "glad" + "jpeg-compressor" + "libsimplewebm" + "meshoptimizer" + "minimp3" + "miniupnpc" + "minizip" + "misc" + "msdfgen" + "nanosvg" + "noise" + "oidn" + "openxr" + "pvrtccompressor" + "recastnavigation" + "rvo2" + "spirv-reflect" + "squish" + "stb_rect_pack" + "thorvg" + "tinyexr" + "vhacd" + "volk" + "vulkan" + "xatlas"))) + (for-each delete-file-recursively + (lset-difference string=? + (scandir ".") + (cons* "." ".." preserved-files))))))))) + (build-system scons-build-system) + (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_embree=no" + "builtin_enet=no" + "builtin_freetype=no" + "builtin_glslang=no" + "builtin_graphite=no" + "builtin_harfbuzz=no" + "builtin_icu4c=no" + "builtin_libogg=no" + "builtin_libpng=no" + "builtin_libtheora=no" + "builtin_libvorbis=no" + "builtin_libwebp=no" + "builtin_mbedtls=no" + "builtin_pcre2=no" + "builtin_pcre2_with_jit=no" + "builtin_wslay=no" + "builtin_zlib=no" + "builtin_zstd=no") + #:tests? #f ; There are no tests + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'scons-use-env + (lambda _ + ;; Scons does not use the environment variables by default, + ;; but this substitution makes it do so. + (substitute* "SConstruct" + (("env_base = Environment\\(tools=custom_tools\\)") + (string-append + "env_base = Environment(tools=custom_tools)\n" + "env_base = Environment(ENV=os.environ)"))))) + (add-after 'scons-use-env 'fix-dlopen-paths + (lambda* (#:key inputs #:allow-other-keys) + (let ((files '("drivers/alsa/asound-so_wrap.c" + "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/x11/display_server_x11.cpp" + "platform/linuxbsd/x11/dynwrappers/xcursor-so_wrap.c" + "platform/linuxbsd/x11/dynwrappers/xext-so_wrap.c" + "platform/linuxbsd/x11/dynwrappers/xinerama-so_wrap.c" + "platform/linuxbsd/x11/dynwrappers/xinput2-so_wrap.c" + "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")) + (libs '("libasound.so.2" + "libpulse.so.0" + "libdbus-1.so.3" + "libfontconfig.so.1" + "libudev.so.1" + "libspeechd.so.2" + "libXrandr.so.2" + "libXcursor.so.1" + "libXext.so.6" + "libXinerama.so.1" + "libXi.so.6" + "libX11.so.6" + "libXrandr.so.2" + "libXrender.so.1" + "libxkbcommon.so.0" + "libvulkan.so.1" + "libvulkan.so"))) + (for-each (lambda (file lib) + (substitute* file + (((string-append "dlopen\\(\"" lib "\"")) + (string-append "dlopen(\"" + (search-input-file + inputs (string-append "lib/" lib)) + "\"")))) + files libs)) + (substitute* "thirdparty/glad/gl.c" + (("libGL.so") ; for both .so and .so.1 + (string-append (search-input-file inputs "lib/libGL.so")))) + (substitute* "thirdparty/glad/glx.c" + (("libGL.so") ; for both .so and .so.1 + (string-append (search-input-file inputs "lib/libGL.so")))))) + (add-after 'fix-dlopen-paths 'unbundle-xkbcommon + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "platform/linuxbsd/xkbcommon-so_wrap.c" + (("./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon.h") + (string-append + (search-input-file inputs "include/xkbcommon/xkbcommon.h"))) + (("./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-compose.h") + (string-append + (search-input-file inputs "include/xkbcommon/xkbcommon-compose.h"))) + (("./thirdparty/linuxbsd_headers/xkbcommon/xkbcommon-keysyms.h") + (string-append + (search-input-file inputs "include/xkbcommon/xkbcommon-keysyms.h")))))) + (replace 'install + (lambda* (#:key inputs #:allow-other-keys) + (let ((zenity (search-input-file inputs "bin/zenity"))) + ;; Strip build info from filenames. + (with-directory-excursion "bin" + (for-each + (lambda (file) + (let ((dest (car (string-split (basename file) #\.)))) + (rename-file file dest))) + (find-files "." "godot.*\\.linuxbsd\\.editor.*")) + (install-file "godot" (string-append #$output "/bin"))) + ;; Tell the editor where to find zenity for OS.alert(). + ;; TODO: This could be changed in + ;; platform/linuxbsd/os_linuxbsd.cpp directly, along with the + ;; other alert programs. + (wrap-program (string-append #$output "/bin/godot") + `("PATH" ":" prefix (,(string-append zenity "/bin"))))))) + (add-after 'install 'install-godot-desktop + (lambda _ + (let ((applications (string-append #$output "/share/applications")) + (icons (string-append #$output "/share/icons/hicolor"))) + (mkdir-p applications) + (copy-file "misc/dist/linux/org.godotengine.Godot.desktop" + (string-append applications "/godot.desktop")) + (for-each (lambda (icon dest) + (mkdir-p (dirname dest)) + (copy-file icon dest)) + '("icon.png" "icon.svg") + `(,(string-append icons "/256x256/apps/godot.png") + ,(string-append icons "/scalable/apps/godot.svg"))))))))) + (native-inputs + (list pkg-config)) + (inputs + (list alsa-lib + dbus + embree + enet + eudev + fontconfig + freetype-with-brotli + glew + glslang + glu + libpng + harfbuzz + icu4c + libtheora + libvorbis + libvpx + libwebp + libx11 + libxcursor + libxi + libxinerama + libxkbcommon + libxrandr + mbedtls-apache + mesa + openxr + opusfile + pcre2 + pulseaudio + speech-dispatcher + vulkan-loader + wslay + zenity + zlib + `(,zstd "lib"))) + (home-page "https://godotengine.org/") + (synopsis "Advanced 2D and 3D game engine") + (description + "Godot is an advanced multi-platform game engine written in C++. If +features design tools such as a visual editor, can import 3D models and +provide high-quality 3D rendering, it contains an animation editor, and can be +scripted in a Python-like language.") + (license license:expat))) + (define-public entt (package (name "entt") -- cgit v1.2.3