gnu: Mov ghc-sdl2 & co. to haskell-apps.scm.
[jackhill/guix/guix.git] / gnu / packages / sdl.scm
index 9e2d81f..fffb062 100644 (file)
@@ -4,6 +4,10 @@
 ;;; Copyright © 2015, 2017 Sou Bunnbu <iyzsong@member.fsf.org>
 ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
+;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module ((guix licenses) #:hide (freetype))
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages fcitx)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages ibus)
@@ -42,6 +48,7 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages gl)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xorg)
   #:export (sdl-union))
@@ -83,6 +90,7 @@
               ("glu" ,glu)
               ("alsa-lib" ,alsa-lib)
               ("pulseaudio" ,pulseaudio)))
+    (outputs '("out" "debug"))
     (synopsis "Cross platform game development library")
     (description "Simple DirectMedia Layer is a cross-platform development
 library designed to provide low level access to audio, keyboard, mouse,
@@ -93,7 +101,7 @@ joystick, and graphics hardware.")
 (define-public sdl2
   (package (inherit sdl)
     (name "sdl2")
-    (version "2.0.5")
+    (version "2.0.9")
     (source (origin
              (method url-fetch)
              (uri
@@ -101,7 +109,13 @@ joystick, and graphics hardware.")
                              version ".tar.gz"))
              (sha256
               (base32
-               "11c75qj1qxmx67iwkvf9z4x69phk301pdn86zzr6jncnap7kh824"))))
+               "1c94ndagzkdfqaa838yqg589p1nnqln8mv0hpwfhrkbfczf8cl95"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments sdl)
+       ((#:configure-flags flags)
+        `(append '("--disable-wayland-shared" "--enable-video-kmsdrm"
+                   "--disable-kmsdrm-shared")
+                 ,flags))))
     (inputs
      ;; SDL2 needs to be built with ibus support otherwise some systems
      ;; experience a bug where input events are doubled.
@@ -110,21 +124,29 @@ joystick, and graphics hardware.")
      (append `(("dbus" ,dbus)
                ("fcitx" ,fcitx) ; helps with CJK input
                ("glib" ,glib)
-               ("ibus" ,ibus))
+               ("ibus" ,ibus)
+               ("libxkbcommon" ,libxkbcommon)
+               ("wayland" ,wayland)
+               ("wayland-protocols" ,wayland-protocols))
              (package-inputs sdl)))
     (license bsd-3)))
 
 (define-public libmikmod
   (package
     (name "libmikmod")
-    (version "3.3.10")
+    (version "3.3.11.1")
     (source (origin
              (method url-fetch)
-             (uri (string-append "mirror://sourceforge/mikmod/libmikmod/"
-                                 version "/libmikmod-" version ".tar.gz"))
+             (uri (list
+                   (string-append "mirror://sourceforge/mikmod/libmikmod/"
+                                  version "/libmikmod-" version ".tar.gz")
+                   ;; Older versions are sometimes moved to:
+                   (string-append "mirror://sourceforge/mikmod/"
+                                  "outdated_versions/libmikmod/"
+                                  version "/libmikmod-" version ".tar.gz")))
              (sha256
               (base32
-               "0j7g4jpa2zgzw7x6s3rldypa7zlwjvn97rwx0sylx1iihhlzbcq0"))))
+               "06bdnhb0l81srdzg6gn2v2ydhhaazza7rshrcj3q8dpqr3gn97dd"))))
     (build-system gnu-build-system)
     (arguments
      ;; By default, libmikmod tries to dlopen libasound etc., which won't work
@@ -152,6 +174,7 @@ system, such as sound redirection over the network.")
                (base32
                 "0ijljhs0v99dj6y27hc10z6qchyp8gdp4199y6jzngy6dzxlzsvw"))))
     (build-system gnu-build-system)
+    (outputs '("out" "debug"))
     (arguments
      `(,@(if (any (cute string-prefix? <> (or (%current-system)
                                               (%current-target-system)))
@@ -179,6 +202,7 @@ other supporting functions for SDL.")
               (base32
                "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b"))))
     (build-system gnu-build-system)
+    (outputs '("out" "debug"))
     (arguments
      ;; Explicitly link against shared libraries instead of dlopening them.
      '(#:configure-flags '("--disable-jpg-shared"
@@ -215,6 +239,7 @@ WEBP, XCF, XPM, and XV.")
                (base32
                 "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"))))
     (build-system gnu-build-system)
+    (outputs '("out" "debug"))
     ;; no check target
     ;; use libmad instead of smpeg
     ;; explicitly link against shared libraries instead of dlopening them
@@ -255,6 +280,7 @@ MIDI, Ogg Vorbis, and MP3.")
     (build-system gnu-build-system)
     (propagated-inputs `(("sdl" ,sdl)))
     (native-inputs `(("pkg-config" ,pkg-config)))
+    (outputs '("out" "debug"))
     (synopsis "SDL networking library")
     (description "SDL_net is a small, cross-platform networking library for
 SDL.")
@@ -278,6 +304,7 @@ SDL.")
     (inputs `(("freetype" ,freetype)
               ("mesa" ,mesa)))
     (native-inputs `(("pkg-config" ,pkg-config)))
+    (outputs '("out" "debug"))
     (synopsis "SDL TrueType font library")
     (description "SDL_ttf is a TrueType font rendering library for SDL.")
     (home-page "https://www.libsdl.org/projects/SDL_ttf/")
@@ -300,7 +327,8 @@ If PACKAGES are not specified, all SDL packages are used."
                    (match %build-inputs
                      (((names . directories) ...)
                       (union-build (assoc-ref %outputs "out")
-                                   directories))))))
+                                   directories)
+                      #t)))))
     (inputs (map (lambda (package)
                    (list (package-name package) package))
                  packages))
@@ -320,56 +348,73 @@ directory.")
          (other other))
        (package-propagated-inputs package)))
 
-(define-public sdl2-image
-  (package (inherit sdl-image)
-    (name "sdl2-image")
-    (version "2.0.1")
+(define-public sdl2-gfx
+  (package (inherit sdl-gfx)
+    (name "sdl2-gfx")
+    (version "1.0.4")
     (source (origin
               (method url-fetch)
               (uri
-               (string-append "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-"
+               (string-append "https://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-"
                               version ".tar.gz"))
               (sha256
                (base32
-                "0r3z1l7fdn76qkpy7snpkcjqz8dkv2zp6lsqpq25q4m5xsyaygis"))))
+                "0qk2ax7f7grlxb13ba0ll3zlm8780s7j8fmrhlpxzjgdvldf1q33"))))
+    (propagated-inputs
+     (propagated-inputs-with-sdl2 sdl-gfx))))
+
+(define-public sdl2-image
+  (package (inherit sdl-image)
+    (name "sdl2-image")
+    (version "2.0.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://www.libsdl.org/projects/SDL_image/release/"
+                       "SDL2_image-" version ".tar.gz"))
+       (sha256
+        (base32 "1b6f7002bm007y3zpyxb5r6ag0lml51jyvx1pwpj9sq24jfc8kp7"))))
     (propagated-inputs
      (propagated-inputs-with-sdl2 sdl-image))))
 
 (define-public sdl2-mixer
   (package (inherit sdl-mixer)
     (name "sdl2-mixer")
-    (version "2.0.1")
-    (source (origin
-              (method url-fetch)
-              (uri
-               (string-append "http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-"
-                              version ".tar.gz"))
-              (modules '((guix build utils)))
-              (snippet
-               ;; Remove bundled libraries.
-               '(delete-file-recursively "external"))
-              (sha256
-               (base32
-                "0pv9jzjpcjlbiaybvwrb4avmv46qk7iqxlnqrd2dfj82c4mgc92s"))))
+    (version "2.0.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://www.libsdl.org/projects/SDL_mixer/release/"
+                       "SDL2_mixer-" version ".tar.gz"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   ;; Remove bundled libraries.
+                   (delete-file-recursively "external")
+                   #t))
+       (sha256
+        (base32 "0694vsz5bjkcdgfdra6x9fq8vpzrl8m6q96gh58df7065hw5mkxl"))))
     (propagated-inputs
      (propagated-inputs-with-sdl2 sdl-mixer))))
 
 (define-public sdl2-ttf
   (package (inherit sdl-ttf)
     (name "sdl2-ttf")
-    (version "2.0.14")
+    (version "2.0.15")
     (source (origin
              (method url-fetch)
              (uri
               (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-"
                              version ".tar.gz"))
              (modules '((guix build utils)))
-             (snippet
-              ;; Remove bundled libraries.
-              '(delete-file-recursively "external"))
+             (snippet (begin
+                        ;; Remove bundled libraries.
+                        '(delete-file-recursively "external")
+                        #t))
              (sha256
               (base32
-               "0xljwcpvd2knrjdfag5b257xqayplz55mqlszrqp0kpnphh5xnrl"))))
+               "0cyd48dipc0m399qy8s03lci8b0bpiy8xlkvrm2ia7wcv0dfpv59"))))
     (propagated-inputs
      (propagated-inputs-with-sdl2 sdl-ttf))))
 
@@ -392,38 +437,60 @@ directory.")
        ("xorg-server" ,xorg-server)
        ("libjpeg" ,libjpeg)))
     (inputs
-     `(("guile" ,guile-2.0)
+     `(("guile" ,guile-2.2)
        ("sdl-union" ,(sdl-union))))
     (arguments
      '(#:configure-flags
        (list (string-append "--with-sdl-prefix="
                             (assoc-ref %build-inputs "sdl-union")))
+       #:modules ((ice-9 popen)
+                  (guix build utils)
+                  (guix build gnu-build-system))
+
        #:parallel-build? #f ; parallel build fails
+
        #:phases
-       (alist-cons-before
-        'configure 'fix-env-and-patch
-        (lambda* (#:key inputs #:allow-other-keys)
-          (setenv "GUILE_AUTO_COMPILE" "0")
-          ;; SDL_image needs to dlopen libjpeg in the test suite.
-          (setenv "LD_LIBRARY_PATH"
-                  (string-append (assoc-ref inputs "libjpeg") "/lib"))
-          ;; Change the site directory /site/2.0 like Guile expects.
-          (substitute* "build-aux/guile-baux/re-prefixed-site-dirs"
-            (("\"/site\"") "\"/site/2.0\""))
+       (modify-phases %standard-phases
+         (add-before 'configure 'fix-env-and-patch
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             ;; SDL_image needs to dlopen libjpeg in the test suite.
+             (setenv "LD_LIBRARY_PATH"
+                     (string-append (assoc-ref inputs "libjpeg") "/lib"))
+
+             ;; Change the site directory /site/X.Y like Guile expects.
+             (substitute* "build-aux/guile-baux/re-prefixed-site-dirs"
+               (("\"/site\"")
+                (let ((effective
+                       (read
+                        (open-pipe* OPEN_READ
+                                    "guile" "-c"
+                                    "(write (effective-version))"))))
+                  (string-append "\"/site/" effective "\""))))
 
-          ;; Skip tests that rely on sound support, which is unavailable in
-          ;; the build environment.
-          (substitute* "test/Makefile.in"
-            (("HAVE_MIXER = .*$")
-             "HAVE_MIXER = 0\n")))
-        (alist-cons-before
-         'check 'start-xorg-server
-         (lambda* (#:key inputs #:allow-other-keys)
-           ;; The test suite requires a running X server.
-           (system (format #f "~a/bin/Xvfb :1 &"
-                           (assoc-ref inputs "xorg-server")))
-           (setenv "DISPLAY" ":1"))
-         %standard-phases))))
+             ;; Skip tests that rely on sound support, which is unavailable in
+             ;; the build environment.
+             (substitute* "test/Makefile.in"
+               (("HAVE_MIXER = .*$")
+                "HAVE_MIXER = 0\n"))
+             #t))
+         (add-before 'check 'start-xorg-server
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; The test suite requires a running X server.
+             (system (format #f "~a/bin/Xvfb :1 &"
+                             (assoc-ref inputs "xorg-server")))
+             (setenv "DISPLAY" ":1")
+             #t))
+         (add-before 'check 'skip-cursor-test
+           (lambda _
+             ;; XXX: This test sometimes enters an endless loop, and sometimes
+             ;; crashes with:
+             ;;   guile: xcb_io.c:147: append_pending_request: Assertion `!xcb_xlib_unknown_seq_number' failed.
+             ;; Skip it.
+             (substitute* "test/cursor.scm"
+               (("\\(SDL:init .*" all)
+                (string-append "(exit 77)  ;" all "\n")))
+             #t)))))
     (synopsis "Guile interface for SDL (Simple DirectMedia Layer)")
     (description "Guile-SDL is a set of bindings to the Simple DirectMedia
 Layer (SDL).  With them, Guile programmers can have easy access to graphics,
@@ -434,7 +501,7 @@ sound and device input (keyboards, joysticks, mice, etc.).")
 (define-public guile-sdl2
   (package
     (name "guile-sdl2")
-    (version "0.2.0")
+    (version "0.3.1")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -442,7 +509,7 @@ sound and device input (keyboards, joysticks, mice, etc.).")
                     version ".tar.gz"))
               (sha256
                (base32
-                "0yq9lsl17cdvj77padvpk3jcw2g6g0pck9jrchc7n2767rrc012b"))))
+                "0bw7x2lx90k4banc5k7yfkn3as93y25gr1xdr225ll7lmij21k64"))))
     (build-system gnu-build-system)
     (arguments
      '(#:make-flags '("GUILE_AUTO_COMPILE=0")
@@ -456,7 +523,7 @@ sound and device input (keyboards, joysticks, mice, etc.).")
              (string-append "--with-libsdl2-mixer-prefix="
                             (assoc-ref %build-inputs "sdl2-mixer")))))
     (native-inputs
-     `(("guile" ,guile-2.0)
+     `(("guile" ,guile-2.2)
        ("pkg-config" ,pkg-config)))
     (inputs
      `(("sdl2" ,sdl2)