sdl.scm 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2015, 2017 David Thompson <dthompson2@worcester.edu>
  3. ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2015, 2017 Sou Bunnbu <iyzsong@member.fsf.org>
  5. ;;; Copyright © 2015 Alex Kost <alezost@gmail.com>
  6. ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
  7. ;;; Copyright © 2017, 2018 Rutger Helling <rhelling@mykolab.com>
  8. ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
  9. ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
  10. ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
  11. ;;;
  12. ;;; This file is part of GNU Guix.
  13. ;;;
  14. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  15. ;;; under the terms of the GNU General Public License as published by
  16. ;;; the Free Software Foundation; either version 3 of the License, or (at
  17. ;;; your option) any later version.
  18. ;;;
  19. ;;; GNU Guix is distributed in the hope that it will be useful, but
  20. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. ;;; GNU General Public License for more details.
  23. ;;;
  24. ;;; You should have received a copy of the GNU General Public License
  25. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  26. (define-module (gnu packages sdl)
  27. #:use-module (ice-9 match)
  28. #:use-module (srfi srfi-1)
  29. #:use-module (srfi srfi-26)
  30. #:use-module (gnu packages)
  31. #:use-module ((guix licenses) #:hide (freetype))
  32. #:use-module (guix packages)
  33. #:use-module (guix download)
  34. #:use-module (guix utils)
  35. #:use-module (guix build-system gnu)
  36. #:use-module (guix build-system haskell)
  37. #:use-module (guix build-system trivial)
  38. #:use-module (gnu packages audio)
  39. #:use-module (gnu packages fcitx)
  40. #:use-module (gnu packages fontutils)
  41. #:use-module (gnu packages freedesktop)
  42. #:use-module (gnu packages glib)
  43. #:use-module (gnu packages guile)
  44. #:use-module (gnu packages haskell)
  45. #:use-module (gnu packages ibus)
  46. #:use-module (gnu packages image)
  47. #:use-module (gnu packages linux)
  48. #:use-module (gnu packages mp3)
  49. #:use-module (gnu packages pkg-config)
  50. #:use-module (gnu packages pulseaudio)
  51. #:use-module (gnu packages gl)
  52. #:use-module (gnu packages xdisorg)
  53. #:use-module (gnu packages xiph)
  54. #:use-module (gnu packages xorg)
  55. #:export (sdl-union))
  56. (define-public sdl
  57. (package
  58. (name "sdl")
  59. (version "1.2.15")
  60. (source (origin
  61. (method url-fetch)
  62. (uri
  63. (string-append "https://libsdl.org/release/SDL-"
  64. version ".tar.gz"))
  65. (sha256
  66. (base32
  67. "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn"))
  68. (patches (search-patches "sdl-libx11-1.6.patch"))))
  69. (build-system gnu-build-system)
  70. (arguments
  71. '(;; Explicitly link against shared libraries instead of dlopening them.
  72. ;; For X11, ALSA, and PulseAudio.
  73. ;; OpenGL library is still dlopened at runtime.
  74. #:configure-flags '("--disable-alsa-shared"
  75. "--disable-pulseaudio-shared"
  76. "--disable-x11-shared"
  77. ;; Explicitly link with mesa.
  78. ;; This add mesa to libsdl's RUNPATH, to make dlopen
  79. ;; finding the libGL from mesa at runtime.
  80. "LDFLAGS=-lGL")
  81. #:tests? #f)) ; no check target
  82. (propagated-inputs
  83. ;; SDL headers include X11 headers.
  84. `(("libx11" ,libx11)
  85. ("libcap" ,libcap))) ; 'libSDL.la' contain `-lcap'.
  86. (native-inputs `(("pkg-config" ,pkg-config)))
  87. (inputs `(("libxrandr" ,libxrandr)
  88. ("mesa" ,mesa)
  89. ("glu" ,glu)
  90. ("alsa-lib" ,alsa-lib)
  91. ("pulseaudio" ,pulseaudio)))
  92. (outputs '("out" "debug"))
  93. (synopsis "Cross platform game development library")
  94. (description "Simple DirectMedia Layer is a cross-platform development
  95. library designed to provide low level access to audio, keyboard, mouse,
  96. joystick, and graphics hardware.")
  97. (home-page "https://libsdl.org/")
  98. (license lgpl2.1)))
  99. (define-public sdl2
  100. (package (inherit sdl)
  101. (name "sdl2")
  102. (version "2.0.9")
  103. (source (origin
  104. (method url-fetch)
  105. (uri
  106. (string-append "https://libsdl.org/release/SDL2-"
  107. version ".tar.gz"))
  108. (sha256
  109. (base32
  110. "1c94ndagzkdfqaa838yqg589p1nnqln8mv0hpwfhrkbfczf8cl95"))))
  111. (arguments
  112. (substitute-keyword-arguments (package-arguments sdl)
  113. ((#:configure-flags flags)
  114. `(append '("--disable-wayland-shared")
  115. ,flags))))
  116. (inputs
  117. ;; SDL2 needs to be built with ibus support otherwise some systems
  118. ;; experience a bug where input events are doubled.
  119. ;;
  120. ;; For more information, see: https://dev.solus-project.com/T1721
  121. (append `(("dbus" ,dbus)
  122. ("fcitx" ,fcitx) ; helps with CJK input
  123. ("glib" ,glib)
  124. ("ibus" ,ibus)
  125. ("libxkbcommon" ,libxkbcommon)
  126. ("wayland" ,wayland)
  127. ("wayland-protocols" ,wayland-protocols))
  128. (package-inputs sdl)))
  129. (license bsd-3)))
  130. (define-public libmikmod
  131. (package
  132. (name "libmikmod")
  133. (version "3.3.11.1")
  134. (source (origin
  135. (method url-fetch)
  136. (uri (list
  137. (string-append "mirror://sourceforge/mikmod/libmikmod/"
  138. version "/libmikmod-" version ".tar.gz")
  139. ;; Older versions are sometimes moved to:
  140. (string-append "mirror://sourceforge/mikmod/"
  141. "outdated_versions/libmikmod/"
  142. version "/libmikmod-" version ".tar.gz")))
  143. (sha256
  144. (base32
  145. "06bdnhb0l81srdzg6gn2v2ydhhaazza7rshrcj3q8dpqr3gn97dd"))))
  146. (build-system gnu-build-system)
  147. (arguments
  148. ;; By default, libmikmod tries to dlopen libasound etc., which won't work
  149. ;; unless the right libalsa happens to be in $LD_LIBRARY_PATH. Pass
  150. ;; '--disable-dl' to avoid that.
  151. '(#:configure-flags '("--disable-dl")))
  152. (synopsis "Library for module sound formats")
  153. (description
  154. "MikMod is able to play a wide range of module formats, as well as
  155. digital sound files. It can take advantage of particular features of your
  156. system, such as sound redirection over the network.")
  157. (license lgpl2.1)
  158. (home-page "http://mikmod.sourceforge.net/")))
  159. (define-public sdl-gfx
  160. (package
  161. (name "sdl-gfx")
  162. (version "2.0.26")
  163. (source (origin
  164. (method url-fetch)
  165. (uri
  166. (string-append "http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-"
  167. version ".tar.gz"))
  168. (sha256
  169. (base32
  170. "0ijljhs0v99dj6y27hc10z6qchyp8gdp4199y6jzngy6dzxlzsvw"))))
  171. (build-system gnu-build-system)
  172. (outputs '("out" "debug"))
  173. (arguments
  174. `(,@(if (any (cute string-prefix? <> (or (%current-system)
  175. (%current-target-system)))
  176. '("x86_64" "i686"))
  177. ;; mmx is supported only on Intel processors.
  178. '()
  179. '(#:configure-flags '("--disable-mmx")))))
  180. (propagated-inputs `(("sdl" ,sdl)))
  181. (synopsis "SDL graphics primitives library")
  182. (description "SDL_gfx provides graphics drawing primitives, rotozoom and
  183. other supporting functions for SDL.")
  184. (home-page "http://www.ferzkopp.net/joomla/software-mainmenu-14/4-ferzkopps-linux-software/19-sdlgfx")
  185. (license zlib)))
  186. (define-public sdl-image
  187. (package
  188. (name "sdl-image")
  189. (version "1.2.12")
  190. (source (origin
  191. (method url-fetch)
  192. (uri
  193. (string-append "https://www.libsdl.org/projects/SDL_image/release/SDL_image-"
  194. version ".tar.gz"))
  195. (sha256
  196. (base32
  197. "16an9slbb8ci7d89wakkmyfvp7c0cval8xw4hkg0842nhhlp540b"))))
  198. (build-system gnu-build-system)
  199. (outputs '("out" "debug"))
  200. (arguments
  201. ;; Explicitly link against shared libraries instead of dlopening them.
  202. '(#:configure-flags '("--disable-jpg-shared"
  203. "--disable-png-shared"
  204. "--disable-tif-shared"
  205. "--disable-webp-shared")))
  206. (native-inputs `(("pkg-config" ,pkg-config)))
  207. ;; libjpeg, libpng, and libtiff are propagated inputs because the
  208. ;; SDL_image headers include the headers of these libraries. SDL is a
  209. ;; propagated input because the pkg-config file refers to SDL's pkg-config
  210. ;; file.
  211. (propagated-inputs `(("sdl" ,sdl)
  212. ("libjpeg" ,libjpeg)
  213. ("libpng" ,libpng)
  214. ("libtiff" ,libtiff)
  215. ("libwebp" ,libwebp)))
  216. (synopsis "SDL image loading library")
  217. (description "SDL_image is an image file loading library for SDL that
  218. supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF,
  219. WEBP, XCF, XPM, and XV.")
  220. (home-page "https://www.libsdl.org/projects/SDL_image/")
  221. (license zlib)))
  222. (define-public sdl-mixer
  223. (package
  224. (name "sdl-mixer")
  225. (version "1.2.12")
  226. (source (origin
  227. (method url-fetch)
  228. (uri
  229. (string-append "https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-"
  230. version ".tar.gz"))
  231. (sha256
  232. (base32
  233. "0alrhqgm40p4c92s26mimg9cm1y7rzr6m0p49687jxd9g6130i0n"))))
  234. (build-system gnu-build-system)
  235. (outputs '("out" "debug"))
  236. ;; no check target
  237. ;; use libmad instead of smpeg
  238. ;; explicitly link against shared libraries instead of dlopening them
  239. (arguments `(#:tests? #f
  240. #:configure-flags '("--enable-music-mp3-mad-gpl"
  241. "--disable-music-mod-shared"
  242. "--disable-music-fluidsynth-shared"
  243. "--disable-music-ogg-shared"
  244. "--disable-music-flac-shared"
  245. "--disable-music-mp3-shared")))
  246. (inputs `(("libvorbis" ,libvorbis)
  247. ("libflac" ,flac)
  248. ("libmad" ,libmad)
  249. ("libmikmod" ,libmikmod)
  250. ("libmodplug" ,libmodplug)))
  251. ;; FIXME: Add libfluidsynth
  252. (propagated-inputs `(("sdl" ,sdl)))
  253. (synopsis "SDL multi-channel audio mixer library")
  254. (description "SDL_mixer is a multi-channel audio mixer library for SDL.
  255. It supports any number of simultaneously playing channels of 16 bit stereo
  256. audio, plus a single channel of music. Supported format include FLAC, MOD,
  257. MIDI, Ogg Vorbis, and MP3.")
  258. (home-page "https://www.libsdl.org/projects/SDL_mixer/")
  259. (license zlib)))
  260. (define-public sdl-net
  261. (package
  262. (name "sdl-net")
  263. (version "1.2.8")
  264. (source (origin
  265. (method url-fetch)
  266. (uri
  267. (string-append "https://www.libsdl.org/projects/SDL_net/release/SDL_net-"
  268. version ".tar.gz"))
  269. (sha256
  270. (base32
  271. "1d5c9xqlf4s1c01gzv6cxmg0r621pq9kfgxcg3197xw4p25pljjz"))))
  272. (build-system gnu-build-system)
  273. (propagated-inputs `(("sdl" ,sdl)))
  274. (native-inputs `(("pkg-config" ,pkg-config)))
  275. (outputs '("out" "debug"))
  276. (synopsis "SDL networking library")
  277. (description "SDL_net is a small, cross-platform networking library for
  278. SDL.")
  279. (home-page "https://www.libsdl.org/projects/SDL_net/")
  280. (license zlib)))
  281. (define-public sdl-ttf
  282. (package
  283. (name "sdl-ttf")
  284. (version "2.0.11")
  285. (source (origin
  286. (method url-fetch)
  287. (uri
  288. (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-"
  289. version ".tar.gz"))
  290. (sha256
  291. (base32
  292. "1dydxd4f5kb1288i5n5568kdk2q7f8mqjr7i7sd33nplxjaxhk3j"))))
  293. (build-system gnu-build-system)
  294. (propagated-inputs `(("sdl" ,sdl)))
  295. (inputs `(("freetype" ,freetype)
  296. ("mesa" ,mesa)))
  297. (native-inputs `(("pkg-config" ,pkg-config)))
  298. (outputs '("out" "debug"))
  299. (synopsis "SDL TrueType font library")
  300. (description "SDL_ttf is a TrueType font rendering library for SDL.")
  301. (home-page "https://www.libsdl.org/projects/SDL_ttf/")
  302. (license zlib)))
  303. (define* (sdl-union #:optional (packages (list sdl sdl-gfx sdl-net sdl-ttf
  304. sdl-image sdl-mixer)))
  305. "Return 'sdl-union' package which is a union of PACKAGES.
  306. If PACKAGES are not specified, all SDL packages are used."
  307. (package
  308. (name "sdl-union")
  309. (version (package-version sdl))
  310. (source #f)
  311. (build-system trivial-build-system)
  312. (arguments
  313. '(#:modules ((guix build union))
  314. #:builder (begin
  315. (use-modules (ice-9 match)
  316. (guix build union))
  317. (match %build-inputs
  318. (((names . directories) ...)
  319. (union-build (assoc-ref %outputs "out")
  320. directories)
  321. #t)))))
  322. (inputs (map (lambda (package)
  323. (list (package-name package) package))
  324. packages))
  325. (synopsis "Union of SDL libraries")
  326. (description
  327. "A union of SDL and its extension libraries. A union is required because
  328. sdl-config assumes that all of the headers and libraries are in the same
  329. directory.")
  330. (home-page (package-home-page sdl))
  331. (license (package-license sdl))))
  332. (define (propagated-inputs-with-sdl2 package)
  333. "Replace the \"sdl\" propagated input of PACKAGE with SDL2."
  334. (map (match-lambda
  335. (("sdl" _)
  336. `("sdl2" ,sdl2))
  337. (other other))
  338. (package-propagated-inputs package)))
  339. (define-public sdl2-gfx
  340. (package (inherit sdl-gfx)
  341. (name "sdl2-gfx")
  342. (version "1.0.4")
  343. (source (origin
  344. (method url-fetch)
  345. (uri
  346. (string-append "https://www.ferzkopp.net/Software/SDL2_gfx/SDL2_gfx-"
  347. version ".tar.gz"))
  348. (sha256
  349. (base32
  350. "0qk2ax7f7grlxb13ba0ll3zlm8780s7j8fmrhlpxzjgdvldf1q33"))))
  351. (propagated-inputs
  352. (propagated-inputs-with-sdl2 sdl-gfx))))
  353. (define-public sdl2-image
  354. (package (inherit sdl-image)
  355. (name "sdl2-image")
  356. (version "2.0.4")
  357. (source
  358. (origin
  359. (method url-fetch)
  360. (uri
  361. (string-append "https://www.libsdl.org/projects/SDL_image/release/"
  362. "SDL2_image-" version ".tar.gz"))
  363. (sha256
  364. (base32 "1b6f7002bm007y3zpyxb5r6ag0lml51jyvx1pwpj9sq24jfc8kp7"))))
  365. (propagated-inputs
  366. (propagated-inputs-with-sdl2 sdl-image))))
  367. (define-public sdl2-mixer
  368. (package (inherit sdl-mixer)
  369. (name "sdl2-mixer")
  370. (version "2.0.4")
  371. (source
  372. (origin
  373. (method url-fetch)
  374. (uri
  375. (string-append "http://www.libsdl.org/projects/SDL_mixer/release/"
  376. "SDL2_mixer-" version ".tar.gz"))
  377. (modules '((guix build utils)))
  378. (snippet '(begin
  379. ;; Remove bundled libraries.
  380. (delete-file-recursively "external")
  381. #t))
  382. (sha256
  383. (base32 "0694vsz5bjkcdgfdra6x9fq8vpzrl8m6q96gh58df7065hw5mkxl"))))
  384. (propagated-inputs
  385. (propagated-inputs-with-sdl2 sdl-mixer))))
  386. (define-public sdl2-ttf
  387. (package (inherit sdl-ttf)
  388. (name "sdl2-ttf")
  389. (version "2.0.15")
  390. (source (origin
  391. (method url-fetch)
  392. (uri
  393. (string-append "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-"
  394. version ".tar.gz"))
  395. (modules '((guix build utils)))
  396. (snippet (begin
  397. ;; Remove bundled libraries.
  398. '(delete-file-recursively "external")
  399. #t))
  400. (sha256
  401. (base32
  402. "0cyd48dipc0m399qy8s03lci8b0bpiy8xlkvrm2ia7wcv0dfpv59"))))
  403. (propagated-inputs
  404. (propagated-inputs-with-sdl2 sdl-ttf))))
  405. (define-public guile-sdl
  406. (package
  407. (name "guile-sdl")
  408. (version "0.5.2")
  409. (source (origin
  410. (method url-fetch)
  411. (uri
  412. (string-append "mirror://gnu/guile-sdl/guile-sdl-"
  413. version ".tar.xz"))
  414. (sha256
  415. (base32
  416. "0cjgs012a9922hn6xqwj66w6qmfs3nycnm56hyykx5n3g5p7ag01"))))
  417. (build-system gnu-build-system)
  418. (native-inputs
  419. `(("pkg-config" ,pkg-config)
  420. ;; Required by test suite.
  421. ("xorg-server" ,xorg-server)
  422. ("libjpeg" ,libjpeg)))
  423. (inputs
  424. `(("guile" ,guile-2.2)
  425. ("sdl-union" ,(sdl-union))))
  426. (arguments
  427. '(#:configure-flags
  428. (list (string-append "--with-sdl-prefix="
  429. (assoc-ref %build-inputs "sdl-union")))
  430. #:modules ((ice-9 popen)
  431. (guix build utils)
  432. (guix build gnu-build-system))
  433. #:parallel-build? #f ; parallel build fails
  434. #:phases
  435. (modify-phases %standard-phases
  436. (add-before 'configure 'fix-env-and-patch
  437. (lambda* (#:key inputs #:allow-other-keys)
  438. (setenv "GUILE_AUTO_COMPILE" "0")
  439. ;; SDL_image needs to dlopen libjpeg in the test suite.
  440. (setenv "LD_LIBRARY_PATH"
  441. (string-append (assoc-ref inputs "libjpeg") "/lib"))
  442. ;; Change the site directory /site/X.Y like Guile expects.
  443. (substitute* "build-aux/guile-baux/re-prefixed-site-dirs"
  444. (("\"/site\"")
  445. (let ((effective
  446. (read
  447. (open-pipe* OPEN_READ
  448. "guile" "-c"
  449. "(write (effective-version))"))))
  450. (string-append "\"/site/" effective "\""))))
  451. ;; Skip tests that rely on sound support, which is unavailable in
  452. ;; the build environment.
  453. (substitute* "test/Makefile.in"
  454. (("HAVE_MIXER = .*$")
  455. "HAVE_MIXER = 0\n"))
  456. #t))
  457. (add-before 'check 'start-xorg-server
  458. (lambda* (#:key inputs #:allow-other-keys)
  459. ;; The test suite requires a running X server.
  460. (system (format #f "~a/bin/Xvfb :1 &"
  461. (assoc-ref inputs "xorg-server")))
  462. (setenv "DISPLAY" ":1")
  463. #t))
  464. (add-before 'check 'skip-cursor-test
  465. (lambda _
  466. ;; XXX: This test sometimes enters an endless loop, and sometimes
  467. ;; crashes with:
  468. ;; guile: xcb_io.c:147: append_pending_request: Assertion `!xcb_xlib_unknown_seq_number' failed.
  469. ;; Skip it.
  470. (substitute* "test/cursor.scm"
  471. (("\\(SDL:init .*" all)
  472. (string-append "(exit 77) ;" all "\n")))
  473. #t)))))
  474. (synopsis "Guile interface for SDL (Simple DirectMedia Layer)")
  475. (description "Guile-SDL is a set of bindings to the Simple DirectMedia
  476. Layer (SDL). With them, Guile programmers can have easy access to graphics,
  477. sound and device input (keyboards, joysticks, mice, etc.).")
  478. (home-page "https://www.gnu.org/software/guile-sdl/")
  479. (license gpl3+)))
  480. (define-public guile-sdl2
  481. (package
  482. (name "guile-sdl2")
  483. (version "0.3.1")
  484. (source (origin
  485. (method url-fetch)
  486. (uri (string-append
  487. "https://files.dthompson.us/guile-sdl2/guile-sdl2-"
  488. version ".tar.gz"))
  489. (sha256
  490. (base32
  491. "0bw7x2lx90k4banc5k7yfkn3as93y25gr1xdr225ll7lmij21k64"))))
  492. (build-system gnu-build-system)
  493. (arguments
  494. '(#:make-flags '("GUILE_AUTO_COMPILE=0")
  495. #:configure-flags
  496. (list (string-append "--with-libsdl2-prefix="
  497. (assoc-ref %build-inputs "sdl2"))
  498. (string-append "--with-libsdl2-image-prefix="
  499. (assoc-ref %build-inputs "sdl2-image"))
  500. (string-append "--with-libsdl2-ttf-prefix="
  501. (assoc-ref %build-inputs "sdl2-ttf"))
  502. (string-append "--with-libsdl2-mixer-prefix="
  503. (assoc-ref %build-inputs "sdl2-mixer")))))
  504. (native-inputs
  505. `(("guile" ,guile-2.2)
  506. ("pkg-config" ,pkg-config)))
  507. (inputs
  508. `(("sdl2" ,sdl2)
  509. ("sdl2-image" ,sdl2-image)
  510. ("sdl2-mixer" ,sdl2-mixer)
  511. ("sdl2-ttf" ,sdl2-ttf)))
  512. (synopsis "Guile bindings for SDL2")
  513. (home-page "https://dthompson.us/projects/guile-sdl2.html")
  514. (description
  515. "Guile-SDL2 provides Guile Scheme bindings for the SDL2 C shared library.
  516. The bindings are written in pure Scheme using Guile's foreign function
  517. interface.")
  518. (license lgpl3+)))
  519. (define-public ghc-sdl2
  520. (package
  521. (name "ghc-sdl2")
  522. (version "2.4.1.0")
  523. (source
  524. (origin
  525. (method url-fetch)
  526. (uri (string-append "https://hackage.haskell.org/package/"
  527. "sdl2/sdl2-" version ".tar.gz"))
  528. (sha256
  529. (base32
  530. "0p4b12fmxps0sbnkqdfy0qw19s355yrkw7fgw6xz53wzq706k991"))))
  531. (build-system haskell-build-system)
  532. (arguments '(#:tests? #f)) ; tests require graphical environment
  533. (inputs
  534. `(("ghc-exceptions" ,ghc-exceptions)
  535. ("ghc-linear" ,ghc-linear)
  536. ("ghc-statevar" ,ghc-statevar)
  537. ("ghc-text" ,ghc-text)
  538. ("ghc-vector" ,ghc-vector)
  539. ("sdl2" ,sdl2)))
  540. (native-inputs
  541. `(("ghc-weigh" ,ghc-weigh)
  542. ("pkg-config" ,pkg-config)))
  543. (home-page "http://hackage.haskell.org/package/sdl2")
  544. (synopsis "High- and low-level bindings to the SDL library")
  545. (description
  546. "This package contains bindings to the SDL 2 library, in both high- and
  547. low-level forms. The @code{SDL} namespace contains high-level bindings, where
  548. enumerations are split into sum types, and we perform automatic
  549. error-checking. The @code{SDL.Raw} namespace contains an almost 1-1
  550. translation of the C API into Haskell FFI calls. As such, this does not
  551. contain sum types nor error checking. Thus this namespace is suitable for
  552. building your own abstraction over SDL, but is not recommended for day-to-day
  553. programming.")
  554. (license bsd-3)))
  555. (define-public ghc-sdl2-mixer
  556. (package
  557. (name "ghc-sdl2-mixer")
  558. (version "1.1.0")
  559. (source
  560. (origin
  561. (method url-fetch)
  562. (uri (string-append "https://hackage.haskell.org/package/sdl2-mixer/"
  563. "sdl2-mixer-" version ".tar.gz"))
  564. (sha256
  565. (base32
  566. "1k8avyccq5l9z7bwxigim312yaancxl1sr3q6a96bcm7pnhiak0g"))))
  567. (build-system haskell-build-system)
  568. (inputs
  569. `(("ghc-data-default-class" ,ghc-data-default-class)
  570. ("ghc-lifted-base" ,ghc-lifted-base)
  571. ("ghc-monad-control" ,ghc-monad-control)
  572. ("ghc-sdl2" ,ghc-sdl2)
  573. ("ghc-vector" ,ghc-vector)
  574. ("sdl2-mixer" ,sdl2-mixer)))
  575. (native-inputs
  576. `(("pkg-config" ,pkg-config)))
  577. (home-page "http://hackage.haskell.org/package/sdl2-mixer")
  578. (synopsis "Bindings to SDL2 mixer")
  579. (description "This package provides Haskell bindings to
  580. @code{SDL2_mixer}.")
  581. (license bsd-3)))
  582. (define-public ghc-sdl2-image
  583. (package
  584. (name "ghc-sdl2-image")
  585. (version "2.0.0")
  586. (source
  587. (origin
  588. (method url-fetch)
  589. (uri (string-append "https://hackage.haskell.org/package/sdl2-image/"
  590. "sdl2-image-" version ".tar.gz"))
  591. (sha256
  592. (base32
  593. "1pr6dkg73cy9z0w54lrkj9c5bhxj56nl92lxikjy8kz6nyr455rr"))))
  594. (build-system haskell-build-system)
  595. (inputs
  596. `(("ghc-sdl2" ,ghc-sdl2)
  597. ("ghc-text" ,ghc-text)
  598. ("sdl2-image" ,sdl2-image)))
  599. (native-inputs
  600. `(("pkg-config" ,pkg-config)))
  601. (home-page "http://hackage.haskell.org/package/sdl2-image")
  602. (synopsis "Bindings to SDL2_image")
  603. (description "This package provides Haskell bindings to
  604. @code{SDL2_image}.")
  605. (license expat)))