summary refs log tree commit diff
path: root/gnu/packages/game-development.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/game-development.scm')
-rw-r--r--gnu/packages/game-development.scm268
1 files changed, 261 insertions, 7 deletions
diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index eebe8ecbf4..af467dbb38 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -28,6 +28,7 @@
 ;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com>
 ;;; Copyright © 2022 dan <i@dan.games>
+;;; Copyright © 2023 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -86,6 +87,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 +97,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 +108,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)
@@ -1708,7 +1713,7 @@ robust and compatible with many systems and operating systems.")
 (define-public mygui
   (package
     (name "mygui")
-    (version "3.4.1")
+    (version "3.4.2")
     (source
      (origin
        (method git-fetch)
@@ -1717,8 +1722,7 @@ robust and compatible with many systems and operating systems.")
              (commit (string-append "MyGUI" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32
-         "1gyd4bzm6qqpqw6is065qs5c729gl6rp989bnkygha6q4s371vz6"))))
+        (base32 "0gkfahz118gpqa2906cjb3d4w8g13rv8v3ma7s0ml9l5cci785f8"))))
     (build-system cmake-build-system)
     (arguments
      '(#:tests? #f                      ; No test target
@@ -1765,7 +1769,10 @@ of use.")
     (inputs
      (modify-inputs (package-inputs mygui)
        (delete "ogre")
-       (prepend mesa glu)))
+       (prepend glu
+                libglvnd                ; for find_package(… GLX)
+                mesa                    ; for find_package(… OpenGL …)
+                (sdl-union (list sdl2 sdl2-image)))))
     (synopsis "Fast, flexible and simple GUI (OpenGL backend)")))
 
 (define-public openmw
@@ -1812,7 +1819,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 +1989,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
+                              ;; <https://github.com/godotengine/godot/pull/79101>
+                              ;; 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")
@@ -2411,14 +2665,14 @@ a.k.a. XenoCollide) as described in Game Programming Gems 7.")
 (define-public ode
   (package
     (name "ode")
-    (version "0.16.3")
+    (version "0.16.4")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://bitbucket.org/odedevs/ode/downloads/"
                            "ode-" version ".tar.gz"))
        (sha256
-        (base32 "04y40czkh71m1p2r8ddfn5bajvlh7yyfa928jvi8qipwkgsdnhf7"))
+        (base32 "0rrl4pn4h3g0ay0i3n61pr6bwyk9vgar17vjal56pj66h617n0vi"))
        (modules '((guix build utils)))
        (snippet
         '(begin