Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / game-development.scm
index 24c75b1..f7e0bcf 100644 (file)
 ;;; Copyright © 2017, 2019 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
-;;; Copyright © 2019 Leo Prikler <leo.prikler@student.tugraz.at>
+;;; Copyright © 2019, 2020 Leo Prikler <leo.prikler@student.tugraz.at>
 ;;; Copyright © 2019 Jethro Cao <jethrocao@gmail.com>
 ;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -77,6 +78,7 @@
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
@@ -88,6 +90,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
+  #:use-module (gnu packages web)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
@@ -527,7 +530,7 @@ clone.")
        ("xcb-util-image" ,xcb-util-image)
        ("libxrandr" ,libxrandr)
        ("eudev" ,eudev)
-       ("libjpeg" ,libjpeg)
+       ("libjpeg" ,libjpeg-turbo)
        ("libsndfile" ,libsndfile)
        ("stb-image" ,stb-image)
        ("stb-image-write" ,stb-image-write)))
@@ -723,7 +726,7 @@ package is the Nuklear bindings for LÖVE created by Kevin Harrison.")
 multimedia programming.  It handles common, low-level tasks such as creating
 windows, accepting user input, loading data, drawing images, playing sounds,
 etc.")
-    (home-page "http://liballeg.org")
+    (home-page "https://liballeg.org")
     (license license:giftware)))
 
 (define-public allegro
@@ -746,7 +749,7 @@ etc.")
        ("freetype" ,freetype)
        ("glu" ,glu)
        ("gtk" ,gtk+-2)
-       ("libjpeg" ,libjpeg)
+       ("libjpeg" ,libjpeg-turbo)
        ("libpng" ,libpng)
        ("libtheora" ,libtheora)
        ("libvorbis" ,libvorbis)
@@ -764,7 +767,7 @@ etc.")
 multimedia programming.  It handles common, low-level tasks such as creating
 windows, accepting user input, loading data, drawing images, playing sounds,
 etc.")
-    (home-page "http://liballeg.org")
+    (home-page "https://liballeg.org")
     (license license:bsd-3)))
 
 (define-public allegro-5.0
@@ -828,7 +831,7 @@ etc.")
        ("curl" ,curl)
        ("freetype" ,freetype)
        ("giflib" ,giflib)
-       ("libjpeg" ,libjpeg)
+       ("libjpeg" ,libjpeg-turbo)
        ("libpng" ,libpng)
        ("libwebp" ,libwebp)
        ("libx11" ,libx11)
@@ -980,7 +983,7 @@ interface (API).")
        ("sdl-mixer" ,sdl-mixer)
        ("sdl-ttf" ,sdl-ttf)
        ("sdl-gfx" ,sdl-gfx)
-       ("libjpeg" ,libjpeg)
+       ("libjpeg" ,libjpeg-turbo)
        ("libpng" ,libpng)
        ("libX11" ,libx11)
        ("libsmpeg" ,libsmpeg)
@@ -1086,39 +1089,31 @@ developed mainly for Ren'py.")
              (setenv "RENPY_DEPS_INSTALL" (string-join (map cdr inputs) ":"))
              #t))
          (replace 'build
-           (lambda args
-             (apply
-              (lambda* (build-root #:key inputs outputs #:allow-other-keys)
-                ;; The "module" subdirectory contains a python (really cython)
-                ;; project, which is built using a script, that is thankfully
-                ;; named "setup.py".
-                (chdir "module")
-                (apply (assoc-ref %standard-phases 'build) args)
-                ;; the above causes renpy.__init__ to be compiled but does not
-                ;; compile anything else, hence we do that here
-                (chdir build-root)
-                (delete-file "renpy/__init__.pyc")
-                (invoke "python" "-m" "compileall" "renpy"))
-              (getcwd) args)
+           (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
+             ;; The "module" subdirectory contains a python (really cython)
+             ;; project, which is built using a script, that is thankfully
+             ;; named "setup.py".
+             (with-directory-excursion "module"
+               (apply (assoc-ref %standard-phases 'build) args))
+             ;; the above causes renpy.__init__ to be compiled but does not
+             ;; compile anything else, hence we do that here
+             (delete-file "renpy/__init__.pyc")
+             (invoke "python" "-m" "compileall" "renpy")
              #t))
          (replace 'install
-           (lambda args
-             (apply
-              (lambda* (build-root #:key inputs outputs #:allow-other-keys)
-                ;; Again, we have to wrap the module installation.
-                ;; Additionally, we want to install the python code
-                ;; (both source and compiled) in the same directory.
-                (let* ((out (assoc-ref outputs "out"))
-                       (site (string-append "/lib/python"
-                                            ,(version-major+minor
-                                              (package-version python-2))
-                                            "/site-packages")))
-                  (chdir "module")
-                  (apply (assoc-ref %standard-phases 'install) args)
-                  (chdir build-root)
-                  (copy-recursively "renpy"
-                                    (string-append out site "/renpy"))))
-              (getcwd) args)
+           (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
+             ;; Again, we have to wrap the module installation.
+             ;; Additionally, we want to install the python code
+             ;; (both source and compiled) in the same directory.
+             (let* ((out (assoc-ref outputs "out"))
+                    (site (string-append "/lib/python"
+                                         ,(version-major+minor
+                                           (package-version python-2))
+                                         "/site-packages")))
+               (with-directory-excursion "module"
+                 (apply (assoc-ref %standard-phases 'install) args))
+               (copy-recursively "renpy"
+                                 (string-append out site "/renpy")))
              #t)))))
     (inputs
      `(("ffmpeg" ,ffmpeg)
@@ -1511,7 +1506,7 @@ games.")
 (define-public godot
   (package
     (name "godot")
-    (version "3.0.6")
+    (version "3.2")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -1520,25 +1515,42 @@ games.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0g64h0x8dlv6aa9ggfcidk2mknkfl5li7z1phcav8aqp9srj8avf"))
-              (modules '((guix build utils)))
+                "0f15izjl4i2xlz1xj5pcslzl9gm3rmr3c21gh256ynpi2zhhkcdd"))
+              (modules '((guix build utils)
+                         (ice-9 ftw)
+                         (srfi srfi-1)))
               (snippet
                '(begin
-                  ;; Drop libraries that we take from Guix.  Note that some
-                  ;; of these may be modified; see "thirdparty/README.md".
+                  ;; 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"
-                    (for-each delete-file-recursively
-                              '("freetype"
-                                "libogg"
-                                "libpng"
-                                "libtheora"
-                                "libvorbis"
-                                "libvpx"
-                                "libwebp"
-                                "openssl"
-                                "opus"
-                                "zlib"))
-                    #t)))))
+                    (let* ((preserved-files
+                            '("README.md"
+                              "assimp"
+                              "certs"
+                              "cvtt"
+                              "enet"
+                              "etc2comp"
+                              "fonts"
+                              "glad"
+                              "jpeg-compressor"
+                              "libsimplewebm"
+                              "miniupnpc"
+                              "minizip"
+                              "misc"
+                              "nanosvg"
+                              "pvrtccompressor"
+                              "recastnavigation"
+                              "squish"
+                              "tinyexr"
+                              "vhacd"
+                              "xatlas")))
+                      (for-each delete-file-recursively
+                                (lset-difference string=?
+                                                 (scandir ".")
+                                                 (cons* "." ".." preserved-files)))))
+                  #t))))
     (build-system scons-build-system)
     (arguments
      `(#:scons ,scons-python2
@@ -1549,6 +1561,7 @@ games.")
                                '())
                            ;; Avoid using many of the bundled libs.
                            ;; Note: These options can be found in the SConstruct file.
+                           "builtin_bullet=no"
                            "builtin_freetype=no"
                            "builtin_glew=no"
                            "builtin_libmpdec=no"
@@ -1558,9 +1571,12 @@ games.")
                            "builtin_libvorbis=no"
                            "builtin_libvpx=no"
                            "builtin_libwebp=no"
-                           "builtin_openssl=no"
+                           "builtin_mbedtls=no"
                            "builtin_opus=no"
-                           "builtin_zlib=no")
+                           "builtin_pcre2=no"
+                           "builtin_wslay=no"
+                           "builtin_zlib=no"
+                           "builtin_zstd=no")
        #:tests? #f ; There are no tests
        #:phases
        (modify-phases %standard-phases
@@ -1583,6 +1599,10 @@ games.")
                      (rename-file "godot.x11.tools.64" "godot")
                      (rename-file "godot.x11.tools.32" "godot"))
                  (install-file "godot" bin))
+               ;; Tell Godot where to find zenity for OS.alert().
+               (wrap-program (string-append bin "/godot")
+                 `("PATH" ":" prefix
+                   (,(string-append (assoc-ref %build-inputs "zenity") "/bin"))))
                #t)))
          (add-after 'install 'install-godot-desktop
            (lambda* (#:key outputs #:allow-other-keys)
@@ -1607,6 +1627,7 @@ games.")
                #t))))))
     (native-inputs `(("pkg-config" ,pkg-config)))
     (inputs `(("alsa-lib" ,alsa-lib)
+              ("bullet" ,bullet)
               ("freetype" ,freetype)
               ("glew" ,glew)
               ("glu" ,glu)
@@ -1619,10 +1640,14 @@ games.")
               ("libxi" ,libxi)
               ("libxinerama" ,libxinerama)
               ("libxrandr" ,libxrandr)
+              ("mbedtls" ,mbedtls-apache)
               ("mesa" ,mesa)
-              ("openssl" ,openssl)
               ("opusfile" ,opusfile)
-              ("pulseaudio" ,pulseaudio)))
+              ("pcre2" ,pcre2)
+              ("pulseaudio" ,pulseaudio)
+              ("wslay" ,wslay)
+              ("zenity" ,zenity)
+              ("zstd" ,zstd "lib")))
     (home-page "https://godotengine.org/")
     (synopsis "Advanced 2D and 3D game engine")
     (description
@@ -1671,7 +1696,7 @@ scripted in a Python-like language.")
               ("libxft" ,libxft)
               ("libxinerama" ,libxinerama)
               ("libfontconfig" ,fontconfig)
-              ("libjpeg" ,libjpeg)
+              ("libjpeg" ,libjpeg-turbo)
               ("libpng" ,libpng)
               ("fltk" ,fltk)
               ("zlib" ,zlib)))
@@ -1843,7 +1868,7 @@ of the others")
       (build-system gnu-build-system)
       (inputs
        `(("sdl2" ,sdl2)
-         ("libjpeg" ,libjpeg)
+         ("libjpeg" ,libjpeg-turbo)
          ("openal" ,openal)
          ("curl" ,curl)
          ("opusfile" ,opusfile)
@@ -1987,3 +2012,77 @@ Gilbert–Johnson–Keerthi algorithm plus Expand Polytope Algorithm (EPA)
 and also implements algorithm Minkowski Portal Refinement (MPR,
 a.k.a. XenoCollide) as described in Game Programming Gems 7.")
     (license license:expat)))
+
+(define-public ode
+  (package
+    (name "ode")
+    (version "0.16")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://bitbucket.org/odedevs/ode/downloads/"
+                           "ode-" version ".tar.gz"))
+       (sha256
+        (base32 "09xzrarxwxcf6rdv5jsjfjh454jnn29dpcw3wh6ic50kkipvg8sb"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           (delete-file-recursively "libccd")
+           #t))))
+    (build-system cmake-build-system)
+    (arguments
+     ;; Tests fail on all systems but x86_64.
+     `(#:tests? ,(string-prefix? "x86_64-"
+                                 (or (%current-target-system)
+                                     (%current-system)))
+       #:configure-flags '("-DODE_WITH_LIBCCD_SYSTEM=ON")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'unbundle-libccd
+           (lambda _
+             (substitute* "CMakeLists.txt"
+               (("configure_file\\(libccd/.*") ""))
+             #t)))))
+    (inputs
+     `(("glu" ,glu)
+       ("libccd" ,libccd)
+       ("mesa" ,mesa)))
+    (home-page "http://www.ode.org/")
+    (synopsis "High performance library for simulating rigid body dynamics")
+    (description "ODE is a high performance library for simulating
+rigid body dynamics.  It is fully featured, stable, mature and
+platform independent with an easy to use C/C++ API.  It has advanced
+joint types and integrated collision detection with friction.  ODE is
+useful for simulating vehicles, objects in virtual reality
+environments and virtual creatures.  It is currently used in many
+computer games, 3D authoring tools and simulation tools.")
+    ;; Software is dual-licensed.
+    (license (list license:lgpl2.1+ license:expat))))
+
+(define-public chipmunk
+  (package
+    (name "chipmunk")
+    (version "7.0.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/slembcke/Chipmunk2D.git")
+             (commit (string-append "Chipmunk-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1qmkn01g06p3rnhmbyffmjns6wj5vhgf9cscigk3wzxcpwv1hyxb"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f                      ;no test
+       #:configure-flags '("-DBUILD_STATIC=OFF"
+                           "-DBUILD_DEMOS=OFF")))
+    (inputs
+     `(("freeglut" ,freeglut)
+       ("libxmu" ,libxmu)
+       ("libxrandr" ,libxrandr)))
+    (home-page "https://chipmunk-physics.net/")
+    (synopsis "Fast and lightweight 2D game physics library")
+    (description "Chipmunk is a simple, lightweight, fast and portable 2D
+rigid body physics library written in C.")
+    (license license:expat)))