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>
16 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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 fribidi)
57 #:use-module (gnu packages game-development)
58 #:use-module (gnu packages gcc)
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)
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))
97 (define-public desmume
105 "mirror://sourceforge/desmume/desmume/"
106 version "/desmume-" version ".tar.gz"))
109 "15l8wdw3q61fniy3h93d84dnm6s4pyadvh95a0j6d580rjk4pcrs"))
110 (patches (search-patches "desmume-gcc6-fixes.patch"
111 "desmume-gcc7-fixes.patch"))))
112 (build-system gnu-build-system)
114 ;; Enable support for WiFi and microphone.
115 `(#:configure-flags '("--enable-wifi"
118 `(("pkg-config" ,pkg-config)
119 ("intltool" ,intltool)))
126 (home-page "http://desmume.org/")
127 (synopsis "Nintendo DS emulator")
129 "DeSmuME is an emulator for the Nintendo DS handheld gaming console.")
130 (license license:gpl2)))
132 ;; Building from recent Git because the official 5.0 release no longer builds.
133 (define-public dolphin-emu
134 (let ((commit "a9745400ec5cea7e55d94955afbdc44d1a4982d1")
138 (version (git-version "5.0" revision commit))
143 (url "https://github.com/dolphin-emu/dolphin")
145 (file-name (git-file-name name version))
146 (modules '((guix build utils)))
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"))
157 (for-each delete-file (find-files "." ".*\\.(bin|dsy|exe|jar|rar)$"))
161 "0ic08ii4vlqlmk2wkfc99jiy6nji2wfq56r7slj23wgvhznnaabk"))))
162 (build-system cmake-build-system)
166 (modify-phases %standard-phases
167 (add-before 'configure 'generate-fonts&hardcore-libvulkan-path
168 (lambda* (#:key inputs outputs #:allow-other-keys)
170 (string-append (assoc-ref inputs "font-wqy-microhei")
171 "/share/fonts/truetype/wqy-microhei.ttc"))
173 (string-append (assoc-ref inputs "vulkan-loader")
174 "/lib/libvulkan.so")))
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")
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") ""))
191 ;; The FindGTK2 cmake script only checks hardcoded directories for
195 (list (string-append "-DX11_INCLUDE_DIR="
196 (assoc-ref %build-inputs "libx11")
198 (string-append "-DX11_LIBRARIES="
199 (assoc-ref %build-inputs "libx11")
203 `(("pkg-config" ,pkg-config)
204 ("gettext" ,gettext-minimal)))
206 `(("alsa-lib" ,alsa-lib)
212 ("font-wqy-microhei" ,font-wqy-microhei)
213 ("freetype" ,freetype)
219 ("libevdev" ,libevdev)
224 ("libxrandr" ,libxrandr)
226 ("mbedtls-apache" ,mbedtls-apache)
228 ("miniupnpc" ,miniupnpc)
231 ("pulseaudio" ,pulseaudio)
236 ("soundtouch" ,soundtouch)
237 ("vulkan-loader" ,vulkan-loader)
239 (home-page "https://dolphin-emu.org/")
240 (synopsis "Nintendo Wii and GameCube emulator")
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+)))))
249 (define-public dosbox
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"))
261 "02i648i50dwicv1vaql15rccv4g8h5blf5g6inv67lrfxpbkvlf0"))))
262 (build-system gnu-build-system)
264 `(("autoconf" ,autoconf)
265 ("automake" ,automake)))
270 ("alsa-lib" ,alsa-lib)
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
280 (license license:gpl2+)))
282 (define-public qtmips
289 (url "https://github.com/cvut/QtMips")
290 (commit (string-append "v" version))))
291 (file-name (git-file-name name version))
294 "1khvwgqz4h6q6mhbbq0yx43ajz8gx9wmwzs8784vmfrglndbxgax"))))
295 (build-system cmake-build-system)
298 (modify-phases %standard-phases
300 (lambda* (#:key outputs #:allow-other-keys)
302 (string-append "PREFIX=" (assoc-ref outputs "out"))
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"))
312 (invoke "tests/run-all.sh")
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"))
329 #:tests? #f)) ; test suite wants mips toolchain
331 `(("elfutils" ,elfutils)
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
340 (define-public emulation-station
341 ;; No release for a long time, new commits fix build issues
342 (let ((commit "9cc42adff67946175d2b7e25c6ae69cc374e98a0")
345 (name "emulation-station")
346 (version (git-version "2.0.1" revision commit))
348 (method git-fetch) ; no tarball available
350 (url "https://github.com/Aloshi/EmulationStation")
351 (commit commit))) ; no version tag
352 (file-name (git-file-name name version))
355 "1cva0ns650v17lfn8in095zci6lc43d23f1x3mlzc41qfqa6mbd1"))))
356 (build-system cmake-build-system)
358 '(#:tests? #f)) ; no tests
360 `(("alsa-lib" ,alsa-lib)
364 ("freeimage" ,freeimage)
365 ("freetype" ,freetype)
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))))
384 (url "https://github.com/higan-emu/higan")
385 (commit (string-append "v" version))))
386 (file-name (git-file-name name version))
388 (base32 "11rvm53c3p2f6zk8xbyv2j51xp8zmqnch7zravhj3fk590qrjrr2"))))
389 (build-system gnu-build-system)
391 `(("pkg-config" ,pkg-config)))
393 `(("alsa-lib" ,alsa-lib)
397 ("gtksourceview-2" ,gtksourceview-2)
398 ("libxrandr" ,libxrandr)
402 ("pulseaudio" ,pulseaudio)
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.
411 (add-before 'build 'chdir-to-higan
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"))
421 (add-after 'install 'chdir-to-icarus
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")
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
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))))
453 ;; Second, make sure higan will find icarus in PATH.
455 `("PATH" ":" prefix (,bin)))
459 (string-append "prefix=" (assoc-ref %outputs "out")))
460 ;; There is no test suite.
462 (home-page "https://github.com/higan-emu/higan/")
463 (synopsis "Multi-system emulator")
465 "higan is a multi-system emulator with an uncompromising focus on
466 accuracy and code readability.
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
474 (license license:gpl3+)))
476 (define-public mednafen
483 (uri (string-append "https://mednafen.github.io/releases/files/"
484 "mednafen-" version ".tar.xz"))
486 (base32 "1x7xhxjhwsdbak8l0iyb497f043xkhibk73w96xck4j2bk10fac4"))))
487 (build-system gnu-build-system)
491 ;; "--with-external-mpcdec"
492 "--with-external-lzo")))
494 `(("pkg-config" ,pkg-config)))
497 ;; ("libmpcdec" ,libmpcdec) FIXME: not recognized.
498 ("libsndfile" ,libsndfile)
502 (home-page "https://mednafen.github.io/")
503 (synopsis "Multi-system emulator utilizing OpenGL and SDL")
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.
513 The following systems are supported:
518 @item Neo Geo Pocket (Color)
520 @item GameBoy (Color)
521 @item GameBoy Advance
522 @item Nintendo Entertainment System
523 @item Super Nintendo Entertainment System/Super Famicom
525 @item PC Engine/TurboGrafx 16 (CD)
529 @item Sega Genesis/Megadrive
530 @item Sega Master System
531 @item Sega Saturn (experimental, x86_64 only)
532 @item Sony PlayStation
534 ;; Main license is GPL2+. Some parts are BSD-3.
535 (license (list license:gpl2+ license:bsd-3))))
545 (url "https://github.com/mgba-emu/mgba")
547 (file-name (git-file-name name version))
549 (base32 "0nqj4bnn5c2z1bq4bnbw1wznc0wpmq4sy3w8pipd6n6620b9m4qq"))
550 (modules '((guix build utils)))
552 ;; Make sure we don't use the bundled software.
556 (let ((lib-subdir (string-append "src/third-party/" subdir)))
557 (delete-file-recursively lib-subdir)))
558 '("libpng" "lzma" "sqlite3" "zlib"))
560 (build-system cmake-build-system)
562 `(#:tests? #f ;no "test" target
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)
571 ("libepoxy" ,libepoxy)
577 ("qtmultimedia" ,qtmultimedia)
581 (home-page "https://mgba.io")
582 (synopsis "Game Boy Advance emulator")
584 "mGBA is an emulator for running Game Boy Advance games. It aims to be
585 faster and more accurate than many existing Game Boy Advance emulators, as
586 well as adding features that other emulators lack. It also supports Game Boy
587 and Game Boy Color games.")
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))))
592 (define-public sameboy
600 (url "https://github.com/LIJI32/SameBoy")
601 (commit (string-append "v" version))))
602 (file-name (git-file-name name version))
604 (base32 "04w8lybi7ssnax37ka4qw7pmcm7cgnmk90p9m73zbyp5chgpqqzc"))))
605 (build-system gnu-build-system)
609 ("pkg-config" ,pkg-config)))
613 `(#:tests? #f ; There are no tests
614 #:make-flags `("CC=gcc" "NATIVE_CC=gcc" "CONF=release"
615 ,(string-append "DATA_DIR="
616 (assoc-ref %outputs "out")
619 (modify-phases %standard-phases
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")
629 (copy-recursively "." data))
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
634 and Super Game Boy emulator. SameBoy is accurate and includes a wide
635 range of debugging features. It has all the features one would expect
636 from an emulator---from save states to scaling filters.")
637 (license license:expat)))
639 (define-public mupen64plus-core
641 (name "mupen64plus-core")
647 (url "https://github.com/mupen64plus/mupen64plus-core")
649 (file-name (git-file-name name version))
651 (base32 "116fndl6652zrp1r6ag4xv3dzp1x52mlvadj8xwflq07fd5rhri1"))))
652 (build-system gnu-build-system)
654 `(("pkg-config" ,pkg-config)
657 `(("freetype" ,freetype)
665 (modify-phases %standard-phases
666 ;; The mupen64plus build system has no configure phase.
668 ;; Makefile is in a subdirectory.
670 'build 'chdir-to-project-directory
672 (chdir "projects/unix")
674 #:make-flags (let ((out (assoc-ref %outputs "out")))
675 (list "all" (string-append "PREFIX=" out)))
676 ;; There are no tests.
678 ;; As per the Makefile (in projects/unix/Makefile):
679 (supported-systems '("i686-linux" "x86_64-linux"))
680 (home-page "https://www.mupen64plus.org/")
681 (synopsis "Nintendo 64 emulator core library")
683 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
684 which is capable of accurately playing many games. This package contains the
686 (license license:gpl2+)))
688 (define-public mupen64plus-audio-sdl
690 (name "mupen64plus-audio-sdl")
696 (url "https://github.com/mupen64plus/mupen64plus-audio-sdl")
698 (file-name (git-file-name name version))
700 (base32 "0z19amfg9vr2pqjjri1ipc7hs681fzjcnb0f9y7bjhp5n8d7p6bb"))))
701 (build-system gnu-build-system)
703 `(("pkg-config" ,pkg-config)
706 `(("mupen64plus-core" ,mupen64plus-core)
710 (modify-phases %standard-phases
711 ;; The mupen64plus build system has no configure phase.
713 ;; Makefile is in a subdirectory.
715 'build 'cd-to-project-dir
717 (chdir "projects/unix"))))
719 (let ((out (assoc-ref %outputs "out"))
720 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
722 (string-append "PREFIX=" out)
723 (string-append "APIDIR=" m64p "/include/mupen64plus")))
724 ;; There are no tests.
726 (home-page "https://www.mupen64plus.org/")
727 (synopsis "Mupen64Plus SDL input plugin")
729 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
730 which is capable of accurately playing many games. This package contains the
732 (license license:gpl2+)))
734 (define-public mupen64plus-input-sdl
736 (name "mupen64plus-input-sdl")
742 (url "https://github.com/mupen64plus/mupen64plus-input-sdl")
744 (file-name (git-file-name name version))
746 (base32 "1dyazfbdjycdfslq8jixqiqhziw0rlkvach2r9dz91229jmkyc9c"))))
747 (build-system gnu-build-system)
751 `(("mupen64plus-core" ,mupen64plus-core)
755 (modify-phases %standard-phases
756 ;; The mupen64plus build system has no configure phase.
758 ;; Makefile is in a subdirectory.
760 'build 'cd-to-project-dir
762 (chdir "projects/unix"))))
764 (let ((out (assoc-ref %outputs "out"))
765 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
767 (string-append "PREFIX=" out)
768 (string-append "APIDIR=" m64p "/include/mupen64plus")))
769 ;; There are no tests.
771 (home-page "https://www.mupen64plus.org/")
772 (synopsis "Mupen64Plus SDL input plugin")
774 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
775 which is capable of accurately playing many games. This package contains the
777 (license license:gpl2+)))
779 (define-public mupen64plus-rsp-hle
781 (name "mupen64plus-rsp-hle")
787 (url "https://github.com/mupen64plus/mupen64plus-rsp-hle")
789 (file-name (git-file-name name version))
791 (base32 "0pi31qzjjp7aypdvvnz6ms18g09c4gqzxi6328zj8sji94b75gf0"))))
792 (build-system gnu-build-system)
794 `(("mupen64plus-core" ,mupen64plus-core)))
797 (modify-phases %standard-phases
798 ;; The mupen64plus build system has no configure phase.
800 ;; Makefile is in a subdirectory.
802 'build 'cd-to-project-dir
804 (chdir "projects/unix"))))
806 (let ((out (assoc-ref %outputs "out"))
807 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
809 (string-append "PREFIX=" out)
810 (string-append "APIDIR=" m64p "/include/mupen64plus")))
811 ;; There are no tests.
813 (home-page "https://www.mupen64plus.org/")
814 (synopsis "Mupen64Plus SDL input plugin")
816 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
817 which is capable of accurately playing many games. This package contains the
818 high-level emulation (HLE) RSP processor plugin.")
819 (license license:gpl2+)))
821 (define-public mupen64plus-rsp-z64
823 (name "mupen64plus-rsp-z64")
829 (url "https://github.com/mupen64plus/mupen64plus-rsp-z64")
831 (file-name (git-file-name name version))
833 (base32 "0nfyjns9k8xbg3aqs7593nfaxvlj72h3l8h467442xlk8ajfcylx"))))
834 (build-system gnu-build-system)
836 `(("mupen64plus-core" ,mupen64plus-core)))
839 (modify-phases %standard-phases
840 ;; The mupen64plus build system has no configure phase.
842 ;; Makefile is in a subdirectory.
844 'build 'cd-to-project-dir
846 (chdir "projects/unix"))))
848 (let ((out (assoc-ref %outputs "out"))
849 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
851 (string-append "PREFIX=" out)
852 (string-append "APIDIR=" m64p "/include/mupen64plus")))
853 ;; There are no tests.
855 (home-page "https://www.mupen64plus.org/")
856 (synopsis "Mupen64Plus SDL input plugin")
858 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
859 which is capable of accurately playing many games. This package contains the
860 Z64 RSP processor plugin.")
861 (license license:gpl2+)))
863 (define-public mupen64plus-video-arachnoid
865 (name "mupen64plus-video-arachnoid")
871 (url "https://github.com/mupen64plus/mupen64plus-video-arachnoid")
873 (file-name (git-file-name name version))
875 (base32 "1v9fqwpb6pawr8z5cm2ki7bqkks4iyr5c4jy4v5khj6h8zcv55gc"))))
876 (build-system gnu-build-system)
878 `(("pkg-config" ,pkg-config)
882 ("mupen64plus-core" ,mupen64plus-core)))
885 (modify-phases %standard-phases
886 ;; The mupen64plus build system has no configure phase.
888 ;; Makefile is in a subdirectory.
890 'build 'cd-to-project-dir
892 (chdir "projects/unix"))))
894 (let ((out (assoc-ref %outputs "out"))
895 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
897 (string-append "PREFIX=" out)
898 (string-append "APIDIR=" m64p "/include/mupen64plus")))
899 ;; There are no tests.
901 (home-page "https://www.mupen64plus.org/")
902 (synopsis "Mupen64Plus Rice Video plugin")
904 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
905 which is capable of accurately playing many games. This package contains the
906 Arachnoid video plugin.")
907 (license license:gpl2+)))
909 (define-public mupen64plus-video-glide64
911 (name "mupen64plus-video-glide64")
917 (url "https://github.com/mupen64plus/mupen64plus-video-glide64")
919 (file-name (git-file-name name version))
921 (base32 "0qn5za7g7796kh2ag3xpmhbqg0yf71g9liz6ks0rha8pz73lgs01"))))
922 (build-system gnu-build-system)
924 `(("pkg-config" ,pkg-config)
928 ("mupen64plus-core" ,mupen64plus-core)
932 (modify-phases %standard-phases
933 ;; The mupen64plus build system has no configure phase.
935 ;; Makefile is in a subdirectory.
937 'build 'cd-to-project-dir
939 (chdir "projects/unix")))
940 ;; XXX Should be unnecessary with the next release.
944 (substitute* "Makefile"
945 (("SDL_CONFIG = (.*)sdl-config" all prefix)
946 (string-append "SDL_CONFIG = " prefix "sdl2-config"))))))
948 (let ((out (assoc-ref %outputs "out"))
949 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
951 (string-append "PREFIX=" out)
952 (string-append "APIDIR=" m64p "/include/mupen64plus")))
953 ;; There are no tests.
955 (home-page "https://www.mupen64plus.org/")
956 (synopsis "Mupen64Plus Rice Video plugin")
958 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
959 which is capable of accurately playing many games. This package contains the
960 Glide64 video plugin.")
961 (license license:gpl2+)))
963 (define-public mupen64plus-video-glide64mk2
965 (name "mupen64plus-video-glide64mk2")
971 (url "https://github.com/mupen64plus/mupen64plus-video-glide64mk2")
973 (file-name (git-file-name name version))
975 (base32 "08pm28a36dpr0cvr8pzw0n5ksdazp7jqvlmqfy2lwb4dm0cwhkqd"))))
976 (build-system gnu-build-system)
978 `(("pkg-config" ,pkg-config)
984 ("mupen64plus-core" ,mupen64plus-core)
989 (modify-phases %standard-phases
990 ;; The mupen64plus build system has no configure phase.
992 ;; Makefile is in a subdirectory.
994 'build 'cd-to-project-dir
996 (chdir "projects/unix"))))
998 (let ((out (assoc-ref %outputs "out"))
999 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1001 (string-append "PREFIX=" out)
1002 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1003 ;; There are no tests.
1005 (home-page "https://www.mupen64plus.org/")
1006 (synopsis "Mupen64Plus Rice Video plugin")
1008 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1009 which is capable of accurately playing many games. This package contains the
1010 Glide64MK2 video plugin.")
1011 (license license:gpl2+)))
1013 (define-public mupen64plus-video-rice
1015 (name "mupen64plus-video-rice")
1021 (url "https://github.com/mupen64plus/mupen64plus-video-rice")
1023 (file-name (git-file-name name version))
1025 (base32 "0rpmbcq67gsj5h5jjis146378qc1mskskvx20y1ikx59yhbamh13"))))
1026 (build-system gnu-build-system)
1028 `(("pkg-config" ,pkg-config)
1031 `(("libpng" ,libpng)
1033 ("mupen64plus-core" ,mupen64plus-core)
1037 (modify-phases %standard-phases
1038 ;; The mupen64plus build system has no configure phase.
1040 ;; Makefile is in a subdirectory.
1042 'build 'cd-to-project-dir
1044 (chdir "projects/unix"))))
1046 (let ((out (assoc-ref %outputs "out"))
1047 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1049 (string-append "PREFIX=" out)
1050 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1051 ;; There are no tests.
1053 (home-page "https://www.mupen64plus.org/")
1054 (synopsis "Mupen64Plus Rice Video plugin")
1056 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1057 which is capable of accurately playing many games. This package contains the
1058 Rice Video plugin.")
1059 (license license:gpl2+)))
1061 (define-public mupen64plus-video-z64
1063 (name "mupen64plus-video-z64")
1069 (url "https://github.com/mupen64plus/mupen64plus-video-z64")
1071 (file-name (git-file-name name version))
1073 (base32 "04qa2fdd6dakpk2v0d4l80xh9b4h8gm71g80c0wyyxdhmhwk1r9c"))
1074 (patches (search-patches "mupen64plus-video-z64-glew-correct-path.patch"))))
1075 (build-system gnu-build-system)
1077 `(("pkg-config" ,pkg-config)
1081 ("mupen64plus-core" ,mupen64plus-core)
1085 (modify-phases %standard-phases
1086 ;; The mupen64plus build system has no configure phase.
1088 ;; Makefile is in a subdirectory.
1090 'build 'cd-to-project-dir
1092 (chdir "projects/unix")))
1093 ;; XXX Should be unnecessary with the next release.
1097 (substitute* "Makefile"
1098 (("SDL_CONFIG = (.*)sdl-config" all prefix)
1099 (string-append "SDL_CONFIG = " prefix "sdl2-config"))))))
1101 (let ((out (assoc-ref %outputs "out"))
1102 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1104 (string-append "PREFIX=" out)
1105 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1106 ;; There are no tests.
1108 (home-page "https://www.mupen64plus.org/")
1109 (synopsis "Mupen64Plus Z64 video plugin")
1111 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1112 which is capable of accurately playing many games. This package contains the
1114 (license license:gpl2+)))
1116 (define-public mupen64plus-ui-console
1118 (name "mupen64plus-ui-console")
1124 (url "https://github.com/mupen64plus/mupen64plus-ui-console")
1126 (file-name (git-file-name name version))
1128 (base32 "0vrf98qa6a0y3647kslsv644fag233dxh5dcr1yncjiiwickcr5a"))
1129 (patches (search-patches "mupen64plus-ui-console-notice.patch"))))
1130 (build-system gnu-build-system)
1132 `(("pkg-config" ,pkg-config)
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.
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)))
1154 (modify-phases %standard-phases
1155 ;; The mupen64plus build system has no configure phase.
1157 ;; Makefile is in a subdirectory.
1159 'build 'cd-to-project-dir
1161 (chdir "projects/unix"))))
1163 (let ((out (assoc-ref %outputs "out"))
1164 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
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.
1172 (home-page "https://www.mupen64plus.org/")
1173 (synopsis "Mupen64Plus command line user interface")
1175 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1176 which is capable of accurately playing many games. This package contains the
1177 command line user interface. Installing this package is the easiest way
1178 towards a working Mupen64Plus for casual users.")
1179 (license license:gpl2+)))
1181 (define-public nestopia-ue
1183 (name "nestopia-ue")
1189 (url "https://github.com/rdanbrook/nestopia")
1191 (file-name (git-file-name name version))
1193 (base32 "19c8vx5yxbysl0sszk5blfngwacshdgwbf44g1qaxvq8ywiyxmb4"))
1194 (modules '((guix build utils)))
1197 ;; We don't need libretro for the GNU/Linux build.
1198 (delete-file-recursively "libretro")
1200 (build-system cmake-build-system)
1202 `(("pkg-config" ,pkg-config)))
1206 ("libarchive" ,libarchive)
1207 ("libepoxy" ,libepoxy)
1212 (modify-phases %standard-phases
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)))))))
1222 ;; There are no tests.
1224 (home-page "http://0ldsk00l.ca/nestopia/")
1225 (synopsis "Nintendo Entertainment System (NES/Famicom) emulator")
1227 "Nestopia UE (Undead Edition) is a fork of the Nintendo Entertainment
1228 System (NES/Famicom) emulator Nestopia, with enhancements from members of the
1229 emulation community. It provides highly accurate emulation.")
1230 (license license:gpl2+)))
1232 (define-public retroarch
1240 (url "https://github.com/libretro/RetroArch")
1241 (commit (string-append "v" version))))
1242 (file-name (git-file-name name version))
1244 (base32 "0y7rcpz7psf8k3agsrq277jdm651vbnn9xpqvmj2in1a786idya7"))
1246 (search-patches "retroarch-disable-online-updater.patch"))
1247 (modules '((guix build utils)))
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\""))
1256 (build-system gnu-build-system)
1258 `(#:tests? #f ; no tests
1260 (modify-phases %standard-phases
1262 (lambda* (#:key inputs outputs #:allow-other-keys)
1263 (let* ((out (assoc-ref outputs "out"))
1264 (etc (string-append out "/etc"))
1265 (vulkan (assoc-ref inputs "vulkan-loader"))
1266 (wayland-protocols (assoc-ref inputs "wayland-protocols")))
1267 ;; Hard-code some store file names.
1268 (substitute* "gfx/common/vulkan_common.c"
1269 (("libvulkan.so") (string-append vulkan "/lib/libvulkan.so")))
1270 (substitute* "gfx/common/wayland/generate_wayland_protos.sh"
1271 (("/usr/local/share/wayland-protocols")
1272 (string-append wayland-protocols "/share/wayland-protocols")))
1273 (substitute* "qb/qb.libs.sh"
1274 (("/bin/true") (which "true")))
1277 (substitute* '("libretro-common/file/archive_file_zlib.c"
1278 "libretro-common/streams/trans_stream_zlib.c")
1279 (("<compat/zlib.h>") "<zlib.h>"))
1281 ;; The configure script does not yet accept the extra arguments
1282 ;; (like ‘CONFIG_SHELL=’) passed by the default configure phase.
1285 ,@(if (string-prefix? "armhf" (or (%current-target-system)
1287 '("--enable-neon" "--enable-floathard")
1289 (string-append "--prefix=" out)
1290 (string-append "--global-config-dir=" etc)
1291 "--disable-builtinminiupnpc")))))))
1293 `(("alsa-lib" ,alsa-lib)
1295 ("freetype" ,freetype)
1296 ("libxinerama" ,libxinerama)
1297 ("libxkbcommon" ,libxkbcommon)
1298 ("libxml2" ,libxml2)
1299 ("libxrandr" ,libxrandr)
1302 ("miniupnpc" ,miniupnpc)
1304 ("pulseaudio" ,pulseaudio)
1309 ("vulkan-loader" ,vulkan-loader)
1310 ("wayland" ,wayland)
1313 `(("pkg-config" ,pkg-config)
1314 ("wayland-protocols" ,wayland-protocols)
1316 (home-page "https://www.libretro.com/")
1317 (synopsis "Reference frontend for the libretro API")
1319 "Libretro is a simple but powerful development interface that allows for
1320 the easy creation of emulators, games and multimedia applications that can plug
1321 straight into any libretro-compatible frontend. RetroArch is the official
1322 reference frontend for the libretro API, currently used by most as a modular
1323 multi-system game/emulator system.")
1324 (license license:gpl3+)))
1326 (define-public scummvm
1333 (uri (string-append "http://www.scummvm.org/frs/scummvm/" version
1334 "/scummvm-" version ".tar.xz"))
1336 (base32 "11vknasm5dna2vqr6gk343qynh7nhsq3kf60zayarn1vb5z6as8l"))))
1337 (build-system gnu-build-system)
1339 `(#:tests? #f ;require "git"
1340 #:configure-flags (list "--enable-release") ;for optimizations
1342 (modify-phases %standard-phases
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)))))))
1356 ("pkg-config" ,pkg-config)))
1358 `(("alsa-lib" ,alsa-lib)
1360 ("fluidsynth" ,fluidsynth)
1361 ("freetype" ,freetype)
1362 ("fribidi" ,fribidi)
1365 ("libjpeg-turbo" ,libjpeg-turbo)
1367 ("libmpeg2" ,libmpeg2)
1370 ("libtheora" ,libtheora)
1371 ("libvorbis" ,libvorbis)
1372 ("sdl2" ,(sdl-union (list sdl2 sdl2-net)))
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
1377 classic graphical point-and-click adventure games, provided you
1378 already have their data files. The clever part about this: ScummVM
1379 just replaces the executables shipped with the games, allowing you to
1380 play them on systems for which they were never designed!")
1381 (license license:gpl2+)))
1391 (url "https://github.com/mamedev/mame")
1392 (commit (apply string-append "mame" (string-split version #\.)))))
1393 (file-name (git-file-name name version))
1395 (base32 "1yfns42rk1l0qprj5ksj9fqsgqpa23xnzxf29r4434p4n18bb77v"))
1396 (modules '((guix build utils)))
1398 ;; Remove bundled libraries.
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")))
1406 (build-system gnu-build-system)
1410 ;; A 'strict-overflow' error pops up on i686 so disable '-Werror'.
1412 (string-append "QT_HOME=" (assoc-ref %build-inputs "qtbase"))
1413 (string-append "SDL_INI_PATH="
1414 (assoc-ref %outputs "out")
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
1422 (modify-phases %standard-phases
1424 (add-after 'build 'build-documentation
1425 (lambda _ (invoke "make" "-C" "docs" "man" "info")))
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")))
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))
1441 (when (file-exists? "mame64")
1442 (rename-file "mame64" "mame"))
1443 (install-file "mame" (string-append out "/bin")))
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))
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/".
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")
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~@
1476 fontpath $HOME/mame/fonts;~a/fonts~@
1477 ctrlrpath $HOME/mame/ctrlr;~a/ctrlr~@
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
1489 (with-output-to-file (string-append ini "/ui.ini")
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~%")))
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")))
1519 (with-output-to-file (string-append desktop "/mame.desktop")
1524 Comment=Multi-purpose emulation framework~@
1529 Categories=Game;Emulator;~@
1530 Keywords=Game;Emulator;Arcade;~%"
1534 `(("pkg-config" ,pkg-config)
1535 ("sphinx" ,python-sphinx)
1536 ("sphinxcontrib-svg2pdfconverter" ,python-sphinxcontrib-svg2pdfconverter)
1537 ("texinfo" ,texinfo)))
1539 `(("alsa-lib" ,alsa-lib)
1543 ("fontconfig" ,fontconfig)
1545 ("libjpeg" ,libjpeg-turbo)
1547 ("libxinerama" ,libxinerama)
1549 ("portaudio" ,portaudio)
1550 ("portmidi" ,portmidi)
1551 ("pugixml" ,pugixml)
1552 ("python-wrapper" ,python-wrapper)
1554 ("rapidjson" ,rapidjson)
1555 ("sdl" ,(sdl-union (list sdl2 sdl2-ttf)))
1557 ("utf8proc" ,utf8proc)
1559 (home-page "https://www.mamedev.org")
1560 (synopsis "Multi-purpose emulation framework")
1561 (description "MAME's purpose is to preserve decades of software
1562 history. As electronic technology continues to rush forward, MAME
1563 prevents this important @emph{vintage} software from being lost and
1564 forgotten. This is achieved by documenting the hardware and how it
1565 functions. 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))))
1571 (define-public gnome-arcade
1573 (name "gnome-arcade")
1579 (url "https://github.com/strippato/gnome-arcade")
1580 (commit (string-append "v." version))))
1581 (file-name (git-file-name name version))
1584 "1qc01a62p65qb6mwjfmxqsd6n3rglsfwrjhsp25nr7q54107n55l"))))
1585 (build-system cmake-build-system)
1587 `(#:tests? #f ; No tests.
1588 #:configure-flags (list
1589 (string-append "-DMAME_BIN=\""
1590 (assoc-ref %build-inputs "mame")
1592 (string-append "-DAPP_RES=\""
1593 (assoc-ref %outputs "out")
1594 "/share/gnome-arcade/\""))
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")))
1601 (substitute* "../source/src/config.c"
1602 (("/usr/share") (string-append out "/share"))))
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")))
1611 (install-file "../gnome-arcade" bin)
1612 (copy-recursively "../source/res"
1613 (string-append out "/share/gnome-arcade/res"))
1615 (install-file "../source/data/rom/ROM.TXT" rom)
1617 (install-file "../source/data/tile/TILE.TXT" tile))
1620 `(("pkg-config" ,pkg-config)))
1624 ("libevdev" ,libevdev)
1626 ("libarchive" ,libarchive)))
1627 (home-page "https://github.com/strippato/gnome-arcade")
1628 (synopsis "Minimal MAME frontend")
1630 "A minimal GTK+ frontend for MAME, the multi-purpose arcade and console
1632 (license license:gpl3+)))
1634 (define-public pcsxr
1635 ;; No release since 2017.
1636 (let ((commit "6484236cb0281e8040ff6c8078c87899a3407534"))
1639 ;; Version is tagged here: https://github.com/frealgagu/PCSX-Reloaded
1645 (url "https://github.com/pcsxr/PCSX-Reloaded")
1649 "138mayp7zi9v4l3lm5f6xxkds619w1fgg769zm8s45c84jbz7dza"))
1650 (file-name (git-file-name name commit))))
1651 (build-system cmake-build-system)
1653 `(#:tests? #f ;no "test" target
1655 (list "-DSND_BACKEND=pulse"
1656 "-DENABLE_CCDDA='ON'"
1657 "-DUSE_LIBARCHIVE='ON'"
1658 "-DUSE_LIBCDIO='ON'")
1660 (modify-phases %standard-phases
1661 (add-after 'unpack 'cd-subdir
1662 (lambda _ (chdir "pcsxr") #t))
1663 (add-before 'configure 'fix-cdio-lookup
1664 (lambda* (#:key inputs #:allow-other-keys)
1665 (substitute* "cmake/FindCdio.cmake"
1666 (("/usr/include/cdio")
1667 (string-append (assoc-ref inputs "libcdio") "/include/cdio")))
1669 (add-after 'install 'wrap-program
1670 (lambda* (#:key inputs outputs #:allow-other-keys)
1671 (wrap-program (string-append (assoc-ref outputs "out")
1673 ;; For GtkFileChooserDialog.
1674 `("GSETTINGS_SCHEMA_DIR" =
1675 (,(string-append (assoc-ref inputs "gtk+")
1676 "/share/glib-2.0/schemas"))))
1679 `(("pkg-config" ,pkg-config)
1680 ("intltool" ,intltool)
1681 ("glib" ,glib "bin")))
1683 `(("libcdio" ,libcdio)
1688 ("libarchive" ,libarchive)
1689 ("pulseaudio" ,pulseaudio)))
1690 (home-page "https://archive.codeplex.com/?p=pcsxr")
1691 (synopsis "PlayStation emulator")
1693 "A PlayStation emulator based on PCSX-df Project with bugfixes and
1695 (license license:gpl2+))))
1697 (define-public gens-gs
1704 (uri (string-append "https://retrocdn.net/images/6/6d/Gens-gs-r"
1708 "1ha5s6d3y7s9aq9f4zmn9p88109c3mrj36z2w68jhiw5xrxws833"))))
1709 (build-system glib-or-gtk-build-system)
1711 `(#:system "i686-linux"
1713 (modify-phases %standard-phases
1714 (add-after 'unpack 'fix-CFLAGS
1716 ;; Remove GTK API deprecation flags that cause build errors.
1717 (substitute* "configure"
1718 (("GTK_CFLAGS=\"\\$GTK_CFLAGS .*\"") ""))
1721 `(("pkg-config" ,pkg-config)
1726 (home-page "https://segaretro.org/Gens/GS")
1727 (synopsis "Emulator for Sega Genesis/Mega Drive systems")
1729 "Gens/GS is an emulator for the Mega Drive (also known as Sega Genesis),
1730 derived from Gens. Project goals include clean source code, combined features
1731 from various forks of Gens, and improved platform portability.")
1732 (supported-systems '("i686-linux" "x86_64-linux"))
1733 (license license:gpl2+)))
1735 (define-public bsnes
1743 (url "https://github.com/bsnes-emu/bsnes")
1744 (commit (string-append "v" version))))
1745 (file-name (git-file-name name version))
1748 "0j054x38fwai61vj36sc04r3zkzay5acq2cgd9zqv5hs51s36g5b"))))
1749 (build-system gnu-build-system)
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))))
1757 `(("pkg-config" ,pkg-config)))
1759 `(("alsa-lib" ,alsa-lib)
1763 ("gtksourceview-2" ,gtksourceview-2)
1764 ("libxrandr" ,libxrandr)
1767 ("pulseaudio" ,pulseaudio)
1769 (home-page "https://bsnes.dev/")
1770 (synopsis "Emulator for the Super Nintendo / Super Famicom systems")
1772 "bsnes is a Super Nintendo / Super Famicom emulator that focuses on
1773 performance, features, and ease of use.")
1774 (license license:gpl3)))
1776 ;; python-pwntools requires a -rc release of unicorn
1777 (define-public unicorn
1780 (if (member (%current-system) '("x86_64-linux" "i686-linux"))
1785 (version "1.0.2-rc4")
1786 ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications.
1791 (url "https://github.com/unicorn-engine/unicorn")
1793 (file-name (git-file-name name version))
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)
1804 `(#:modules ((srfi srfi-26)
1805 (guix build python-build-system)
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
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")
1820 (add-before 'build 'build-library
1821 (lambda* (#:key inputs #:allow-other-keys)
1823 "-j" (number->string (parallel-job-count))
1826 (add-after 'build-library 'install-library
1827 (lambda* (#:key outputs #:allow-other-keys)
1828 (invoke "make" "install"
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 = \\[.*")
1845 (assoc-ref outputs "lib")
1846 ;; eat the rest of the list
1849 (add-before 'check 'check-library
1850 (lambda* (#:key outputs #:allow-other-keys)
1853 (with-directory-excursion
1854 (string-append "../../tests/" suite)
1855 (invoke "make" "test" "CC=gcc"
1857 '("AS=i686-unknown-linux-gnu-as"
1858 "OBJCOPY=i686-unknown-linux-gnu-objcopy")))))
1859 '("unit" "regress"))
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"))
1866 (string-append (assoc-ref outputs "out")
1867 "/share/doc/unicorn/samples"))
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)
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.
1878 `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu"))))
1880 ("hexdump-for-tests" ,util-linux)))
1881 (home-page "http://www.unicorn-engine.org")
1882 (synopsis "Unicorn CPU emulator framework")
1884 "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator
1885 framework based on QEMU.")
1886 (license license:gpl2+))))
1888 (define-public ppsspp
1896 (url "https://github.com/hrydgard/ppsspp")
1897 (commit (string-append "v" version))))
1899 (base32 "0znxlbj6cfw7gn0naay0mzhc0k5saw8nrwpspcn7gap1023p06w2"))
1900 (file-name (git-file-name name version))
1902 (search-patches "ppsspp-disable-upgrade-and-gold.patch"))
1903 (modules '((guix build utils)))
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/") "")
1919 (("ext/glslang/") "")
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.
1928 (substitute* "CMakeLists.txt"
1929 ;; Drop unnecessary includes and targets.
1930 (("include_directories\\(ext/glslang\\)") "")
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.
1944 (("spirv-cross-glsl" all)
1946 " spirv-cross-core spirv-cross-cpp"
1947 " spirv-cross-reflect spirv-cross-util")))
1948 (substitute* "ext/CMakeLists.txt"
1949 (("add_subdirectory\\(glew\\)") "")
1950 (("add_subdirectory\\(glslang( [A-Z_]*)*\\)") "")
1951 (("add_subdirectory\\(snappy\\)") "")
1952 (("add_subdirectory\\(SPIRV-Cross-build\\)") ""))
1953 ;; Finally, we can delete the bundled sources.
1954 (for-each delete-file-recursively
1957 "ext/glslang" "ext/glslang-build"
1958 "ext/native/ext/cityhash"
1959 "ext/native/ext/libpng17"
1960 "ext/native/ext/libzip"
1962 "ext/SPIRV-Cross" "ext/SPIRV-Cross-build"
1967 ;; Since we are not including git as an input, PPSSPP is confused
1968 ;; about its version. Let's fix that here.
1969 (substitute* "git-version.cmake"
1970 (("unknown") ,version))))))
1971 (build-system cmake-build-system)
1973 `(("pkg-config" ,pkg-config)
1974 ("python" ,python)))
1976 `(("cityhash" ,cityhash)
1979 ("glslang" ,glslang)
1985 ("spirv-cross" ,spirv-cross)
1986 ("vulkan-headers" ,vulkan-headers)
1987 ("vulkan-loader" ,vulkan-loader)
1990 ;; TODO: unbundle armips.
1991 ("armips-source" ,(package-source armips))
1993 ,(let ((commit "1c64b8fbd3cb6bd87935eb53f302f7de6f86e209"))
1997 (url "https://github.com/hrydgard/ppsspp-lang")
2000 (base32 "0rprn3yd8xfrvi0fm62sgpqa8n73jk7zmlscp8cp0h2fawqpiamd"))
2001 (file-name (git-file-name "ppsspp-lang" commit)))))
2003 ,(let ((commit "328b839c7243e7f733f9eae88d059485e3d808e7"))
2007 (url "https://github.com/hrydgard/pspautotests")
2010 (base32 "1gj1kr5ijxrqwvz7c41phskjr70ndp8iz0gr8c3xxsd8p9z5gdvm"))
2011 (file-name (git-file-name "pspautotests" commit)))))))
2013 `(#:out-of-source? #f
2014 #:configure-flags (list "-DUSE_DISCORD=OFF"
2015 "-DUSE_SYSTEM_FFMPEG=ON"
2016 "-DUSE_SYSTEM_LIBZIP=ON"
2018 "-DUNITTEST=ON" "-DHEADLESS=ON")
2020 (modify-phases %standard-phases
2021 (add-after 'unpack 'add-external-sources
2022 (lambda* (#:key inputs #:allow-other-keys)
2023 ;; TODO: unbundle armips.
2024 (copy-recursively (assoc-ref inputs "armips-source")
2026 ;; Some tests are externalised, so we add them here.
2027 (copy-recursively (assoc-ref inputs "tests")
2029 ;; i18n is externalised, so we add it here.
2030 (copy-recursively (assoc-ref inputs "lang")
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")
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"))
2052 (make-desktop-entry-file
2053 (string-append out "/share/applications/ppsspp.desktop")
2055 #:exec (string-append share "/PPSSPPSDL")
2057 (mkdir-p (string-append out "/bin"))
2058 (with-output-to-file bin/ppsspp
2060 (format #t "#!~a~%exec ~a/PPSSPPSDL \"$@\""
2061 (which "sh") share)))
2062 (chmod bin/ppsspp #o755)
2064 (home-page "https://www.ppsspp.org/")
2065 (synopsis "PSP emulator")
2067 "PPSSPP is a ``high-level'' emulator simulating the PSP operating
2069 (license license:gpl2+)))