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