gnu: Fix common unquote typos.
[jackhill/guix/guix.git] / gnu / packages / sdl.scm
index cb0af1c..30d18aa 100644 (file)
@@ -1,9 +1,11 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2015, 2017 David Thompson <dthompson2@worcester.edu>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
+;;; Copyright © 2015, 2017 Sou Bunnbu <iyzsong@member.fsf.org>
 ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
+;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 
 (define-module (gnu packages sdl)
   #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
   #:use-module (gnu packages)
   #: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)
@@ -40,6 +46,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))
@@ -81,6 +88,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,
@@ -91,7 +99,7 @@ joystick, and graphics hardware.")
 (define-public sdl2
   (package (inherit sdl)
     (name "sdl2")
-    (version "2.0.5")
+    (version "2.0.8")
     (source (origin
              (method url-fetch)
              (uri
@@ -99,7 +107,12 @@ joystick, and graphics hardware.")
                              version ".tar.gz"))
              (sha256
               (base32
-               "11c75qj1qxmx67iwkvf9z4x69phk301pdn86zzr6jncnap7kh824"))))
+               "1v4js1gkr75hzbxzhwzzif0sf9g07234sd23x1vdaqc661bprizd"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments sdl)
+       ((#:configure-flags flags)
+        `(append '("--disable-wayland-shared")
+                 ,flags))))
     (inputs
      ;; SDL2 needs to be built with ibus support otherwise some systems
      ;; experience a bug where input events are doubled.
@@ -108,7 +121,10 @@ 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)))
 
@@ -118,8 +134,13 @@ joystick, and graphics hardware.")
     (version "3.3.10")
     (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"))))
@@ -140,7 +161,7 @@ system, such as sound redirection over the network.")
 (define-public sdl-gfx
   (package
     (name "sdl-gfx")
-    (version "2.0.24")
+    (version "2.0.26")
     (source (origin
               (method url-fetch)
               (uri
@@ -148,18 +169,22 @@ system, such as sound redirection over the network.")
                               version ".tar.gz"))
               (sha256
                (base32
-                "064islldm4r42lgj9fr4kbk66r7jmmakk9745hhyb1kmw71kib9h"))))
+                "0ijljhs0v99dj6y27hc10z6qchyp8gdp4199y6jzngy6dzxlzsvw"))))
     (build-system gnu-build-system)
+    (outputs '("out" "debug"))
+    (arguments
+     `(,@(if (any (cute string-prefix? <> (or (%current-system)
+                                              (%current-target-system)))
+                  '("x86_64" "i686"))
+        ;; mmx is supported only on Intel processors.
+        '()
+        '(#:configure-flags '("--disable-mmx")))))
     (propagated-inputs `(("sdl" ,sdl)))
     (synopsis "SDL graphics primitives library")
     (description "SDL_gfx provides graphics drawing primitives, rotozoom and
 other supporting functions for SDL.")
     (home-page "http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx")
-    (license zlib)
-
-    ;; The code apparently includes Intel assembly, which fails to build on
-    ;; MIPS, at least.
-    (supported-systems '("i686-linux" "x86_64-linux"))))
+    (license zlib)))
 
 (define-public sdl-image
   (package
@@ -174,6 +199,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"
@@ -210,6 +236,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
@@ -250,6 +277,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.")
@@ -273,6 +301,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/")
@@ -318,7 +347,7 @@ directory.")
 (define-public sdl2-image
   (package (inherit sdl-image)
     (name "sdl2-image")
-    (version "2.0.1")
+    (version "2.0.2")
     (source (origin
               (method url-fetch)
               (uri
@@ -326,14 +355,14 @@ directory.")
                               version ".tar.gz"))
               (sha256
                (base32
-                "0r3z1l7fdn76qkpy7snpkcjqz8dkv2zp6lsqpq25q4m5xsyaygis"))))
+                "1s3ciydixrgv34vlf45ak5syq5nlfaqf19wf162lbz4ixxd0gpvj"))))
     (propagated-inputs
      (propagated-inputs-with-sdl2 sdl-image))))
 
 (define-public sdl2-mixer
   (package (inherit sdl-mixer)
     (name "sdl2-mixer")
-    (version "2.0.1")
+    (version "2.0.2")
     (source (origin
               (method url-fetch)
               (uri
@@ -345,7 +374,7 @@ directory.")
                '(delete-file-recursively "external"))
               (sha256
                (base32
-                "0pv9jzjpcjlbiaybvwrb4avmv46qk7iqxlnqrd2dfj82c4mgc92s"))))
+                "1fw3kkqi5346ai5if4pxrcbhs5c4vv3a4smgz6fl6kyaxwkmwqaf"))))
     (propagated-inputs
      (propagated-inputs-with-sdl2 sdl-mixer))))
 
@@ -387,41 +416,103 @@ 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,
 sound and device input (keyboards, joysticks, mice, etc.).")
-    (home-page "http://gnu.org/s/guile-sdl")
+    (home-page "https://www.gnu.org/software/guile-sdl/")
     (license gpl3+)))
+
+(define-public guile-sdl2
+  (package
+    (name "guile-sdl2")
+    (version "0.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://files.dthompson.us/guile-sdl2/guile-sdl2-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "0yq9lsl17cdvj77padvpk3jcw2g6g0pck9jrchc7n2767rrc012b"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:make-flags '("GUILE_AUTO_COMPILE=0")
+       #:configure-flags
+       (list (string-append "--with-libsdl2-prefix="
+                            (assoc-ref %build-inputs "sdl2"))
+             (string-append "--with-libsdl2-image-prefix="
+                            (assoc-ref %build-inputs "sdl2-image"))
+             (string-append "--with-libsdl2-ttf-prefix="
+                            (assoc-ref %build-inputs "sdl2-ttf"))
+             (string-append "--with-libsdl2-mixer-prefix="
+                            (assoc-ref %build-inputs "sdl2-mixer")))))
+    (native-inputs
+     `(("guile" ,guile-2.0)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("sdl2" ,sdl2)
+       ("sdl2-image" ,sdl2-image)
+       ("sdl2-mixer" ,sdl2-mixer)
+       ("sdl2-ttf" ,sdl2-ttf)))
+    (synopsis "Guile bindings for SDL2")
+    (home-page "https://dthompson.us/projects/guile-sdl2.html")
+    (description
+     "Guile-SDL2 provides Guile Scheme bindings for the SDL2 C shared library.
+The bindings are written in pure Scheme using Guile's foreign function
+interface.")
+    (license lgpl3+)))