gnu: sdl2: Update to 2.0.12.
[jackhill/guix/guix.git] / gnu / packages / sdl.scm
index 3fa0e02..7b36d55 100644 (file)
@@ -4,9 +4,15 @@
 ;;; 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 Rutger Helling <rhelling@mykolab.com>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
+;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2020 Timotej Lazar <timotej.lazar@araneo.si>
+;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module ((guix licenses) #:hide (freetype))
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system haskell)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages audio)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages fcitx)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
-  #:use-module (gnu packages haskell)
   #:use-module (gnu packages ibus)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages mono)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pulseaudio)
                            ;; finding the libGL from mesa at runtime.
                            "LDFLAGS=-lGL")
 
+       #:make-flags '("V=1")            ;build verbosely
+
        #:tests? #f)) ; no check target
     (propagated-inputs
      ;; SDL headers include X11 headers.
      `(("libx11" ,libx11)
-       ("libcap" ,libcap))) ; 'libSDL.la' contain `-lcap'.
+       ("libcap" ,libcap) ; 'libSDL.la' contain `-lcap'.
+       ;; TODO: Since building Mesa with Meson it is now necessary that Mesa is
+       ;; a propogated input. We still need to figure out why, possibly due to a
+       ;; change in pkg-config.
+       ("mesa" ,mesa)))
     (native-inputs `(("pkg-config" ,pkg-config)))
     (inputs `(("libxrandr" ,libxrandr)
-              ("mesa" ,mesa)
               ("glu" ,glu)
               ("alsa-lib" ,alsa-lib)
               ("pulseaudio" ,pulseaudio)))
@@ -102,7 +115,7 @@ joystick, and graphics hardware.")
 (define-public sdl2
   (package (inherit sdl)
     (name "sdl2")
-    (version "2.0.8")
+    (version "2.0.12")
     (source (origin
              (method url-fetch)
              (uri
@@ -110,22 +123,39 @@ joystick, and graphics hardware.")
                              version ".tar.gz"))
              (sha256
               (base32
-               "1v4js1gkr75hzbxzhwzzif0sf9g07234sd23x1vdaqc661bprizd"))))
+               "0qy8wbqvfkb5ps8kxgaaf2zzpkjqbsw712hlp74znbn0jpv6i4il"))))
     (arguments
      (substitute-keyword-arguments (package-arguments sdl)
        ((#:configure-flags flags)
-        `(append '("--disable-wayland-shared")
-                 ,flags))))
+        `(append '("--disable-wayland-shared" "--enable-video-kmsdrm"
+                   "--disable-kmsdrm-shared")
+                 ,flags))
+       ((#:make-flags flags ''())
+        `(cons*
+          ;; Add the Fcitx header files to GCCs "system header" search path
+          ;; in order to suppress compiler warnings induced by those:
+          ;;   .../include/fcitx-utils/utarray.h:178:9: error: ISO C90 forbids
+          ;;   mixed declarations and code [-Werror=declaration-after-statement]
+          (string-append "C_INCLUDE_PATH="
+                         (assoc-ref %build-inputs "fcitx") "/include")
+          ;; SDL dlopens libudev, so make sure it is in rpath. This overrides
+          ;; the LDFLAG set in sdl’s configure-flags, which isn’t necessary
+          ;; as sdl2 includes Mesa by default.
+          (string-append "LDFLAGS=-Wl,-rpath,"
+                         (assoc-ref %build-inputs "eudev") "/lib")
+          ,flags))))
     (inputs
      ;; SDL2 needs to be built with ibus support otherwise some systems
      ;; experience a bug where input events are doubled.
      ;;
      ;; For more information, see: https://dev.solus-project.com/T1721
      (append `(("dbus" ,dbus)
+               ("eudev" ,eudev) ; for discovering input devices
                ("fcitx" ,fcitx) ; helps with CJK input
                ("glib" ,glib)
                ("ibus" ,ibus)
                ("libxkbcommon" ,libxkbcommon)
+               ("libxcursor" ,libxcursor) ; enables X11 cursor support
                ("wayland" ,wayland)
                ("wayland-protocols" ,wayland-protocols))
              (package-inputs sdl)))
@@ -240,28 +270,44 @@ WEBP, XCF, XPM, and XV.")
                 "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
-    (arguments `(#:tests? #f
-                 #:configure-flags '("--enable-music-mp3-mad-gpl"
-                                     "--disable-music-mod-shared"
-                                     "--disable-music-fluidsynth-shared"
-                                     "--disable-music-ogg-shared"
-                                     "--disable-music-flac-shared"
-                                     "--disable-music-mp3-shared")))
-    (inputs `(("libvorbis" ,libvorbis)
-              ("libflac" ,flac)
-              ("libmad" ,libmad)
-              ("libmikmod" ,libmikmod)
-              ("libmodplug" ,libmodplug)))
-    ;; FIXME: Add libfluidsynth
+    (arguments
+     `(#:tests? #f ; No check target.
+       #:configure-flags
+       '("--enable-music-mp3-mad-gpl" ; Use libmad instead of smpeg.
+         ;; Explicitly link against shared libraries instead of dlopening them.
+         "--disable-music-flac-shared"
+         "--disable-music-fluidsynth-shared"
+         "--disable-music-mod-shared"
+         "--disable-music-ogg-shared")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-fluidsynth
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "configure"
+              (("EXTRA_LDFLAGS -lfluidsynth")
+               (string-append "EXTRA_LDFLAGS "
+                              "-L"
+                              (assoc-ref inputs "fluidsynth")
+                              "/lib -lfluidsynth")))
+             #t)))))
+    (inputs
+     `(("fluidsynth" ,fluidsynth)
+       ("libflac" ,flac)
+       ("libmad" ,libmad)
+       ("libmikmod" ,libmikmod)
+       ("libvorbis" ,libvorbis)))
     (propagated-inputs `(("sdl" ,sdl)))
     (synopsis "SDL multi-channel audio mixer library")
     (description "SDL_mixer is a multi-channel audio mixer library for SDL.
 It supports any number of simultaneously playing channels of 16 bit stereo
-audio, plus a single channel of music.  Supported format include FLAC, MOD,
-MIDI, Ogg Vorbis, and MP3.")
+audio, plus a single channel of music.  Supported formats include FLAC, MOD,
+MIDI, Ogg Vorbis, and MP3.
+
+This package supports two MIDI backends, selectable at runtime.  To use the
+newer @code{fluidsynth} library, install a soundfont such as @code{fluid-3}
+and specify it using the @code{SDL_SOUNDFONTS} environment variable.  For the
+legacy @code{timidity} backend, install a patch set such as @code{freepats}
+and set the path to the configuration file with @code{TIMIDITY_CFG}.")
     (home-page "https://www.libsdl.org/projects/SDL_mixer/")
     (license zlib)))
 
@@ -287,6 +333,54 @@ SDL.")
     (home-page "https://www.libsdl.org/projects/SDL_net/")
     (license zlib)))
 
+(define-public sdl-pango
+  (package
+    (name "sdl-pango")
+    (version "0.1.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "mirror://sourceforge/sdlpango/SDL_Pango/" version "/"
+             "SDL_Pango-" version  ".tar.gz"))
+       (sha256
+        (base32 "197baw1dsg0p4pljs5k0fshbyki00r4l49m1drlpqw6ggawx6xbz"))
+       (patches
+        (search-patches
+         "sdl-pango-api_additions.patch"
+         "sdl-pango-blit_overflow.patch"
+         "sdl-pango-fillrect_crash.patch"
+         "sdl-pango-fix-explicit-SDLPango_CopyFTBitmapTo.patch"
+         "sdl-pango-matrix_declarations.patch"
+         "sdl-pango-sans-serif.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags (list "--disable-static")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'autogen
+           ;; Force reconfiguration because the included libtool
+           ;; generates linking errors.
+           (lambda _ (invoke "autoreconf" "-vif"))))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("glib" ,glib)
+       ("harfbuzz" ,harfbuzz)
+       ("pango" ,pango)
+       ("sdl" ,sdl)))
+    (home-page "http://sdlpango.sourceforge.net")
+    (synopsis "Pango SDL binding")
+    (description "This library is a wrapper around the Pango library.
+It allows you to use TrueType fonts to render internationalized and
+tagged text in SDL applications.")
+    (license lgpl2.1)))
+
 (define-public sdl-ttf
   (package
     (name "sdl-ttf")
@@ -348,45 +442,93 @@ directory.")
          (other other))
        (package-propagated-inputs package)))
 
-(define-public sdl2-image
-  (package (inherit sdl-image)
-    (name "sdl2-image")
-    (version "2.0.3")
+(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
-                "0s13dmakn21q6yw8avl67d4zkxzl1wap6l5nwf6cvzrmlxfw441m"))))
+                "0qk2ax7f7grlxb13ba0ll3zlm8780s7j8fmrhlpxzjgdvldf1q33"))))
+    (propagated-inputs
+     (propagated-inputs-with-sdl2 sdl-gfx))))
+
+(define-public sdl2-image
+  (package (inherit sdl-image)
+    (name "sdl2-image")
+    (version "2.0.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://www.libsdl.org/projects/SDL_image/release/"
+                       "SDL2_image-" version ".tar.gz"))
+       (sha256
+        (base32 "1l0864kas9cwpp2d32yxl81g98lx40dhbdp03dz7sbv84vhgdmdx"))))
     (propagated-inputs
      (propagated-inputs-with-sdl2 sdl-image))))
 
 (define-public sdl2-mixer
   (package (inherit sdl-mixer)
     (name "sdl2-mixer")
-    (version "2.0.2")
-    (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
-                "1fw3kkqi5346ai5if4pxrcbhs5c4vv3a4smgz6fl6kyaxwkmwqaf"))))
+    (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"))))
+    (arguments
+      (substitute-keyword-arguments (package-arguments sdl-mixer)
+         ((#:configure-flags flags)
+          `(cons*
+            "--disable-music-opus-shared"
+            ;; These options were renamed in SDL2 mixer. Keeping the inherited
+            ;; variants produces a harmless warning.
+            "--disable-music-mod-modplug-shared"
+            "--disable-music-midi-fluidsynth-shared"
+            ,flags))))
+    (inputs
+     `(("opusfile" ,opusfile)
+       ;; The default MOD library changed in SDL2 mixer.
+       ("libmodplug" ,libmodplug)
+       ,@(alist-delete "libmikmod" (package-inputs sdl-mixer))))
+    (native-inputs
+     `(("pkgconfig" ,pkg-config))) ; Needed to find the opus library.
     (propagated-inputs
      (propagated-inputs-with-sdl2 sdl-mixer))))
 
+(define-public sdl2-net
+  (package (inherit sdl-net)
+    (name "sdl2-net")
+    (version "2.0.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://www.libsdl.org/projects/SDL_net/release/"
+                       "SDL2_net-" version ".tar.gz"))
+       (sha256
+        (base32
+         "08cxc1bicmyk89kiks7izw1rlx5ng5n6xpy8fy0zxni3b9z8mkhm"))))
+    (propagated-inputs
+     (propagated-inputs-with-sdl2 sdl-net))))
+
 (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
@@ -399,7 +541,7 @@ directory.")
                         #t))
              (sha256
               (base32
-               "0xljwcpvd2knrjdfag5b257xqayplz55mqlszrqp0kpnphh5xnrl"))))
+               "0cyd48dipc0m399qy8s03lci8b0bpiy8xlkvrm2ia7wcv0dfpv59"))))
     (propagated-inputs
      (propagated-inputs-with-sdl2 sdl-ttf))))
 
@@ -486,15 +628,14 @@ sound and device input (keyboards, joysticks, mice, etc.).")
 (define-public guile-sdl2
   (package
     (name "guile-sdl2")
-    (version "0.3.1")
+    (version "0.4.0")
     (source (origin
               (method url-fetch)
-              (uri (string-append
-                    "https://files.dthompson.us/guile-sdl2/guile-sdl2-"
-                    version ".tar.gz"))
+              (uri (string-append "https://files.dthompson.us/guile-sdl2/"
+                                  "guile-sdl2-" version ".tar.gz"))
               (sha256
                (base32
-                "0bw7x2lx90k4banc5k7yfkn3as93y25gr1xdr225ll7lmij21k64"))))
+                "0zcxwgyadwpbhq6h5mv2569c3kalgra26zc186y9fqiyyzmh1v9s"))))
     (build-system gnu-build-system)
     (arguments
      '(#:make-flags '("GUILE_AUTO_COMPILE=0")
@@ -523,92 +664,53 @@ The bindings are written in pure Scheme using Guile's foreign function
 interface.")
     (license lgpl3+)))
 
-(define-public ghc-sdl2
+(define-public guile3.0-sdl2
   (package
-    (name "ghc-sdl2")
-    (version "2.4.1.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://hackage.haskell.org/package/"
-                           "sdl2/sdl2-" version ".tar.gz"))
-       (sha256
-        (base32
-         "0p4b12fmxps0sbnkqdfy0qw19s355yrkw7fgw6xz53wzq706k991"))))
-    (build-system haskell-build-system)
-    (arguments '(#:tests? #f)) ; tests require graphical environment
-    (inputs
-     `(("ghc-exceptions" ,ghc-exceptions)
-       ("ghc-linear" ,ghc-linear)
-       ("ghc-statevar" ,ghc-statevar)
-       ("ghc-text" ,ghc-text)
-       ("ghc-vector" ,ghc-vector)
-       ("sdl2" ,sdl2)))
+    (inherit guile-sdl2)
+    (name "guile3.0-sdl2")
     (native-inputs
-     `(("ghc-weigh" ,ghc-weigh)
-       ("pkg-config" ,pkg-config)))
-    (home-page "http://hackage.haskell.org/package/sdl2")
-    (synopsis "High- and low-level bindings to the SDL library")
-    (description
-     "This package contains bindings to the SDL 2 library, in both high- and
-low-level forms.  The @code{SDL} namespace contains high-level bindings, where
-enumerations are split into sum types, and we perform automatic
-error-checking.  The @code{SDL.Raw} namespace contains an almost 1-1
-translation of the C API into Haskell FFI calls.  As such, this does not
-contain sum types nor error checking.  Thus this namespace is suitable for
-building your own abstraction over SDL, but is not recommended for day-to-day
-programming.")
-    (license bsd-3)))
-
-(define-public ghc-sdl2-mixer
-  (package
-    (name "ghc-sdl2-mixer")
-    (version "1.1.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://hackage.haskell.org/package/sdl2-mixer/"
-                           "sdl2-mixer-" version ".tar.gz"))
-       (sha256
-        (base32
-         "1k8avyccq5l9z7bwxigim312yaancxl1sr3q6a96bcm7pnhiak0g"))))
-    (build-system haskell-build-system)
-    (inputs
-     `(("ghc-data-default-class" ,ghc-data-default-class)
-       ("ghc-lifted-base" ,ghc-lifted-base)
-       ("ghc-monad-control" ,ghc-monad-control)
-       ("ghc-sdl2" ,ghc-sdl2)
-       ("ghc-vector" ,ghc-vector)
-       ("sdl2-mixer" ,sdl2-mixer)))
-    (native-inputs
-     `(("pkg-config" ,pkg-config)))
-    (home-page "http://hackage.haskell.org/package/sdl2-mixer")
-    (synopsis "Bindings to SDL2 mixer")
-    (description "This package provides Haskell bindings to
-@code{SDL2_mixer}.")
-    (license bsd-3)))
+     `(("guile" ,guile-3.0)
+       ("pkg-config" ,pkg-config)))))
 
-(define-public ghc-sdl2-image
-  (package
-    (name "ghc-sdl2-image")
-    (version "2.0.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "https://hackage.haskell.org/package/sdl2-image/"
-                           "sdl2-image-" version ".tar.gz"))
-       (sha256
-        (base32
-         "1pr6dkg73cy9z0w54lrkj9c5bhxj56nl92lxikjy8kz6nyr455rr"))))
-    (build-system haskell-build-system)
-    (inputs
-     `(("ghc-sdl2" ,ghc-sdl2)
-       ("ghc-text" ,ghc-text)
-       ("sdl2-image" ,sdl2-image)))
-    (native-inputs
-     `(("pkg-config" ,pkg-config)))
-    (home-page "http://hackage.haskell.org/package/sdl2-image")
-    (synopsis "Bindings to SDL2_image")
-    (description "This package provides Haskell bindings to
-@code{SDL2_image}.")
-    (license expat)))
+(define-public sdl2-cs
+  (let ((commit "1a3556441e1394eb0b5d46aeb514b8d1090b93f8"))
+    (package
+      (name "sdl2-cs")
+      (version (git-version "B1" "1" commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/flibitijibibo/SDL2-CS")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "007mzkqr9nmvfrvvhs2r6cm36lzgsww24kwshsz9c4fd97f9qk58"))))
+      (build-system gnu-build-system)
+      (arguments
+       '(#:tests? #f  ; No tests.
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (replace 'build
+             (lambda _
+               (invoke "make" "release")))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (install-file "bin/Release/SDL2-CS.dll" (string-append out "/lib"))
+                 #t))))))
+      (native-inputs
+       `(("mono" ,mono)))
+      (inputs
+       `(("sdl2" ,sdl2)
+         ("sdl2-image" ,sdl2-image)
+         ("sdl2-mixer" ,sdl2-mixer)
+         ("sdl2-ttf" ,sdl2-ttf)))
+      (home-page "https://dthompson.us/projects/guile-sdl2.html")
+      (synopsis "C# wrapper for SDL2")
+      (description
+       "SDL2-CS provides C# bindings for the SDL2 C shared library.
+The C# wrapper was written to be used for FNA's platform support.  However, this
+is written in a way that can be used for any general C# application.")
+      (license zlib))))