gnu: gita: Install shell completions.
[jackhill/guix/guix.git] / gnu / packages / emulators.scm
CommitLineData
e5f9ec8b 1;;; GNU Guix --- Functional package management for GNU
9af704c5
RH
2;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
3;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
4;;; Copyright © 2015, 2016 Sou Bunnbu <iyzsong@gmail.com>
5;;; Copyright © 2015, 2016 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
6;;; Copyright © 2015, 2018 David Thompson <dthompson2@worcester.edu>
7;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
fad22f09 8;;; Copyright © 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
d63e0ee7 9;;; Copyright © 2017, 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
2d4b2488 10;;; Copyright © 2017, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
478040d4 11;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
1403e1f7 12;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
f6a0be2f 13;;; Copyright © 2019 David Wilson <david@daviwil.com>
c9e7acbf 14;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
e5f9ec8b
RH
15;;;
16;;; This file is part of GNU Guix.
17;;;
18;;; GNU Guix is free software; you can redistribute it and/or modify it
19;;; under the terms of the GNU General Public License as published by
20;;; the Free Software Foundation; either version 3 of the License, or (at
21;;; your option) any later version.
22;;;
23;;; GNU Guix is distributed in the hope that it will be useful, but
24;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26;;; GNU General Public License for more details.
27;;;
28;;; You should have received a copy of the GNU General Public License
29;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31(define-module (gnu packages emulators)
1403e1f7 32 #:use-module (ice-9 match)
e5f9ec8b
RH
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
9af704c5 35 #:use-module (guix download)
e5f9ec8b 36 #:use-module (guix git-download)
9af704c5
RH
37 #:use-module (guix svn-download)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages algebra)
4c40ed9d 40 #:use-module (gnu packages assembly)
e5f9ec8b 41 #:use-module (gnu packages audio)
9af704c5
RH
42 #:use-module (gnu packages autotools)
43 #:use-module (gnu packages base)
44 #:use-module (gnu packages boost)
45 #:use-module (gnu packages backup)
1403e1f7 46 #:use-module (gnu packages cdrom)
f43e4104 47 #:use-module (gnu packages check)
e5f9ec8b 48 #:use-module (gnu packages compression)
f43e4104 49 #:use-module (gnu packages cross-base)
e5f9ec8b 50 #:use-module (gnu packages curl)
bb3ddda2 51 #:use-module (gnu packages digest)
e8ffa382 52 #:use-module (gnu packages elf)
e5f9ec8b
RH
53 #:use-module (gnu packages fonts)
54 #:use-module (gnu packages fontutils)
9af704c5 55 #:use-module (gnu packages freedesktop)
9380b0a0 56 #:use-module (gnu packages fribidi)
e5f9ec8b 57 #:use-module (gnu packages game-development)
cbf58afa 58 #:use-module (gnu packages gcc)
e5f9ec8b
RH
59 #:use-module (gnu packages gettext)
60 #:use-module (gnu packages gl)
61 #:use-module (gnu packages glib)
62 #:use-module (gnu packages gtk)
63 #:use-module (gnu packages image)
9af704c5 64 #:use-module (gnu packages libedit)
e5f9ec8b
RH
65 #:use-module (gnu packages libusb)
66 #:use-module (gnu packages linux)
c8b2fd28
NG
67 #:use-module (gnu packages lua)
68 #:use-module (gnu packages maths)
4c40ed9d 69 #:use-module (gnu packages mp3)
c8b2fd28 70 #:use-module (gnu packages music)
9af704c5 71 #:use-module (gnu packages ncurses)
c8b2fd28 72 #:use-module (gnu packages networking)
e5f9ec8b
RH
73 #:use-module (gnu packages pkg-config)
74 #:use-module (gnu packages pulseaudio)
9af704c5 75 #:use-module (gnu packages python)
e5f9ec8b
RH
76 #:use-module (gnu packages qt)
77 #:use-module (gnu packages sdl)
9d0c291e 78 #:use-module (gnu packages sphinx)
cd0322a3 79 #:use-module (gnu packages sqlite)
c8b2fd28
NG
80 #:use-module (gnu packages texinfo)
81 #:use-module (gnu packages textutils)
e5f9ec8b
RH
82 #:use-module (gnu packages tls)
83 #:use-module (gnu packages upnp)
84 #:use-module (gnu packages video)
9af704c5 85 #:use-module (gnu packages vulkan)
e5f9ec8b 86 #:use-module (gnu packages wxwidgets)
9af704c5 87 #:use-module (gnu packages xdisorg)
e5f9ec8b 88 #:use-module (gnu packages xiph)
9af704c5 89 #:use-module (gnu packages xml)
e5f9ec8b 90 #:use-module (gnu packages xorg)
c8b2fd28 91 #:use-module (gnu packages web)
9af704c5 92 #:use-module (guix build-system cmake)
f6a0be2f 93 #:use-module (guix build-system glib-or-gtk)
f43e4104
JK
94 #:use-module (guix build-system gnu)
95 #:use-module (guix build-system python))
9af704c5
RH
96
97(define-public desmume
98 (package
99 (name "desmume")
100 (version "0.9.11")
101 (source
102 (origin
103 (method url-fetch)
104 (uri (string-append
105 "mirror://sourceforge/desmume/desmume/"
106 version "/desmume-" version ".tar.gz"))
107 (sha256
108 (base32
f2674207 109 "15l8wdw3q61fniy3h93d84dnm6s4pyadvh95a0j6d580rjk4pcrs"))
110 (patches (search-patches "desmume-gcc6-fixes.patch"
111 "desmume-gcc7-fixes.patch"))))
9af704c5
RH
112 (build-system gnu-build-system)
113 (arguments
114 ;; Enable support for WiFi and microphone.
115 `(#:configure-flags '("--enable-wifi"
116 "--enable-openal")))
117 (native-inputs
118 `(("pkg-config" ,pkg-config)
119 ("intltool" ,intltool)))
120 (inputs
121 `(("zlib" ,zlib)
122 ("sdl" ,sdl)
123 ("glib" ,glib)
124 ("gtk+" ,gtk+-2)
125 ("glu" ,glu)))
126 (home-page "http://desmume.org/")
127 (synopsis "Nintendo DS emulator")
128 (description
129 "DeSmuME is an emulator for the Nintendo DS handheld gaming console.")
130 (license license:gpl2)))
e5f9ec8b
RH
131
132;; Building from recent Git because the official 5.0 release no longer builds.
133(define-public dolphin-emu
2b332c51
RH
134 (let ((commit "a9745400ec5cea7e55d94955afbdc44d1a4982d1")
135 (revision "7"))
e5f9ec8b
RH
136 (package
137 (name "dolphin-emu")
138 (version (git-version "5.0" revision commit))
139 (source
140 (origin
141 (method git-fetch)
142 (uri (git-reference
b0e7b699 143 (url "https://github.com/dolphin-emu/dolphin")
e5f9ec8b
RH
144 (commit commit)))
145 (file-name (git-file-name name version))
85280804
EF
146 (modules '((guix build utils)))
147 (snippet
148 '(begin
149 ;; Remove external stuff we don't need.
150 (for-each (lambda (dir)
151 (delete-file-recursively
152 (string-append "Externals/" dir)))
fab8d41c 153 '("LZO" "OpenAL" "Qt" "SFML" "curl" "ffmpeg"
85280804 154 "gettext" "hidapi" "libpng" "libusb" "mbedtls"
2b332c51 155 "miniupnpc" "MoltenVK" "zlib"))
85280804
EF
156 ;; Clean up source.
157 (for-each delete-file (find-files "." ".*\\.(bin|dsy|exe|jar|rar)$"))
158 #t))
e5f9ec8b
RH
159 (sha256
160 (base32
2b332c51 161 "0ic08ii4vlqlmk2wkfc99jiy6nji2wfq56r7slj23wgvhznnaabk"))))
e5f9ec8b
RH
162 (build-system cmake-build-system)
163 (arguments
164 '(#:tests? #f
e5f9ec8b
RH
165 #:phases
166 (modify-phases %standard-phases
6bebad77 167 (add-before 'configure 'generate-fonts&hardcore-libvulkan-path
e5f9ec8b
RH
168 (lambda* (#:key inputs outputs #:allow-other-keys)
169 (let ((fontfile
170 (string-append (assoc-ref inputs "font-wqy-microhei")
6bebad77
RH
171 "/share/fonts/truetype/wqy-microhei.ttc"))
172 (libvulkan
e6fcf903 173 (string-append (assoc-ref inputs "vulkan-loader")
6bebad77 174 "/lib/libvulkan.so")))
e5f9ec8b 175 (chdir "docs")
0fe041bd 176 (invoke "bash" "-c" "g++ -O2 $(freetype-config \
e5f9ec8b
RH
177--cflags --libs) gc-font-tool.cpp -o gc-font-tool")
178 (invoke "./gc-font-tool" "a" fontfile "font_western.bin")
179 (invoke "./gc-font-tool" "s" fontfile "font_japanese.bin")
180 (copy-file "font_japanese.bin" "../Data/Sys/GC/font_japanese.bin")
181 (copy-file "font_western.bin" "../Data/Sys/GC/font_western.bin")
182 (chdir "..")
6bebad77 183 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
2b332c51
RH
184 (("\"vulkan\", 1") (string-append "\"vulkan\"")))
185 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
186 (("\"vulkan\"") (string-append "\"" libvulkan "\"")))
187 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
188 (("Common::DynamicLibrary::GetVersionedFilename") ""))
e5f9ec8b
RH
189 #t))))
190
fab8d41c
RH
191 ;; The FindGTK2 cmake script only checks hardcoded directories for
192 ;; glib/gtk headers.
193
e5f9ec8b 194 #:configure-flags
fab8d41c 195 (list (string-append "-DX11_INCLUDE_DIR="
e5f9ec8b
RH
196 (assoc-ref %build-inputs "libx11")
197 "/include")
198 (string-append "-DX11_LIBRARIES="
199 (assoc-ref %build-inputs "libx11")
200 "/lib/libX11.so")
201 "-DX11_FOUND=1")))
e5f9ec8b
RH
202 (native-inputs
203 `(("pkg-config" ,pkg-config)
f2d97d57 204 ("gettext" ,gettext-minimal)))
e5f9ec8b
RH
205 (inputs
206 `(("alsa-lib" ,alsa-lib)
207 ("ao" ,ao)
208 ("bluez" ,bluez)
209 ("curl" ,curl)
210 ("eudev" ,eudev)
e7039f10 211 ("ffmpeg" ,ffmpeg)
e5f9ec8b
RH
212 ("font-wqy-microhei" ,font-wqy-microhei)
213 ("freetype" ,freetype)
214 ("glew" ,glew)
215 ("glib" ,glib)
216 ("glu" ,glu)
217 ("gtk+" ,gtk+-2)
218 ("hidapi" ,hidapi)
219 ("libevdev" ,libevdev)
220 ("libpng" ,libpng)
221 ("libusb" ,libusb)
222 ("libx11" ,libx11)
223 ("libxi" ,libxi)
224 ("libxrandr" ,libxrandr)
225 ("lzo" ,lzo)
226 ("mbedtls-apache" ,mbedtls-apache)
227 ("mesa" ,mesa)
228 ("miniupnpc" ,miniupnpc)
229 ("openal" ,openal)
fab8d41c 230 ("pugixml" ,pugixml)
e5f9ec8b
RH
231 ("pulseaudio" ,pulseaudio)
232 ("qtbase" ,qtbase)
233 ("sdl2" ,sdl2)
234 ("sfml" ,sfml)
235 ("soil" ,soil)
236 ("soundtouch" ,soundtouch)
e6fcf903 237 ("vulkan-loader" ,vulkan-loader)
e5f9ec8b
RH
238 ("zlib" ,zlib)))
239 (home-page "https://dolphin-emu.org/")
240 (synopsis "Nintendo Wii and GameCube emulator")
241 (description
242 "Dolphin is an emulator for two Nintendo video game consoles: the
243GameCube and the Wii. It provides compatibility with all PC controllers,
244turbo speed, networked multiplayer, and graphical enhancements.")
e89bfc2d 245 (supported-systems '("x86_64-linux" "aarch64-linux"))
e5f9ec8b
RH
246 ; dolphin/Data/Sys/GC/font_*.bin: Licensed under ASL2.0.
247 (license (list license:gpl2+ license:asl2.0 license:fdl1.2+)))))
9af704c5
RH
248
249(define-public dosbox
250 (package
251 (name "dosbox")
b09e4960 252 (version "0.74-3")
9af704c5 253 (source (origin
478040d4
RH
254 (method url-fetch)
255 (uri (string-append "https://sourceforge.net/projects/dosbox"
256 "/files/dosbox/" version "/dosbox-"
257 version ".tar.gz/download"))
258 (file-name (string-append name "-" version ".tar.gz"))
9af704c5
RH
259 (sha256
260 (base32
b09e4960 261 "02i648i50dwicv1vaql15rccv4g8h5blf5g6inv67lrfxpbkvlf0"))))
9af704c5 262 (build-system gnu-build-system)
9af704c5
RH
263 (native-inputs
264 `(("autoconf" ,autoconf)
265 ("automake" ,automake)))
266 (inputs
267 `(("sdl" ,sdl)
268 ("libpng" ,libpng)
269 ("zlib" ,zlib)
270 ("alsa-lib" ,alsa-lib)
271 ("glu" ,glu)
272 ("mesa" ,mesa)))
a30f20d4 273 (home-page "https://www.dosbox.com")
9af704c5
RH
274 (synopsis "X86 emulator with CGA/EGA/VGA/etc. graphics and sound")
275 (description "DOSBox is a DOS-emulator that uses the SDL library. DOSBox
276also emulates CPU:286/386 realmode/protected mode, Directory
277FileSystem/XMS/EMS, Tandy/Hercules/CGA/EGA/VGA/VESA graphics, a
278SoundBlaster/Gravis Ultra Sound card for excellent sound compatibility with
279older games.")
280 (license license:gpl2+)))
281
fad22f09
EF
282(define-public qtmips
283 (package
284 (name "qtmips")
285 (version "0.7.3")
286 (source (origin
287 (method git-fetch)
288 (uri (git-reference
289 (url "https://github.com/cvut/QtMips")
290 (commit (string-append "v" version))))
291 (file-name (git-file-name name version))
292 (sha256
293 (base32
294 "1khvwgqz4h6q6mhbbq0yx43ajz8gx9wmwzs8784vmfrglndbxgax"))))
295 (build-system cmake-build-system)
296 (arguments
297 '(#:phases
298 (modify-phases %standard-phases
299 (replace 'configure
300 (lambda* (#:key outputs #:allow-other-keys)
301 (invoke "qmake"
302 (string-append "PREFIX=" (assoc-ref outputs "out"))
303 "qtmips.pro")))
304 (replace 'check
305 (lambda* (#:key tests? #:allow-other-keys)
306 (substitute* "tests/test.sh"
307 (("qtchooser.*") ""))
308 (substitute* '("tests/cpu_trap/test.sh"
309 "tests/registers/test.sh")
310 (("sub-qtmips_cli") "qtmips_cli"))
311 (if tests?
312 (invoke "tests/run-all.sh")
313 #t)))
314 (replace 'install
315 ;; There is no install target.
316 (lambda* (#:key outputs #:allow-other-keys)
317 (let* ((out (assoc-ref outputs "out"))
318 (bin (string-append out "/bin"))
319 (apps (string-append out "/share/applications"))
320 (icons (string-append out "/share/icons/hicolor")))
321 (install-file "qtmips_gui/qtmips_gui" bin)
322 (install-file "qtmips_cli/qtmips_cli" bin)
323 (install-file "data/qtmips.desktop" apps)
324 (install-file "data/icons/qtmips_gui.svg"
325 (string-append icons "/scalable/apps"))
326 (install-file "data/icons/qtmips_gui.png"
327 (string-append icons "/48x48/apps"))
328 #t))))
329 #:tests? #f)) ; test suite wants mips toolchain
330 (inputs
331 `(("elfutils" ,elfutils)
332 ("qtbase" ,qtbase)))
333 (home-page "https://github.com/cvut/QtMips")
334 (synopsis "MIPS CPU emulator")
335 (description "This package contains a MIPS CPU emulator. The simulator
336accepts ELF statically linked executables compiled for 32-bit big-endian
337MIPS target, targeting mips-linux-gnu or mips-elf.")
338 (license license:gpl2+))) ; License file says GPL3
339
9af704c5 340(define-public emulation-station
4530fe8e
JK
341 ;; No release for a long time, new commits fix build issues
342 (let ((commit "9cc42adff67946175d2b7e25c6ae69cc374e98a0")
343 (revision "1"))
9af704c5
RH
344 (package
345 (name "emulation-station")
4530fe8e 346 (version (git-version "2.0.1" revision commit))
9af704c5
RH
347 (source (origin
348 (method git-fetch) ; no tarball available
349 (uri (git-reference
b0e7b699 350 (url "https://github.com/Aloshi/EmulationStation")
9af704c5 351 (commit commit))) ; no version tag
4530fe8e 352 (file-name (git-file-name name version))
9af704c5
RH
353 (sha256
354 (base32
4530fe8e 355 "1cva0ns650v17lfn8in095zci6lc43d23f1x3mlzc41qfqa6mbd1"))))
9af704c5
RH
356 (build-system cmake-build-system)
357 (arguments
358 '(#:tests? #f)) ; no tests
359 (inputs
360 `(("alsa-lib" ,alsa-lib)
361 ("boost" ,boost)
362 ("curl" ,curl)
363 ("eigin" ,eigen)
364 ("freeimage" ,freeimage)
365 ("freetype" ,freetype)
366 ("mesa" ,mesa)
367 ("sdl2" ,sdl2)))
368 (synopsis "Video game console emulator front-end")
369 (description "EmulationStation provides a graphical front-end to a large
370number of video game console emulators. It features an interface that is
371usable with any game controller that has at least 4 buttons, theming support,
372and a game metadata scraper.")
76dc85e4 373 (home-page "https://emulationstation.org")
9af704c5
RH
374 (license license:expat))))
375
376(define-public higan
377 (package
378 (name "higan")
76cc11a0 379 (version "110")
9af704c5
RH
380 (source
381 (origin
f3686999
JK
382 (method git-fetch)
383 (uri (git-reference
b0e7b699 384 (url "https://github.com/higan-emu/higan")
76cc11a0 385 (commit (string-append "v" version))))
f3686999 386 (file-name (git-file-name name version))
9af704c5 387 (sha256
76cc11a0 388 (base32 "11rvm53c3p2f6zk8xbyv2j51xp8zmqnch7zravhj3fk590qrjrr2"))))
9af704c5
RH
389 (build-system gnu-build-system)
390 (native-inputs
391 `(("pkg-config" ,pkg-config)))
392 (inputs
393 `(("alsa-lib" ,alsa-lib)
394 ("ao" ,ao)
395 ("eudev" ,eudev)
396 ("gtk+" ,gtk+-2)
397 ("gtksourceview-2" ,gtksourceview-2)
76cc11a0 398 ("libxrandr" ,libxrandr)
9af704c5
RH
399 ("libxv" ,libxv)
400 ("mesa" ,mesa)
401 ("openal" ,openal)
402 ("pulseaudio" ,pulseaudio)
76cc11a0 403 ("sdl2" ,sdl2)))
9af704c5
RH
404 (arguments
405 '(#:phases
406 (let ((build-phase (assoc-ref %standard-phases 'build))
407 (install-phase (assoc-ref %standard-phases 'install)))
408 (modify-phases %standard-phases
409 ;; The higan build system has no configure phase.
410 (delete 'configure)
411 (add-before 'build 'chdir-to-higan
412 (lambda _
6d34d3f8
JK
413 (chdir "higan")
414 #t))
9af704c5
RH
415 (add-before 'install 'create-/share/applications
416 (lambda* (#:key outputs #:allow-other-keys)
417 (let ((out (assoc-ref outputs "out")))
418 ;; It seems the author forgot to do this in the Makefile.
6d34d3f8
JK
419 (mkdir-p (string-append out "/share/applications"))
420 #t)))
9af704c5
RH
421 (add-after 'install 'chdir-to-icarus
422 (lambda _
6d34d3f8
JK
423 (chdir "../icarus")
424 #t))
9af704c5
RH
425 (add-after 'chdir-to-icarus 'build-icarus build-phase)
426 (add-after 'build-icarus 'install-icarus install-phase)
427 (add-after 'install-icarus 'wrap-higan-executable
428 (lambda* (#:key inputs outputs #:allow-other-keys)
429 (let* ((out (assoc-ref outputs "out"))
430 (bin (string-append out "/bin"))
431 (higan (string-append bin "/higan"))
432 (higan-original (string-append higan "-original"))
433 (bash (string-append (assoc-ref inputs "bash")
434 "/bin/bash"))
435 (coreutils (assoc-ref inputs "coreutils"))
436 (mkdir (string-append coreutils "/bin/mkdir"))
437 (cp (string-append coreutils "/bin/cp"))
438 (cp-r (string-append cp " -r --no-preserve=mode")))
439 ;; First, have the executable make sure ~/.local/share/higan
440 ;; contains up to date files. Higan insists on looking there
441 ;; for these data files.
442 (rename-file higan higan-original)
443 (with-output-to-file higan
444 (lambda ()
445 (display
446 (string-append
447 "#!" bash "\n"
448 ;; higan doesn't respect $XDG_DATA_HOME
449 mkdir " -p ~/.local/share\n"
450 cp-r " " out "/share/higan ~/.local/share\n"
451 "exec " higan-original))))
452 (chmod higan #o555)
453 ;; Second, make sure higan will find icarus in PATH.
454 (wrap-program higan
6d34d3f8
JK
455 `("PATH" ":" prefix (,bin)))
456 #t)))))
9af704c5
RH
457 #:make-flags
458 (list "compiler=g++"
459 (string-append "prefix=" (assoc-ref %outputs "out")))
460 ;; There is no test suite.
461 #:tests? #f))
76cc11a0 462 (home-page "https://github.com/higan-emu/higan/")
6e2f7dc5 463 (synopsis "Multi-system emulator")
9af704c5 464 (description
6e2f7dc5
NG
465 "higan is a multi-system emulator with an uncompromising focus on
466accuracy and code readability.
467
468It currently emulates the following systems: Famicom, Famicom Disk System,
469Super Famicom, Super Game Boy, Game Boy, Game Boy Color, Game Boy Advance,
470Game Boy Player, SG-1000, SC-3000, Master System, Game Gear, Mega Drive, Mega
471CD, PC Engine, SuperGrafx, MSX, MSX2, ColecoVision, Neo Geo Pocket, Neo Geo
472Pocket Color, WonderSwan, WonderSwan Color, SwanCrystal, Pocket Challenge
473V2.")
76cc11a0 474 (license license:gpl3+)))
9af704c5 475
6dd2ad26
NG
476(define-public mednafen
477 (package
478 (name "mednafen")
f64d2650 479 (version "1.26.1")
6dd2ad26
NG
480 (source
481 (origin
482 (method url-fetch)
483 (uri (string-append "https://mednafen.github.io/releases/files/"
484 "mednafen-" version ".tar.xz"))
485 (sha256
f64d2650 486 (base32 "1x7xhxjhwsdbak8l0iyb497f043xkhibk73w96xck4j2bk10fac4"))))
6dd2ad26
NG
487 (build-system gnu-build-system)
488 (arguments
489 `(#:configure-flags
490 (list
491 ;; "--with-external-mpcdec"
492 "--with-external-lzo")))
493 (native-inputs
494 `(("pkg-config" ,pkg-config)))
495 (inputs
496 `(("alsa" ,alsa-lib)
497 ;; ("libmpcdec" ,libmpcdec) FIXME: not recognized.
498 ("libsndfile" ,libsndfile)
499 ("lzo" ,lzo)
500 ("sdl2" ,sdl2)
501 ("zlib" ,zlib)))
502 (home-page "https://mednafen.github.io/")
503 (synopsis "Multi-system emulator utilizing OpenGL and SDL")
504 (description
505 "Mednafen is a portable, utilizing OpenGL and SDL, argument-driven
506multi-system emulator. Mednafen has the ability to remap hotkey functions and
507virtual system inputs to a keyboard, a joystick, or both simultaneously. Save
508states are supported, as is real-time game rewinding. Screen snapshots may be
509taken, in the PNG file format, at the press of a button. Mednafen can record
510audiovisual movies in the QuickTime file format, with several different
511lossless codecs supported.
512
513The following systems are supported:
514
515@itemize
516@item Apple II/II+
517@item Atari Lynx
518@item Neo Geo Pocket (Color)
519@item WonderSwan
520@item GameBoy (Color)
521@item GameBoy Advance
522@item Nintendo Entertainment System
523@item Super Nintendo Entertainment System/Super Famicom
524@item Virtual Boy
525@item PC Engine/TurboGrafx 16 (CD)
526@item SuperGrafx
527@item PC-FX
528@item Sega Game Gear
529@item Sega Genesis/Megadrive
530@item Sega Master System
531@item Sega Saturn (experimental, x86_64 only)
532@item Sony PlayStation
533@end itemize")
534 ;; Main license is GPL2+. Some parts are BSD-3.
535 (license (list license:gpl2+ license:bsd-3))))
536
9af704c5
RH
537(define-public mgba
538 (package
539 (name "mgba")
98c4f108 540 (version "0.8.4")
d63e0ee7
NG
541 (source
542 (origin
543 (method git-fetch)
544 (uri (git-reference
b0e7b699 545 (url "https://github.com/mgba-emu/mgba")
d63e0ee7
NG
546 (commit version)))
547 (file-name (git-file-name name version))
548 (sha256
98c4f108 549 (base32 "0nqj4bnn5c2z1bq4bnbw1wznc0wpmq4sy3w8pipd6n6620b9m4qq"))
d63e0ee7
NG
550 (modules '((guix build utils)))
551 (snippet
552 ;; Make sure we don't use the bundled software.
553 '(begin
554 (for-each
555 (lambda (subdir)
556 (let ((lib-subdir (string-append "src/third-party/" subdir)))
557 (delete-file-recursively lib-subdir)))
558 '("libpng" "lzma" "sqlite3" "zlib"))
559 #t))))
9af704c5
RH
560 (build-system cmake-build-system)
561 (arguments
562 `(#:tests? #f ;no "test" target
563 #:configure-flags
564 (list "-DUSE_LZMA=OFF" ;do not use bundled LZMA
6ea1c6fc 565 "-DUSE_LIBZIP=OFF"))) ;use "zlib" instead
1d0e8ec1
JK
566 (native-inputs `(("pkg-config" ,pkg-config)
567 ("qttools" ,qttools)))
9af704c5 568 (inputs `(("ffmpeg" ,ffmpeg)
9af704c5 569 ("libedit" ,libedit)
6dcac920 570 ("libelf" ,libelf)
9af704c5
RH
571 ("libepoxy" ,libepoxy)
572 ("libpng" ,libpng)
573 ("mesa" ,mesa)
574 ("minizip" ,minizip)
575 ("ncurses" ,ncurses)
576 ("qtbase" ,qtbase)
577 ("qtmultimedia" ,qtmultimedia)
9af704c5
RH
578 ("sdl2" ,sdl2)
579 ("sqlite" ,sqlite)
580 ("zlib" ,zlib)))
581 (home-page "https://mgba.io")
582 (synopsis "Game Boy Advance emulator")
583 (description
584 "mGBA is an emulator for running Game Boy Advance games. It aims to be
585faster and more accurate than many existing Game Boy Advance emulators, as
586well as adding features that other emulators lack. It also supports Game Boy
587and Game Boy Color games.")
1d0e8ec1
JK
588 ;; Code is mainly MPL 2.0. "blip_buf.c" is LGPL 2.1+, "inih.c" is
589 ;; BSD-3, and "discord-rpc" is Expat.
590 (license (list license:mpl2.0 license:lgpl2.1+ license:bsd-3 license:expat))))
9af704c5 591
c9e7acbf
JK
592(define-public sameboy
593 (package
594 (name "sameboy")
c9f01b73 595 (version "0.13.6")
c9e7acbf
JK
596 (source
597 (origin
598 (method git-fetch)
599 (uri (git-reference
b0e7b699 600 (url "https://github.com/LIJI32/SameBoy")
c9e7acbf
JK
601 (commit (string-append "v" version))))
602 (file-name (git-file-name name version))
603 (sha256
c9f01b73 604 (base32 "04w8lybi7ssnax37ka4qw7pmcm7cgnmk90p9m73zbyp5chgpqqzc"))))
c9e7acbf
JK
605 (build-system gnu-build-system)
606 (native-inputs
607 `(("rgbds" ,rgbds)
608 ("gcc" ,gcc-9)
609 ("pkg-config" ,pkg-config)))
610 (inputs
611 `(("sdl2" ,sdl2)))
612 (arguments
613 `(#:tests? #f ; There are no tests
f65adfa4 614 #:make-flags `("CC=gcc" "NATIVE_CC=gcc" "CONF=release"
c9e7acbf
JK
615 ,(string-append "DATA_DIR="
616 (assoc-ref %outputs "out")
617 "/share/sameboy/"))
618 #:phases
619 (modify-phases %standard-phases
620 (delete 'configure)
621 (replace 'install
622 (lambda* (#:key outputs #:allow-other-keys)
623 (let* ((out (assoc-ref outputs "out"))
624 (bin (string-append out "/bin"))
625 (data (string-append out "/share/sameboy/")))
626 (with-directory-excursion "build/bin/SDL"
627 (install-file "sameboy" bin)
628 (delete-file "sameboy")
1a4baf51
JK
629 (copy-recursively "." data))
630 #t))))))
c9e7acbf
JK
631 (home-page "https://sameboy.github.io/")
632 (synopsis "Accurate Game Boy, Game Boy Color and Super Game Boy emulator")
633 (description "SameBoy is a user friendly Game Boy, Game Boy Color
634and Super Game Boy emulator. SameBoy is accurate and includes a wide
635range of debugging features. It has all the features one would expect
636from an emulator---from save states to scaling filters.")
637 (license license:expat)))
638
9af704c5
RH
639(define-public mupen64plus-core
640 (package
641 (name "mupen64plus-core")
642 (version "2.5")
643 (source
644 (origin
10bcd4bb
TGR
645 (method git-fetch)
646 (uri (git-reference
b0e7b699 647 (url "https://github.com/mupen64plus/mupen64plus-core")
10bcd4bb
TGR
648 (commit version)))
649 (file-name (git-file-name name version))
9af704c5 650 (sha256
10bcd4bb 651 (base32 "116fndl6652zrp1r6ag4xv3dzp1x52mlvadj8xwflq07fd5rhri1"))))
9af704c5
RH
652 (build-system gnu-build-system)
653 (native-inputs
654 `(("pkg-config" ,pkg-config)
655 ("which" ,which)))
656 (inputs
657 `(("freetype" ,freetype)
658 ("glu" ,glu)
659 ("libpng" ,libpng)
660 ("mesa" ,mesa)
661 ("sdl2" ,sdl2)
662 ("zlib" ,zlib)))
663 (arguments
664 '(#:phases
665 (modify-phases %standard-phases
666 ;; The mupen64plus build system has no configure phase.
667 (delete 'configure)
668 ;; Makefile is in a subdirectory.
669 (add-before
eaa2b35c 670 'build 'chdir-to-project-directory
9af704c5 671 (lambda _
eaa2b35c
TGR
672 (chdir "projects/unix")
673 #t)))
9af704c5
RH
674 #:make-flags (let ((out (assoc-ref %outputs "out")))
675 (list "all" (string-append "PREFIX=" out)))
676 ;; There are no tests.
677 #:tests? #f))
678 ;; As per the Makefile (in projects/unix/Makefile):
679 (supported-systems '("i686-linux" "x86_64-linux"))
eaa2b35c 680 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
681 (synopsis "Nintendo 64 emulator core library")
682 (description
683 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
684which is capable of accurately playing many games. This package contains the
685core library.")
686 (license license:gpl2+)))
687
688(define-public mupen64plus-audio-sdl
689 (package
690 (name "mupen64plus-audio-sdl")
691 (version "2.5")
692 (source
693 (origin
8c6d45cb
TGR
694 (method git-fetch)
695 (uri (git-reference
b0e7b699 696 (url "https://github.com/mupen64plus/mupen64plus-audio-sdl")
8c6d45cb
TGR
697 (commit version)))
698 (file-name (git-file-name name version))
9af704c5 699 (sha256
8c6d45cb 700 (base32 "0z19amfg9vr2pqjjri1ipc7hs681fzjcnb0f9y7bjhp5n8d7p6bb"))))
9af704c5
RH
701 (build-system gnu-build-system)
702 (native-inputs
703 `(("pkg-config" ,pkg-config)
704 ("which" ,which)))
705 (inputs
706 `(("mupen64plus-core" ,mupen64plus-core)
707 ("sdl2" ,sdl2)))
708 (arguments
709 '(#:phases
710 (modify-phases %standard-phases
711 ;; The mupen64plus build system has no configure phase.
712 (delete 'configure)
713 ;; Makefile is in a subdirectory.
714 (add-before
715 'build 'cd-to-project-dir
716 (lambda _
717 (chdir "projects/unix"))))
718 #:make-flags
719 (let ((out (assoc-ref %outputs "out"))
720 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
721 (list "all"
722 (string-append "PREFIX=" out)
723 (string-append "APIDIR=" m64p "/include/mupen64plus")))
724 ;; There are no tests.
725 #:tests? #f))
cf5e9465 726 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
727 (synopsis "Mupen64Plus SDL input plugin")
728 (description
729 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
730which is capable of accurately playing many games. This package contains the
731SDL audio plugin.")
732 (license license:gpl2+)))
733
734(define-public mupen64plus-input-sdl
735 (package
736 (name "mupen64plus-input-sdl")
737 (version "2.5")
738 (source
739 (origin
ef5ef8f5
TGR
740 (method git-fetch)
741 (uri (git-reference
b0e7b699 742 (url "https://github.com/mupen64plus/mupen64plus-input-sdl")
ef5ef8f5
TGR
743 (commit version)))
744 (file-name (git-file-name name version))
9af704c5 745 (sha256
ef5ef8f5 746 (base32 "1dyazfbdjycdfslq8jixqiqhziw0rlkvach2r9dz91229jmkyc9c"))))
9af704c5
RH
747 (build-system gnu-build-system)
748 (native-inputs
749 `(("which" ,which)))
750 (inputs
751 `(("mupen64plus-core" ,mupen64plus-core)
752 ("sdl2" ,sdl2)))
753 (arguments
754 '(#:phases
755 (modify-phases %standard-phases
756 ;; The mupen64plus build system has no configure phase.
757 (delete 'configure)
758 ;; Makefile is in a subdirectory.
759 (add-before
760 'build 'cd-to-project-dir
761 (lambda _
762 (chdir "projects/unix"))))
763 #:make-flags
764 (let ((out (assoc-ref %outputs "out"))
765 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
766 (list "all"
767 (string-append "PREFIX=" out)
768 (string-append "APIDIR=" m64p "/include/mupen64plus")))
769 ;; There are no tests.
770 #:tests? #f))
d738ce16 771 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
772 (synopsis "Mupen64Plus SDL input plugin")
773 (description
774 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
775which is capable of accurately playing many games. This package contains the
776SDL input plugin.")
777 (license license:gpl2+)))
778
779(define-public mupen64plus-rsp-hle
780 (package
781 (name "mupen64plus-rsp-hle")
782 (version "2.5")
783 (source
784 (origin
c4f0c8ba
TGR
785 (method git-fetch)
786 (uri (git-reference
b0e7b699 787 (url "https://github.com/mupen64plus/mupen64plus-rsp-hle")
c4f0c8ba
TGR
788 (commit version)))
789 (file-name (git-file-name name version))
9af704c5 790 (sha256
c4f0c8ba 791 (base32 "0pi31qzjjp7aypdvvnz6ms18g09c4gqzxi6328zj8sji94b75gf0"))))
9af704c5
RH
792 (build-system gnu-build-system)
793 (inputs
794 `(("mupen64plus-core" ,mupen64plus-core)))
795 (arguments
796 '(#:phases
797 (modify-phases %standard-phases
798 ;; The mupen64plus build system has no configure phase.
799 (delete 'configure)
800 ;; Makefile is in a subdirectory.
801 (add-before
802 'build 'cd-to-project-dir
803 (lambda _
804 (chdir "projects/unix"))))
805 #:make-flags
806 (let ((out (assoc-ref %outputs "out"))
807 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
808 (list "all"
809 (string-append "PREFIX=" out)
810 (string-append "APIDIR=" m64p "/include/mupen64plus")))
811 ;; There are no tests.
812 #:tests? #f))
cf396ea5 813 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
814 (synopsis "Mupen64Plus SDL input plugin")
815 (description
816 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
817which is capable of accurately playing many games. This package contains the
818high-level emulation (HLE) RSP processor plugin.")
819 (license license:gpl2+)))
820
821(define-public mupen64plus-rsp-z64
822 (package
823 (name "mupen64plus-rsp-z64")
824 (version "2.0.0")
825 (source
826 (origin
052650c8
TGR
827 (method git-fetch)
828 (uri (git-reference
b0e7b699 829 (url "https://github.com/mupen64plus/mupen64plus-rsp-z64")
052650c8
TGR
830 (commit version)))
831 (file-name (git-file-name name version))
9af704c5 832 (sha256
052650c8 833 (base32 "0nfyjns9k8xbg3aqs7593nfaxvlj72h3l8h467442xlk8ajfcylx"))))
9af704c5
RH
834 (build-system gnu-build-system)
835 (inputs
836 `(("mupen64plus-core" ,mupen64plus-core)))
837 (arguments
838 '(#:phases
839 (modify-phases %standard-phases
840 ;; The mupen64plus build system has no configure phase.
841 (delete 'configure)
842 ;; Makefile is in a subdirectory.
843 (add-before
844 'build 'cd-to-project-dir
845 (lambda _
846 (chdir "projects/unix"))))
847 #:make-flags
848 (let ((out (assoc-ref %outputs "out"))
849 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
850 (list "all"
851 (string-append "PREFIX=" out)
852 (string-append "APIDIR=" m64p "/include/mupen64plus")))
853 ;; There are no tests.
854 #:tests? #f))
24b03073 855 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
856 (synopsis "Mupen64Plus SDL input plugin")
857 (description
858 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
859which is capable of accurately playing many games. This package contains the
860Z64 RSP processor plugin.")
861 (license license:gpl2+)))
862
863(define-public mupen64plus-video-arachnoid
864 (package
865 (name "mupen64plus-video-arachnoid")
866 (version "2.0.0")
867 (source
868 (origin
2074c8bf
TGR
869 (method git-fetch)
870 (uri (git-reference
b0e7b699 871 (url "https://github.com/mupen64plus/mupen64plus-video-arachnoid")
2074c8bf
TGR
872 (commit version)))
873 (file-name (git-file-name name version))
9af704c5 874 (sha256
2074c8bf 875 (base32 "1v9fqwpb6pawr8z5cm2ki7bqkks4iyr5c4jy4v5khj6h8zcv55gc"))))
9af704c5
RH
876 (build-system gnu-build-system)
877 (native-inputs
878 `(("pkg-config" ,pkg-config)
879 ("which" ,which)))
880 (inputs
881 `(("mesa" ,mesa)
882 ("mupen64plus-core" ,mupen64plus-core)))
883 (arguments
884 '(#:phases
885 (modify-phases %standard-phases
886 ;; The mupen64plus build system has no configure phase.
887 (delete 'configure)
888 ;; Makefile is in a subdirectory.
889 (add-before
890 'build 'cd-to-project-dir
891 (lambda _
892 (chdir "projects/unix"))))
893 #:make-flags
894 (let ((out (assoc-ref %outputs "out"))
895 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
896 (list "all"
897 (string-append "PREFIX=" out)
898 (string-append "APIDIR=" m64p "/include/mupen64plus")))
899 ;; There are no tests.
900 #:tests? #f))
5daa2019 901 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
902 (synopsis "Mupen64Plus Rice Video plugin")
903 (description
904 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
905which is capable of accurately playing many games. This package contains the
906Arachnoid video plugin.")
907 (license license:gpl2+)))
908
909(define-public mupen64plus-video-glide64
910 (package
911 (name "mupen64plus-video-glide64")
912 (version "2.0.0")
913 (source
914 (origin
62536186
TGR
915 (method git-fetch)
916 (uri (git-reference
b0e7b699 917 (url "https://github.com/mupen64plus/mupen64plus-video-glide64")
62536186
TGR
918 (commit version)))
919 (file-name (git-file-name name version))
9af704c5 920 (sha256
62536186 921 (base32 "0qn5za7g7796kh2ag3xpmhbqg0yf71g9liz6ks0rha8pz73lgs01"))))
9af704c5
RH
922 (build-system gnu-build-system)
923 (native-inputs
924 `(("pkg-config" ,pkg-config)
925 ("which" ,which)))
926 (inputs
927 `(("mesa" ,mesa)
928 ("mupen64plus-core" ,mupen64plus-core)
929 ("sdl2" ,sdl2)))
930 (arguments
931 '(#:phases
932 (modify-phases %standard-phases
933 ;; The mupen64plus build system has no configure phase.
934 (delete 'configure)
935 ;; Makefile is in a subdirectory.
936 (add-before
937 'build 'cd-to-project-dir
938 (lambda _
939 (chdir "projects/unix")))
940 ;; XXX Should be unnecessary with the next release.
941 (add-before
942 'build 'use-sdl2
943 (lambda _
944 (substitute* "Makefile"
945 (("SDL_CONFIG = (.*)sdl-config" all prefix)
946 (string-append "SDL_CONFIG = " prefix "sdl2-config"))))))
947 #:make-flags
948 (let ((out (assoc-ref %outputs "out"))
949 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
950 (list "all"
951 (string-append "PREFIX=" out)
952 (string-append "APIDIR=" m64p "/include/mupen64plus")))
953 ;; There are no tests.
954 #:tests? #f))
d1e63866 955 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
956 (synopsis "Mupen64Plus Rice Video plugin")
957 (description
958 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
959which is capable of accurately playing many games. This package contains the
960Glide64 video plugin.")
961 (license license:gpl2+)))
962
963(define-public mupen64plus-video-glide64mk2
964 (package
965 (name "mupen64plus-video-glide64mk2")
966 (version "2.5")
967 (source
968 (origin
e5e7a167
TGR
969 (method git-fetch)
970 (uri (git-reference
b0e7b699 971 (url "https://github.com/mupen64plus/mupen64plus-video-glide64mk2")
e5e7a167
TGR
972 (commit version)))
973 (file-name (git-file-name name version))
9af704c5 974 (sha256
e5e7a167 975 (base32 "08pm28a36dpr0cvr8pzw0n5ksdazp7jqvlmqfy2lwb4dm0cwhkqd"))))
9af704c5
RH
976 (build-system gnu-build-system)
977 (native-inputs
978 `(("pkg-config" ,pkg-config)
979 ("which" ,which)))
980 (inputs
981 `(("boost" ,boost)
982 ("libpng" ,libpng)
983 ("mesa" ,mesa)
984 ("mupen64plus-core" ,mupen64plus-core)
985 ("sdl2" ,sdl2)
986 ("zlib" ,zlib)))
987 (arguments
988 '(#:phases
989 (modify-phases %standard-phases
990 ;; The mupen64plus build system has no configure phase.
991 (delete 'configure)
992 ;; Makefile is in a subdirectory.
993 (add-before
994 'build 'cd-to-project-dir
995 (lambda _
996 (chdir "projects/unix"))))
997 #:make-flags
998 (let ((out (assoc-ref %outputs "out"))
999 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1000 (list "all"
1001 (string-append "PREFIX=" out)
1002 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1003 ;; There are no tests.
1004 #:tests? #f))
84532c2b 1005 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
1006 (synopsis "Mupen64Plus Rice Video plugin")
1007 (description
1008 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1009which is capable of accurately playing many games. This package contains the
1010Glide64MK2 video plugin.")
1011 (license license:gpl2+)))
1012
1013(define-public mupen64plus-video-rice
1014 (package
1015 (name "mupen64plus-video-rice")
1016 (version "2.5")
1017 (source
1018 (origin
d42d0a0b
TGR
1019 (method git-fetch)
1020 (uri (git-reference
b0e7b699 1021 (url "https://github.com/mupen64plus/mupen64plus-video-rice")
d42d0a0b
TGR
1022 (commit version)))
1023 (file-name (git-file-name name version))
9af704c5 1024 (sha256
d42d0a0b 1025 (base32 "0rpmbcq67gsj5h5jjis146378qc1mskskvx20y1ikx59yhbamh13"))))
9af704c5
RH
1026 (build-system gnu-build-system)
1027 (native-inputs
1028 `(("pkg-config" ,pkg-config)
1029 ("which" ,which)))
1030 (inputs
1031 `(("libpng" ,libpng)
1032 ("mesa" ,mesa)
1033 ("mupen64plus-core" ,mupen64plus-core)
1034 ("sdl2" ,sdl2)))
1035 (arguments
1036 '(#:phases
1037 (modify-phases %standard-phases
1038 ;; The mupen64plus build system has no configure phase.
1039 (delete 'configure)
1040 ;; Makefile is in a subdirectory.
1041 (add-before
1042 'build 'cd-to-project-dir
1043 (lambda _
1044 (chdir "projects/unix"))))
1045 #:make-flags
1046 (let ((out (assoc-ref %outputs "out"))
1047 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1048 (list "all"
1049 (string-append "PREFIX=" out)
1050 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1051 ;; There are no tests.
1052 #:tests? #f))
b21acd21 1053 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
1054 (synopsis "Mupen64Plus Rice Video plugin")
1055 (description
1056 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1057which is capable of accurately playing many games. This package contains the
1058Rice Video plugin.")
1059 (license license:gpl2+)))
1060
1061(define-public mupen64plus-video-z64
1062 (package
1063 (name "mupen64plus-video-z64")
1064 (version "2.0.0")
1065 (source
1066 (origin
85baeb20
TGR
1067 (method git-fetch)
1068 (uri (git-reference
b0e7b699 1069 (url "https://github.com/mupen64plus/mupen64plus-video-z64")
85baeb20
TGR
1070 (commit version)))
1071 (file-name (git-file-name name version))
9af704c5 1072 (sha256
85baeb20 1073 (base32 "04qa2fdd6dakpk2v0d4l80xh9b4h8gm71g80c0wyyxdhmhwk1r9c"))
fdb61400 1074 (patches (search-patches "mupen64plus-video-z64-glew-correct-path.patch"))))
9af704c5
RH
1075 (build-system gnu-build-system)
1076 (native-inputs
1077 `(("pkg-config" ,pkg-config)
1078 ("which" ,which)))
1079 (inputs
1080 `(("glew" ,glew)
1081 ("mupen64plus-core" ,mupen64plus-core)
1082 ("sdl2" ,sdl2)))
1083 (arguments
1084 '(#:phases
1085 (modify-phases %standard-phases
1086 ;; The mupen64plus build system has no configure phase.
1087 (delete 'configure)
1088 ;; Makefile is in a subdirectory.
1089 (add-before
1090 'build 'cd-to-project-dir
1091 (lambda _
1092 (chdir "projects/unix")))
1093 ;; XXX Should be unnecessary with the next release.
1094 (add-before
1095 'build 'use-sdl2
1096 (lambda _
1097 (substitute* "Makefile"
1098 (("SDL_CONFIG = (.*)sdl-config" all prefix)
1099 (string-append "SDL_CONFIG = " prefix "sdl2-config"))))))
1100 #:make-flags
1101 (let ((out (assoc-ref %outputs "out"))
1102 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1103 (list "all"
1104 (string-append "PREFIX=" out)
1105 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1106 ;; There are no tests.
1107 #:tests? #f))
26daadb9 1108 (home-page "https://www.mupen64plus.org/")
9af704c5
RH
1109 (synopsis "Mupen64Plus Z64 video plugin")
1110 (description
1111 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1112which is capable of accurately playing many games. This package contains the
1113Z64 video plugin.")
1114 (license license:gpl2+)))
1115
1116(define-public mupen64plus-ui-console
1117 (package
1118 (name "mupen64plus-ui-console")
1119 (version "2.5")
1120 (source
1121 (origin
225157a0
TGR
1122 (method git-fetch)
1123 (uri (git-reference
b0e7b699 1124 (url "https://github.com/mupen64plus/mupen64plus-ui-console")
225157a0
TGR
1125 (commit version)))
1126 (file-name (git-file-name name version))
9af704c5 1127 (sha256
225157a0 1128 (base32 "0vrf98qa6a0y3647kslsv644fag233dxh5dcr1yncjiiwickcr5a"))
9af704c5
RH
1129 (patches (search-patches "mupen64plus-ui-console-notice.patch"))))
1130 (build-system gnu-build-system)
1131 (native-inputs
1132 `(("pkg-config" ,pkg-config)
1133 ("which" ,which)))
1134 (inputs
1135 `(("sdl2" ,sdl2)))
1136 ;; Mupen64Plus supports a single data directory and a single plugin
1137 ;; directory in its configuration, yet we need data and plugin files from
1138 ;; a variety of packages. The best way to deal with this is to install
1139 ;; all packages from which data and plugin files are needed into one's
1140 ;; profile, and point the configuration there. Hence, propagate the most
1141 ;; important packages here to save the user from the bother. The patch
1142 ;; mupen64plus-ui-console-notice also gives users instructions on what
1143 ;; they need to do in order to point the configuration to their profile.
1144 (propagated-inputs
1145 `(("mupen64plus-core" ,mupen64plus-core)
1146 ("mupen64plus-audio-sdl" ,mupen64plus-audio-sdl)
1147 ("mupen64plus-input-sdl" ,mupen64plus-input-sdl)
1148 ("mupen64plus-rsp-hle" ,mupen64plus-rsp-hle)
1149 ("mupen64plus-video-glide64" ,mupen64plus-video-glide64)
1150 ("mupen64plus-video-glide64mk2" ,mupen64plus-video-glide64mk2)
1151 ("mupen64plus-video-rice" ,mupen64plus-video-rice)))
1152 (arguments
1153 '(#:phases
1154 (modify-phases %standard-phases
1155 ;; The mupen64plus build system has no configure phase.
1156 (delete 'configure)
1157 ;; Makefile is in a subdirectory.
1158 (add-before
1159 'build 'cd-to-project-dir
1160 (lambda _
1161 (chdir "projects/unix"))))
1162 #:make-flags
1163 (let ((out (assoc-ref %outputs "out"))
1164 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1165 (list "all"
1166 (string-append "PREFIX=" out)
1167 (string-append "APIDIR=" m64p "/include/mupen64plus")
1168 ;; Trailing slash matters here.
1169 (string-append "COREDIR=" m64p "/lib/")))
1170 ;; There are no tests.
1171 #:tests? #f))
e8079ba4 1172 (home-page "https://www.mupen64plus.org/")
ff452bea 1173 (synopsis "Mupen64Plus command line user interface")
9af704c5
RH
1174 (description
1175 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1176which is capable of accurately playing many games. This package contains the
1177command line user interface. Installing this package is the easiest way
1178towards a working Mupen64Plus for casual users.")
1179 (license license:gpl2+)))
1180
1181(define-public nestopia-ue
1182 (package
1183 (name "nestopia-ue")
9d39c300 1184 (version "1.48")
3e461b71
TGR
1185 (source
1186 (origin
1187 (method git-fetch)
1188 (uri (git-reference
b0e7b699 1189 (url "https://github.com/rdanbrook/nestopia")
3e461b71
TGR
1190 (commit version)))
1191 (file-name (git-file-name name version))
1192 (sha256
1193 (base32 "19c8vx5yxbysl0sszk5blfngwacshdgwbf44g1qaxvq8ywiyxmb4"))
1194 (modules '((guix build utils)))
1195 (snippet
1196 '(begin
1197 ;; We don't need libretro for the GNU/Linux build.
1198 (delete-file-recursively "libretro")
1199 #t))))
9d39c300 1200 (build-system cmake-build-system)
9af704c5
RH
1201 (native-inputs
1202 `(("pkg-config" ,pkg-config)))
1203 (inputs
1204 `(("ao" ,ao)
9af704c5
RH
1205 ("gtk+" ,gtk+)
1206 ("libarchive" ,libarchive)
9d39c300 1207 ("libepoxy" ,libepoxy)
9af704c5
RH
1208 ("sdl2" ,sdl2)
1209 ("zlib" ,zlib)))
1210 (arguments
1211 '(#:phases
1212 (modify-phases %standard-phases
9d39c300
KK
1213 ;; This fixes the file chooser crash that happens with GTK 3.
1214 (add-after 'install 'wrap-program
1215 (lambda* (#:key inputs outputs #:allow-other-keys)
1216 (let* ((out (assoc-ref outputs "out"))
1217 (nestopia (string-append out "/bin/nestopia"))
1218 (gtk (assoc-ref inputs "gtk+"))
1219 (gtk-share (string-append gtk "/share")))
1220 (wrap-program nestopia
1221 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))))))
9af704c5
RH
1222 ;; There are no tests.
1223 #:tests? #f))
1224 (home-page "http://0ldsk00l.ca/nestopia/")
1225 (synopsis "Nintendo Entertainment System (NES/Famicom) emulator")
1226 (description
1227 "Nestopia UE (Undead Edition) is a fork of the Nintendo Entertainment
1228System (NES/Famicom) emulator Nestopia, with enhancements from members of the
1229emulation community. It provides highly accurate emulation.")
1230 (license license:gpl2+)))
1231
1232(define-public retroarch
1233 (package
1234 (name "retroarch")
bd671624 1235 (version "1.8.1")
9af704c5
RH
1236 (source
1237 (origin
1fc346de
TGR
1238 (method git-fetch)
1239 (uri (git-reference
b0e7b699 1240 (url "https://github.com/libretro/RetroArch")
1fc346de
TGR
1241 (commit (string-append "v" version))))
1242 (file-name (git-file-name name version))
9af704c5 1243 (sha256
77549754
TGR
1244 (base32 "0y7rcpz7psf8k3agsrq277jdm651vbnn9xpqvmj2in1a786idya7"))
1245 (patches
1246 (search-patches "retroarch-disable-online-updater.patch"))
1247 (modules '((guix build utils)))
1248 (snippet
1249 '(begin
1250 ;; Don't suggest using the Online Updater if available: it never
1251 ;; is. This disables translation of this particular message.
1252 (substitute* (find-files "menu/drivers" "\\.c$")
1253 (("msg_hash_to_str\\(MSG_MISSING_ASSETS\\)")
1254 "\"Warning: Missing assets, go get some\""))
1255 #t))))
9af704c5
RH
1256 (build-system gnu-build-system)
1257 (arguments
f21967a4 1258 `(#:tests? #f ; no tests
9af704c5
RH
1259 #:phases
1260 (modify-phases %standard-phases
1261 (replace 'configure
1262 (lambda* (#:key inputs outputs #:allow-other-keys)
1263 (let* ((out (assoc-ref outputs "out"))
1264 (etc (string-append out "/etc"))
12a3abc6
RH
1265 (vulkan (assoc-ref inputs "vulkan-loader"))
1266 (wayland-protocols (assoc-ref inputs "wayland-protocols")))
77549754 1267 ;; Hard-code some store file names.
9af704c5
RH
1268 (substitute* "gfx/common/vulkan_common.c"
1269 (("libvulkan.so") (string-append vulkan "/lib/libvulkan.so")))
12a3abc6
RH
1270 (substitute* "gfx/common/wayland/generate_wayland_protos.sh"
1271 (("/usr/local/share/wayland-protocols")
1272 (string-append wayland-protocols "/share/wayland-protocols")))
9af704c5
RH
1273 (substitute* "qb/qb.libs.sh"
1274 (("/bin/true") (which "true")))
77549754 1275
fade67ab
EF
1276 ;; Use shared zlib.
1277 (substitute* '("libretro-common/file/archive_file_zlib.c"
e85bb00c 1278 "libretro-common/streams/trans_stream_zlib.c")
fade67ab 1279 (("<compat/zlib.h>") "<zlib.h>"))
77549754 1280
9af704c5
RH
1281 ;; The configure script does not yet accept the extra arguments
1282 ;; (like ‘CONFIG_SHELL=’) passed by the default configure phase.
f21967a4
EF
1283 (invoke
1284 "./configure"
1285 ,@(if (string-prefix? "armhf" (or (%current-target-system)
1286 (%current-system)))
1287 '("--enable-neon" "--enable-floathard")
1288 '())
1289 (string-append "--prefix=" out)
73dd0654
TGR
1290 (string-append "--global-config-dir=" etc)
1291 "--disable-builtinminiupnpc")))))))
9af704c5
RH
1292 (inputs
1293 `(("alsa-lib" ,alsa-lib)
1294 ("ffmpeg" ,ffmpeg)
1295 ("freetype" ,freetype)
1296 ("libxinerama" ,libxinerama)
1297 ("libxkbcommon" ,libxkbcommon)
1298 ("libxml2" ,libxml2)
45267af1 1299 ("libxrandr" ,libxrandr)
9af704c5
RH
1300 ("libxv" ,libxv)
1301 ("mesa" ,mesa)
73dd0654 1302 ("miniupnpc" ,miniupnpc)
9af704c5
RH
1303 ("openal" ,openal)
1304 ("pulseaudio" ,pulseaudio)
1305 ("python" ,python)
76b7d8fd 1306 ("qtbase" ,qtbase)
9af704c5
RH
1307 ("sdl" ,sdl2)
1308 ("udev" ,eudev)
e6fcf903 1309 ("vulkan-loader" ,vulkan-loader)
c695fb76 1310 ("wayland" ,wayland)
9af704c5
RH
1311 ("zlib" ,zlib)))
1312 (native-inputs
1313 `(("pkg-config" ,pkg-config)
12a3abc6 1314 ("wayland-protocols" ,wayland-protocols)
9af704c5
RH
1315 ("which" ,which)))
1316 (home-page "https://www.libretro.com/")
1317 (synopsis "Reference frontend for the libretro API")
1318 (description
1319 "Libretro is a simple but powerful development interface that allows for
1320the easy creation of emulators, games and multimedia applications that can plug
1321straight into any libretro-compatible frontend. RetroArch is the official
1322reference frontend for the libretro API, currently used by most as a modular
1323multi-system game/emulator system.")
1324 (license license:gpl3+)))
4c40ed9d
NG
1325
1326(define-public scummvm
1327 (package
1328 (name "scummvm")
63d69215 1329 (version "2.2.0")
4c40ed9d
NG
1330 (source
1331 (origin
1332 (method url-fetch)
1333 (uri (string-append "http://www.scummvm.org/frs/scummvm/" version
1334 "/scummvm-" version ".tar.xz"))
1335 (sha256
63d69215 1336 (base32 "11vknasm5dna2vqr6gk343qynh7nhsq3kf60zayarn1vb5z6as8l"))))
4c40ed9d
NG
1337 (build-system gnu-build-system)
1338 (arguments
6177b14b 1339 `(#:tests? #f ;require "git"
4c40ed9d
NG
1340 #:configure-flags (list "--enable-release") ;for optimizations
1341 #:phases
1342 (modify-phases %standard-phases
1343 (replace 'configure
1344 ;; configure does not work followed by both "SHELL=..." and
1345 ;; "CONFIG_SHELL=..."; set environment variables instead
1346 (lambda* (#:key outputs configure-flags #:allow-other-keys)
1347 (let* ((out (assoc-ref outputs "out"))
1348 (bash (which "bash"))
1349 (flags `(,(string-append "--prefix=" out)
1350 ,@configure-flags)))
1351 (setenv "SHELL" bash)
1352 (setenv "CONFIG_SHELL" bash)
1353 (apply invoke "./configure" flags)))))))
1354 (native-inputs
64e9d128
NG
1355 `(("nasm" ,nasm)
1356 ("pkg-config" ,pkg-config)))
4c40ed9d
NG
1357 (inputs
1358 `(("alsa-lib" ,alsa-lib)
1359 ("faad2" ,faad2)
1360 ("fluidsynth" ,fluidsynth)
1361 ("freetype" ,freetype)
63d69215 1362 ("fribidi" ,fribidi)
6177b14b 1363 ("liba52" ,liba52)
4c40ed9d
NG
1364 ("libflac" ,flac)
1365 ("libjpeg-turbo" ,libjpeg-turbo)
1366 ("libmad" ,libmad)
1367 ("libmpeg2" ,libmpeg2)
1368 ("libogg" ,libogg)
1369 ("libpng" ,libpng)
1370 ("libtheora" ,libtheora)
1371 ("libvorbis" ,libvorbis)
6177b14b 1372 ("sdl2" ,(sdl-union (list sdl2 sdl2-net)))
4c40ed9d
NG
1373 ("zlib" ,zlib)))
1374 (home-page "https://www.scummvm.org/")
1375 (synopsis "Engine for several graphical adventure games")
1376 (description "ScummVM is a program which allows you to run certain
1377classic graphical point-and-click adventure games, provided you
1378already have their data files. The clever part about this: ScummVM
1379just replaces the executables shipped with the games, allowing you to
1380play them on systems for which they were never designed!")
1381 (license license:gpl2+)))
c8b2fd28
NG
1382
1383(define-public mame
1384 (package
1385 (name "mame")
50c69eb6 1386 (version "0.226")
c8b2fd28
NG
1387 (source
1388 (origin
1389 (method git-fetch)
1390 (uri (git-reference
b0e7b699 1391 (url "https://github.com/mamedev/mame")
c8b2fd28
NG
1392 (commit (apply string-append "mame" (string-split version #\.)))))
1393 (file-name (git-file-name name version))
1394 (sha256
50c69eb6 1395 (base32 "1yfns42rk1l0qprj5ksj9fqsgqpa23xnzxf29r4434p4n18bb77v"))
c8b2fd28
NG
1396 (modules '((guix build utils)))
1397 (snippet
1398 ;; Remove bundled libraries.
1399 '(begin
1400 (with-directory-excursion "3rdparty"
1401 (for-each delete-file-recursively
1402 '("asio" "expat" "glm" "libflac" "libjpeg" "lua"
1403 "portaudio" "portmidi" "pugixml" "rapidjson" "SDL2"
1404 "SDL2-override" "sqlite3" "utf8proc" "zlib")))
1405 #t))))
1406 (build-system gnu-build-system)
1407 (arguments
1408 `(#:make-flags
1409 (cons*
430e1528
NG
1410 ;; A 'strict-overflow' error pops up on i686 so disable '-Werror'.
1411 "NOWERROR=1"
c8b2fd28
NG
1412 (string-append "QT_HOME=" (assoc-ref %build-inputs "qtbase"))
1413 (string-append "SDL_INI_PATH="
1414 (assoc-ref %outputs "out")
1415 "/share/mame/ini")
1416 (map (lambda (lib)
1417 (string-append "USE_SYSTEM_LIB_" (string-upcase lib) "=1"))
1418 '("asio" "expat" "flac" "glm" "jpeg" "lua" "portaudio" "portmidi"
1419 "pugixml" "rapidjson" "sqlite3" "utf8proc" "zlib")))
1420 #:tests? #f ;no test in regular release
1421 #:phases
1422 (modify-phases %standard-phases
1423 (delete 'configure)
1424 (add-after 'build 'build-documentation
1425 (lambda _ (invoke "make" "-C" "docs" "man" "info")))
1426 (replace 'install
1427 ;; Upstream does not provide an installation phase.
1428 (lambda* (#:key outputs #:allow-other-keys)
1429 (let* ((out (assoc-ref outputs "out"))
1430 (share (string-append out "/share/mame")))
1431 ;; Install data.
1432 (for-each (lambda (dir)
1433 (copy-recursively dir (string-append share "/" dir)))
1434 '("artwork" "bgfx" "ctrlr" "hash" "ini" "language"
1435 "plugins" "samples"))
1436 (let ((keymaps (string-append share "/keymaps")))
1437 (for-each (lambda (file) (install-file file keymaps))
1438 (find-files "keymaps" ".*LINUX\\.map")))
1439 (let ((fonts (string-append share "/fonts")))
1440 (install-file "uismall.bdf" fonts))
6921e95a
EF
1441 (when (file-exists? "mame64")
1442 (rename-file "mame64" "mame"))
c8b2fd28
NG
1443 (install-file "mame" (string-append out "/bin")))
1444 #t))
1445 (add-after 'install 'install-documentation
1446 (lambda* (#:key outputs #:allow-other-keys)
1447 (let* ((out (assoc-ref outputs "out"))
1448 (man (string-append out "/share/man/man1"))
1449 (info (string-append out "/share/info")))
1450 (install-file "docs/build/man/MAME.1" man)
1451 (install-file "docs/build/texinfo/MAME.info" info))
1452 #t))
1453 (add-after 'install 'install-ini-file
1454 ;; Generate an ini file so as to set some directories (e.g., roms)
1455 ;; to a writable location, i.e., "$HOME/.mame/" and "$HOME/mame/".
1456 ;;
1457 ;; XXX: We need to insert absolute references to the store. It can
1458 ;; be an issue if they leak into user's home directory, e.g., with
1459 ;; "mame -createconfig" and the package is later GC'ed.
1460 (lambda* (#:key outputs #:allow-other-keys)
1461 (let* ((out (assoc-ref outputs "out"))
1462 (share (string-append out "/share/mame"))
1463 (ini (string-append share "/ini")))
1464 (with-output-to-file (string-append ini "/mame.ini")
1465 (lambda _
1466 (format #t
1467 "inipath $HOME/.mame;~a/ini~@
1468 homepath $HOME/mame~@
1469 rompath $HOME/mame/roms~@
1470 samplepath $HOME/mame/samples;~a/samples~@
1471 cheatpath $HOME/mame/cheat~@
1472 artpath $HOME/mame/artwork;~a/artwork~@
1473 crosshairpath $HOME/mame/crosshair~@
1474 snapshot_directory $HOME/mame/snapshots~@
1475 hashpath ~a/hash~@
1476 fontpath $HOME/mame/fonts;~a/fonts~@
1477 ctrlrpath $HOME/mame/ctrlr;~a/ctrlr~@
1478 bgfx_path ~a/bgfx~@
1479 pluginspath $HOME/mame/plugins;~a/plugins~@
1480 languagepath ~a/language~@
1481 cfg_directory $HOME/.mame/cfg~@
1482 nvram_directory $HOME/.mame/nvram~@
1483 input_directory $HOME/.mame/inp~@
1484 state_directory $HOME/.mame/sta~@
1485 diff_directory $HOME/.mame/diff~@
1486 comment_directory $HOME/.mame/comments~%"
1487 share share share share share share share share
1488 share)))
1489 (with-output-to-file (string-append ini "/ui.ini")
1490 (lambda _
1491 (format #t
1492 "historypath $HOME/mame/history~@
1493 categorypath $HOME/mame/folders~@
1494 cabinets_directory $HOME/mame/cabinets~@
1495 cpanels_directory $HOME/mame/cpanel~@
1496 pcbs_directory $HOME/mame/pcb~@
1497 flyers_directory $HOME/mame/flyers~@
1498 titles_directory $HOME/mame/titles~@
1499 ends_directory $HOME/mame/ends~@
1500 marquees_directory $HOME/mame/marquees~@
1501 artwork_preview_directory $HOME/mame/artpreview~@
1502 bosses_directory $HOME/mame/bosses~@
1503 logos_directory $HOME/mame/logo~@
1504 scores_directory $HOME/mame/scores~@
1505 versus_directory $HOME/mame/versus~@
1506 gameover_directory $HOME/mame/gameover~@
1507 howto_directory $HOME/mame/howto~@
1508 select_directory $HOME/mame/select~@
1509 icons_directory $HOME/mame/icons~@
1510 covers_directory $HOME/mame/covers~@
1511 ui_path $HOME/.mame/ui~%")))
1512 #t)))
1513 (add-after 'install 'install-desktop-file
1514 (lambda* (#:key outputs #:allow-other-keys)
1515 (let* ((out (assoc-ref outputs "out"))
1516 (desktop (string-append out "/share/applications"))
1517 (executable (string-append out "/bin/mame")))
1518 (mkdir-p desktop)
1519 (with-output-to-file (string-append desktop "/mame.desktop")
1520 (lambda _
1521 (format #t
1522 "[Desktop Entry]~@
1523 Name=mame~@
1524 Comment=Multi-purpose emulation framework~@
1525 Exec=~a~@
1526 TryExec=~@*~a~@
1527 Terminal=false~@
1528 Type=Application~@
1529 Categories=Game;Emulator;~@
1530 Keywords=Game;Emulator;Arcade;~%"
1531 executable)))
1532 #t))))))
1533 (native-inputs
1534 `(("pkg-config" ,pkg-config)
03370346
NG
1535 ("sphinx" ,python-sphinx)
1536 ("sphinxcontrib-svg2pdfconverter" ,python-sphinxcontrib-svg2pdfconverter)
c8b2fd28
NG
1537 ("texinfo" ,texinfo)))
1538 (inputs
1539 `(("alsa-lib" ,alsa-lib)
1540 ("asio" ,asio)
1541 ("expat" ,expat)
1542 ("flac" ,flac)
1543 ("fontconfig" ,fontconfig)
1544 ("glm" ,glm)
7b24b76b 1545 ("libjpeg" ,libjpeg-turbo)
9f0650df 1546 ("libxi" ,libxi)
c8b2fd28
NG
1547 ("libxinerama" ,libxinerama)
1548 ("lua" ,lua)
1549 ("portaudio" ,portaudio)
1550 ("portmidi" ,portmidi)
63247277 1551 ("pugixml" ,pugixml)
c8b2fd28
NG
1552 ("python-wrapper" ,python-wrapper)
1553 ("qtbase" ,qtbase)
1554 ("rapidjson" ,rapidjson)
1555 ("sdl" ,(sdl-union (list sdl2 sdl2-ttf)))
1556 ("sqlite" ,sqlite)
1557 ("utf8proc" ,utf8proc)
1558 ("zlib" ,zlib)))
cf580e5e 1559 (home-page "https://www.mamedev.org")
c8b2fd28
NG
1560 (synopsis "Multi-purpose emulation framework")
1561 (description "MAME's purpose is to preserve decades of software
1562history. As electronic technology continues to rush forward, MAME
1563prevents this important @emph{vintage} software from being lost and
1564forgotten. This is achieved by documenting the hardware and how it
1565functions. The source code to MAME serves as this documentation.")
1566 ;; The MAME project as a whole is distributed under the terms of GPL2+.
1567 ;; However, over 90% of the files are under Expat license. Also, artwork,
1568 ;; keymaps, languages and samples are under CC0.
1569 (license (list license:gpl2+ license:expat license:cc0))))
1403e1f7 1570
08d34100
PN
1571(define-public gnome-arcade
1572 (package
1573 (name "gnome-arcade")
1574 (version "0.218.2")
1575 (source
1576 (origin
1577 (method git-fetch)
1578 (uri (git-reference
1579 (url "https://github.com/strippato/gnome-arcade")
1580 (commit (string-append "v." version))))
1581 (file-name (git-file-name name version))
1582 (sha256
1583 (base32
1584 "1qc01a62p65qb6mwjfmxqsd6n3rglsfwrjhsp25nr7q54107n55l"))))
1585 (build-system cmake-build-system)
1586 (arguments
1587 `(#:tests? #f ; No tests.
1588 #:configure-flags (list
1589 (string-append "-DMAME_BIN=\""
1590 (assoc-ref %build-inputs "mame")
1591 "/bin/mame\"")
1592 (string-append "-DAPP_RES=\""
1593 (assoc-ref %outputs "out")
1594 "/share/gnome-arcade/\""))
1595 #:phases
1596 (modify-phases %standard-phases
1597 (add-before 'build 'fix-paths
1598 (lambda* (#:key outputs #:allow-other-keys)
1599 (let ((out (assoc-ref outputs "out")))
1600 (pk 'cwd (getcwd))
1601 (substitute* "../source/src/config.c"
1602 (("/usr/share") (string-append out "/share"))))
1603 #t))
1604 (replace 'install
1605 (lambda* (#:key outputs #:allow-other-keys)
1606 (let* ((out (assoc-ref outputs "out"))
1607 (bin (string-append out "/bin"))
1608 (rom (string-append out "/share/gnome-arcade/data/rom"))
1609 (tile (string-append out "/share/gnome-arcade/data/tile")))
1610 (mkdir-p bin)
1611 (install-file "../gnome-arcade" bin)
1612 (copy-recursively "../source/res"
1613 (string-append out "/share/gnome-arcade/res"))
1614 (mkdir-p rom)
1615 (install-file "../source/data/rom/ROM.TXT" rom)
1616 (mkdir-p tile)
1617 (install-file "../source/data/tile/TILE.TXT" tile))
1618 #t)))))
1619 (native-inputs
1620 `(("pkg-config" ,pkg-config)))
1621 (inputs
1622 `(("mame" ,mame)
1623 ("gtk" ,gtk+)
1624 ("libevdev" ,libevdev)
1625 ("libvlc" ,vlc)
1626 ("libarchive" ,libarchive)))
1627 (home-page "https://github.com/strippato/gnome-arcade")
1628 (synopsis "Minimal MAME frontend")
1629 (description
1630 "A minimal GTK+ frontend for MAME, the multi-purpose arcade and console
1631emulator.")
1632 (license license:gpl3+)))
1633
1403e1f7
PN
1634(define-public pcsxr
1635 ;; No release since 2017.
1636 (let ((commit "6484236cb0281e8040ff6c8078c87899a3407534"))
1637 (package
1638 (name "pcsxr")
1639 ;; Version is tagged here: https://github.com/frealgagu/PCSX-Reloaded
1640 (version "1.9.95")
1641 (source
1642 (origin
1643 (method git-fetch)
1644 (uri (git-reference
1645 (url "https://github.com/pcsxr/PCSX-Reloaded")
1646 (commit commit)))
1647 (sha256
1648 (base32
1649 "138mayp7zi9v4l3lm5f6xxkds619w1fgg769zm8s45c84jbz7dza"))
1650 (file-name (git-file-name name commit))))
1651 (build-system cmake-build-system)
1652 (arguments
1653 `(#:tests? #f ;no "test" target
1654 #:configure-flags
1655 (list "-DSND_BACKEND=pulse"
1656 "-DENABLE_CCDDA='ON'"
1657 "-DUSE_LIBARCHIVE='ON'"
1658 "-DUSE_LIBCDIO='ON'")
1659 #:phases
1660 (modify-phases %standard-phases
1661 (add-after 'unpack 'cd-subdir
1ef71f52 1662 (lambda _ (chdir "pcsxr") #t))
1403e1f7
PN
1663 (add-before 'configure 'fix-cdio-lookup
1664 (lambda* (#:key inputs #:allow-other-keys)
1665 (substitute* "cmake/FindCdio.cmake"
1666 (("/usr/include/cdio")
1ef71f52
KK
1667 (string-append (assoc-ref inputs "libcdio") "/include/cdio")))
1668 #t))
1669 (add-after 'install 'wrap-program
1670 (lambda* (#:key inputs outputs #:allow-other-keys)
1671 (wrap-program (string-append (assoc-ref outputs "out")
1672 "/bin/pcsxr")
1673 ;; For GtkFileChooserDialog.
1674 `("GSETTINGS_SCHEMA_DIR" =
1675 (,(string-append (assoc-ref inputs "gtk+")
1676 "/share/glib-2.0/schemas"))))
1677 #t)))))
1403e1f7
PN
1678 (native-inputs
1679 `(("pkg-config" ,pkg-config)
1680 ("intltool" ,intltool)
1681 ("glib" ,glib "bin")))
1682 (inputs
1683 `(("libcdio" ,libcdio)
1684 ("sdl2" ,sdl2)
1685 ("gtk+" ,gtk+)
1686 ("ffmpeg" ,ffmpeg)
1687 ("libxv" ,libxv)
1688 ("libarchive" ,libarchive)
1689 ("pulseaudio" ,pulseaudio)))
1690 (home-page "https://archive.codeplex.com/?p=pcsxr")
1691 (synopsis "PlayStation emulator")
1692 (description
1693 "A PlayStation emulator based on PCSX-df Project with bugfixes and
1694improvements.")
1695 (license license:gpl2+))))
f6a0be2f
DW
1696
1697(define-public gens-gs
1698 (package
1699 (name "gens-gs")
1700 (version "7")
1701 (source
1702 (origin
1703 (method url-fetch)
1704 (uri (string-append "https://retrocdn.net/images/6/6d/Gens-gs-r"
1705 version ".tar.gz"))
1706 (sha256
1707 (base32
1708 "1ha5s6d3y7s9aq9f4zmn9p88109c3mrj36z2w68jhiw5xrxws833"))))
1709 (build-system glib-or-gtk-build-system)
1710 (arguments
1711 `(#:system "i686-linux"
1712 #:phases
1713 (modify-phases %standard-phases
1714 (add-after 'unpack 'fix-CFLAGS
1715 (lambda* _
1716 ;; Remove GTK API deprecation flags that cause build errors.
1717 (substitute* "configure"
1718 (("GTK_CFLAGS=\"\\$GTK_CFLAGS .*\"") ""))
1719 #t)))))
1720 (native-inputs
1721 `(("pkg-config" ,pkg-config)
1722 ("nasm" ,nasm)))
1723 (inputs
1724 `(("sdl" ,sdl)
1725 ("gtk" ,gtk+-2)))
1726 (home-page "https://segaretro.org/Gens/GS")
1727 (synopsis "Emulator for Sega Genesis/Mega Drive systems")
1728 (description
1729 "Gens/GS is an emulator for the Mega Drive (also known as Sega Genesis),
1730derived from Gens. Project goals include clean source code, combined features
1731from various forks of Gens, and improved platform portability.")
1732 (supported-systems '("i686-linux" "x86_64-linux"))
1733 (license license:gpl2+)))
391aff1f
PN
1734
1735(define-public bsnes
1736 (package
1737 (name "bsnes")
1738 (version "115")
1739 (source
1740 (origin
1741 (method git-fetch)
1742 (uri (git-reference
1743 (url "https://github.com/bsnes-emu/bsnes")
1744 (commit (string-append "v" version))))
1745 (file-name (git-file-name name version))
1746 (sha256
1747 (base32
1748 "0j054x38fwai61vj36sc04r3zkzay5acq2cgd9zqv5hs51s36g5b"))))
1749 (build-system gnu-build-system)
1750 (arguments
1751 `(#:make-flags (list "-C" "bsnes"
1752 (string-append "prefix=" (assoc-ref %outputs "out")))
1753 #:tests? #f ; No tests.
1754 #:phases (modify-phases %standard-phases
1755 (delete 'configure))))
1756 (native-inputs
1757 `(("pkg-config" ,pkg-config)))
1758 (inputs
1759 `(("alsa-lib" ,alsa-lib)
1760 ("ao" ,ao)
1761 ("cairo" ,cairo)
1762 ("eudev" ,eudev)
391aff1f 1763 ("gtksourceview-2" ,gtksourceview-2)
391aff1f
PN
1764 ("libxrandr" ,libxrandr)
1765 ("libxv" ,libxv)
1766 ("openal" ,openal)
1767 ("pulseaudio" ,pulseaudio)
1768 ("sdl2" ,sdl2)))
1769 (home-page "https://bsnes.dev/")
1770 (synopsis "Emulator for the Super Nintendo / Super Famicom systems")
1771 (description
1772 "bsnes is a Super Nintendo / Super Famicom emulator that focuses on
1773performance, features, and ease of use.")
1774 (license license:gpl3)))
f43e4104
JK
1775
1776;; python-pwntools requires a -rc release of unicorn
1777(define-public unicorn
1778 (let ((unless-x86
1779 (lambda (code)
1780 (if (member (%current-system) '("x86_64-linux" "i686-linux"))
1781 '()
1782 code))))
1783 (package
1784 (name "unicorn")
1785 (version "1.0.2-rc4")
1786 ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications.
1787 (source
1788 (origin
1789 (method git-fetch)
1790 (uri (git-reference
1791 (url "https://github.com/unicorn-engine/unicorn")
1792 (commit version)))
1793 (file-name (git-file-name name version))
1794 (sha256
1795 (base32
1796 "17nyccgk7hpc4hab24yn57f1xnmr7kq4px98zbp2bkwcrxny8gwy"))))
1797 (outputs '("out" "python"))
1798 ;; The main library is not written in Python, but the build process has
1799 ;; little in common with any defined build system, so we might as well
1800 ;; build on top of python-build-system and make use of all
1801 ;; the Python-specific phases that can be reused.
1802 (build-system python-build-system)
1803 (arguments
1804 `(#:modules ((srfi srfi-26)
1805 (guix build python-build-system)
1806 (guix build utils))
1807 #:phases
1808 (modify-phases %standard-phases
1809 (add-after 'unpack 'install-bindings-to-python-output
1810 (lambda* (#:key outputs #:allow-other-keys)
1811 ;; python-build-system will build the bindings and install them to
1812 ;; the "out" output, so change the build-internal names of the
1813 ;; outputs.
1814 ;;
1815 ;; TODO: remove this once #40469 lands, through the core-updates
1816 ;; holding zone, on master.
1817 (set-car! (assoc "out" outputs) "lib")
1818 (set-car! (assoc "python" outputs) "out")
1819 #t))
1820 (add-before 'build 'build-library
1821 (lambda* (#:key inputs #:allow-other-keys)
1822 (invoke "make"
1823 "-j" (number->string (parallel-job-count))
1824 "UNICORN_STATIC=no"
1825 "CC=gcc")))
1826 (add-after 'build-library 'install-library
1827 (lambda* (#:key outputs #:allow-other-keys)
1828 (invoke "make" "install"
1829 "UNICORN_STATIC=no"
1830 (string-append
1831 "PREFIX="
1832 (assoc-ref outputs "lib")))))
1833 (add-before 'build 'prepare-bindings
1834 (lambda* (#:key outputs #:allow-other-keys)
1835 (chdir "bindings/python")
1836 ;; Set this environment variable so that the Python bindings
1837 ;; don't build their own copy of the shared object, but use
1838 ;; a dummy value such that the bindings test suite uses the
1839 ;; same mechanism for loading the library as any other user.
1840 (setenv "LIBUNICORN_PATH" "1")
1841 (substitute* "unicorn/unicorn.py"
1842 (("_path_list = \\[.*")
1843 (string-append
1844 "_path_list = [\""
1845 (assoc-ref outputs "lib")
1846 ;; eat the rest of the list
1847 "/lib\"] + 0*[")))
1848 #t))
1849 (add-before 'check 'check-library
1850 (lambda* (#:key outputs #:allow-other-keys)
1851 (for-each
1852 (lambda (suite)
1853 (with-directory-excursion
1854 (string-append "../../tests/" suite)
1855 (invoke "make" "test" "CC=gcc"
1856 ,@(unless-x86
1857 '("AS=i686-unknown-linux-gnu-as"
1858 "OBJCOPY=i686-unknown-linux-gnu-objcopy")))))
1859 '("unit" "regress"))
1860 #t))
1861 (add-after 'install 'install-samples
1862 (lambda* (#:key outputs #:allow-other-keys)
1863 (let* ((python-samples (find-files "." "sample_.*"))
1864 (c-samples (find-files "../../samples" ".*\\.c"))
1865 (python-docdir
1866 (string-append (assoc-ref outputs "out")
1867 "/share/doc/unicorn/samples"))
1868 (c-docdir
1869 (string-append (assoc-ref outputs "lib")
1870 "/share/doc/unicorn/samples")))
1871 (for-each (cut install-file <> c-docdir) c-samples)
1872 (for-each (cut install-file <> python-docdir) python-samples)
1873 #t))))))
1874 (native-inputs
1875 ;; NOTE: cross-binutils needs to be wrapped with unless-x86, as otherwise
1876 ;; the linker provided by the package will be used, circumventing the ld-wrapper.
1877 `(,@(unless-x86
1878 `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu"))))
1879 ("cmocka" ,cmocka)
1880 ("hexdump-for-tests" ,util-linux)))
1881 (home-page "http://www.unicorn-engine.org")
1882 (synopsis "Unicorn CPU emulator framework")
1883 (description
1884 "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator
1885framework based on QEMU.")
1886 (license license:gpl2+))))
10543ef8
LP
1887
1888(define-public ppsspp
1889 (package
1890 (name "ppsspp")
e7cacc91 1891 (version "1.10.3")
10543ef8
LP
1892 (source
1893 (origin
1894 (method git-fetch)
1895 (uri (git-reference
b0e7b699 1896 (url "https://github.com/hrydgard/ppsspp")
10543ef8
LP
1897 (commit (string-append "v" version))))
1898 (sha256
e7cacc91 1899 (base32 "0znxlbj6cfw7gn0naay0mzhc0k5saw8nrwpspcn7gap1023p06w2"))
10543ef8
LP
1900 (file-name (git-file-name name version))
1901 (patches
1902 (search-patches "ppsspp-disable-upgrade-and-gold.patch"))
1903 (modules '((guix build utils)))
1904 (snippet
1905 `(begin
bb3ddda2
LP
1906 ;; The following is quite a heavy-handed way of unbundling PPSSPP.
1907 ;; There are still a number of external sources, that we don't
1908 ;; remove here. Some may be packaged, others are not.
1909 ;; First, we patch existing sources to include the right headers.
1910 (substitute* (append (list "ext/native/thin3d/vulkan_utils.cpp"
1911 "ext/native/thin3d/thin3d_vulkan.cpp")
1912 (find-files "Common" ".*\\.(h|cpp)")
1913 (find-files "Core" ".*\\.(h|cpp)")
1914 (find-files "GPU" ".*\\.(h|cpp)")
1915 (find-files "SDL" ".*\\.(h|cpp)")
1916 (find-files "UI" ".*\\.(h|cpp)"))
1917 ;; These headers are all hard-coded in the original source.
1918 (("ext/cityhash/") "")
10543ef8 1919 (("ext/glslang/") "")
bb3ddda2
LP
1920 (("ext/SPIRV-Cross/") "spirv_cross/")
1921 (("ext/vulkan/") "vulkan/")
1922 (("ext/xxhash.h") "xxhash.h")
1923 ;; These definitions do not actually exist in the Vulkan headers,
1924 ;; but PPSSPP defines them in ext/vulkan.
1925 (("VK_FORMAT_BEGIN_RANGE") "VK_FORMAT_UNDEFINED")
1926 (("VK_FORMAT_END_RANGE") "VK_FORMAT_ASTC_12x12_SRGB_BLOCK"))
1927 ;; Next, we patch CMakeLists.
10543ef8 1928 (substitute* "CMakeLists.txt"
bb3ddda2 1929 ;; Drop unnecessary includes and targets.
10543ef8 1930 (("include_directories\\(ext/glslang\\)") "")
bb3ddda2
LP
1931 (("include_directories\\(ext/xxhash\\)") "")
1932 (("include_directories\\(ext/cityhash\\)") "")
1933 (("set_target_properties\\(cityhash .*\\)") "")
1934 ;; Fix linking to GLEW.
1935 (("TARGET Ext::GLEW") "true")
1936 (("target_link_libraries\\(native Ext::GLEW\\)")
1937 "find_package(GLEW)\ntarget_link_libraries(native GLEW::GLEW)")
1938 (("Ext::Snappy") "snappy")
1939 ;; Don't search for cityhash/xxhash, we already have them.
1940 (("add_library\\((city|xx)hash STATIC") "if()\nendif(")
1941 (("ext/xxhash\\.[ch]") "")
1942 (("ext/native/ext/cityhash/.*\\.(cpp|h)") "")
1943 ;; Link all of spirv-cross.
10543ef8
LP
1944 (("spirv-cross-glsl" all)
1945 (string-append all
1946 " spirv-cross-core spirv-cross-cpp"
1947 " spirv-cross-reflect spirv-cross-util")))
1948 (substitute* "ext/CMakeLists.txt"
bb3ddda2 1949 (("add_subdirectory\\(glew\\)") "")
e7cacc91 1950 (("add_subdirectory\\(glslang( [A-Z_]*)*\\)") "")
bb3ddda2 1951 (("add_subdirectory\\(snappy\\)") "")
10543ef8 1952 (("add_subdirectory\\(SPIRV-Cross-build\\)") ""))
bb3ddda2
LP
1953 ;; Finally, we can delete the bundled sources.
1954 (for-each delete-file-recursively
1955 '("ext/cmake"
1956 "ext/glew"
1957 "ext/glslang" "ext/glslang-build"
1958 "ext/native/ext/cityhash"
1959 "ext/native/ext/libpng17"
1960 "ext/native/ext/libzip"
1961 "ext/snappy"
1962 "ext/SPIRV-Cross" "ext/SPIRV-Cross-build"
1963 "ext/vulkan"
1964 "ext/xxhash.c"
1965 "ext/xxhash.h"
1966 "ext/zlib"))
1967 ;; Since we are not including git as an input, PPSSPP is confused
1968 ;; about its version. Let's fix that here.
10543ef8
LP
1969 (substitute* "git-version.cmake"
1970 (("unknown") ,version))))))
1971 (build-system cmake-build-system)
1972 (native-inputs
1973 `(("pkg-config" ,pkg-config)
1974 ("python" ,python)))
1975 (inputs
bb3ddda2
LP
1976 `(("cityhash" ,cityhash)
1977 ("ffmpeg" ,ffmpeg)
10543ef8
LP
1978 ("glew" ,glew)
1979 ("glslang" ,glslang)
1980 ("libpng" ,libpng)
bb3ddda2 1981 ("libzip" ,libzip)
10543ef8
LP
1982 ("mesa" ,mesa)
1983 ("sdl2" ,sdl2)
1984 ("snappy" ,snappy)
1985 ("spirv-cross" ,spirv-cross)
bb3ddda2
LP
1986 ("vulkan-headers" ,vulkan-headers)
1987 ("vulkan-loader" ,vulkan-loader)
1988 ("xxhash" ,xxhash)
10543ef8 1989 ("zlib" ,zlib)
bb3ddda2 1990 ;; TODO: unbundle armips.
10543ef8
LP
1991 ("armips-source" ,(package-source armips))
1992 ("lang"
e7cacc91 1993 ,(let ((commit "1c64b8fbd3cb6bd87935eb53f302f7de6f86e209"))
c4659802
TGR
1994 (origin
1995 (method git-fetch)
1996 (uri (git-reference
1997 (url "https://github.com/hrydgard/ppsspp-lang")
1998 (commit commit)))
1999 (sha256
e7cacc91 2000 (base32 "0rprn3yd8xfrvi0fm62sgpqa8n73jk7zmlscp8cp0h2fawqpiamd"))
c4659802 2001 (file-name (git-file-name "ppsspp-lang" commit)))))
10543ef8 2002 ("tests"
c4659802
TGR
2003 ,(let ((commit "328b839c7243e7f733f9eae88d059485e3d808e7"))
2004 (origin
2005 (method git-fetch)
2006 (uri (git-reference
2007 (url "https://github.com/hrydgard/pspautotests")
2008 (commit commit)))
2009 (sha256
2010 (base32 "1gj1kr5ijxrqwvz7c41phskjr70ndp8iz0gr8c3xxsd8p9z5gdvm"))
2011 (file-name (git-file-name "pspautotests" commit)))))))
10543ef8
LP
2012 (arguments
2013 `(#:out-of-source? #f
2014 #:configure-flags (list "-DUSE_DISCORD=OFF"
2015 "-DUSE_SYSTEM_FFMPEG=ON"
bb3ddda2
LP
2016 "-DUSE_SYSTEM_LIBZIP=ON"
2017 ;; for testing
10543ef8
LP
2018 "-DUNITTEST=ON" "-DHEADLESS=ON")
2019 #:phases
2020 (modify-phases %standard-phases
2021 (add-after 'unpack 'add-external-sources
2022 (lambda* (#:key inputs #:allow-other-keys)
bb3ddda2 2023 ;; TODO: unbundle armips.
10543ef8
LP
2024 (copy-recursively (assoc-ref inputs "armips-source")
2025 "ext/armips")
2026 ;; Some tests are externalised, so we add them here.
2027 (copy-recursively (assoc-ref inputs "tests")
2028 "pspautotests")
2029 ;; i18n is externalised, so we add it here.
2030 (copy-recursively (assoc-ref inputs "lang")
2031 "assets/lang")
2032 #t))
2033 (replace 'check
2034 (lambda _
2035 (for-each
2036 (lambda (t) (invoke "./unitTest" t))
2037 '("Arm64Emitter" "ArmEmitter" "X64Emitter" "VertexJit" "Asin"
2038 "SinCos" "VFPUSinCos" "MathUtil" "Parsers" "Jit"
2039 "MatrixTranspose" "ParseLBN" "QuickTexHash" "CLZ" "MemMap"))
2040 (invoke "python3" "test.py" "-g")
2041 #t))
2042 (replace 'install
2043 (lambda* (#:key inputs outputs #:allow-other-keys)
2044 (let* ((out (assoc-ref outputs "out"))
2045 (bin/ppsspp (string-append out "/bin/ppsspp"))
2046 (share (string-append out "/share/ppsspp")))
2047 (copy-recursively "icons/hicolor"
2048 (string-append out "/share/icons/hicolor"))
2049 (install-file "PPSSPPSDL" share)
2050 (copy-recursively "assets" (string-append share "/assets"))
2051
2052 (make-desktop-entry-file
2053 (string-append out "/share/applications/ppsspp.desktop")
2054 #:name "PPSSPP"
2055 #:exec (string-append share "/PPSSPPSDL")
2056 #:icon "ppsspp")
2057 (mkdir-p (string-append out "/bin"))
2058 (with-output-to-file bin/ppsspp
2059 (lambda ()
2060 (format #t "#!~a~%exec ~a/PPSSPPSDL \"$@\""
2061 (which "sh") share)))
2062 (chmod bin/ppsspp #o755)
2063 #t))))))
2064 (home-page "https://www.ppsspp.org/")
2065 (synopsis "PSP emulator")
2066 (description
2067 "PPSSPP is a ``high-level'' emulator simulating the PSP operating
2068system.")
2069 (license license:gpl2+)))