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 imagemagick)
65 #:use-module (gnu packages libedit)
66 #:use-module (gnu packages libusb)
67 #:use-module (gnu packages linux)
68 #:use-module (gnu packages lua)
69 #:use-module (gnu packages maths)
70 #:use-module (gnu packages mp3)
71 #:use-module (gnu packages music)
72 #:use-module (gnu packages ncurses)
73 #:use-module (gnu packages networking)
74 #:use-module (gnu packages pkg-config)
75 #:use-module (gnu packages pulseaudio)
76 #:use-module (gnu packages python)
77 #:use-module (gnu packages qt)
78 #:use-module (gnu packages sdl)
79 #:use-module (gnu packages sphinx)
80 #:use-module (gnu packages sqlite)
81 #:use-module (gnu packages texinfo)
82 #:use-module (gnu packages textutils)
83 #:use-module (gnu packages tls)
84 #:use-module (gnu packages upnp)
85 #:use-module (gnu packages video)
86 #:use-module (gnu packages vulkan)
87 #:use-module (gnu packages wxwidgets)
88 #:use-module (gnu packages xdisorg)
89 #:use-module (gnu packages xiph)
90 #:use-module (gnu packages xml)
91 #:use-module (gnu packages xorg)
92 #:use-module (gnu packages web)
93 #:use-module (guix build-system cmake)
94 #:use-module (guix build-system glib-or-gtk)
95 #:use-module (guix build-system gnu)
96 #:use-module (guix build-system python))
98 (define-public desmume
106 "mirror://sourceforge/desmume/desmume/"
107 version "/desmume-" version ".tar.gz"))
110 "15l8wdw3q61fniy3h93d84dnm6s4pyadvh95a0j6d580rjk4pcrs"))
111 (patches (search-patches "desmume-gcc6-fixes.patch"
112 "desmume-gcc7-fixes.patch"))))
113 (build-system gnu-build-system)
115 ;; Enable support for WiFi and microphone.
116 `(#:configure-flags '("--enable-wifi"
119 `(("pkg-config" ,pkg-config)
120 ("intltool" ,intltool)))
127 (home-page "http://desmume.org/")
128 (synopsis "Nintendo DS emulator")
130 "DeSmuME is an emulator for the Nintendo DS handheld gaming console.")
131 (license license:gpl2)))
133 ;; Building from recent Git because the official 5.0 release no longer builds.
134 (define-public dolphin-emu
135 (let ((commit "a9745400ec5cea7e55d94955afbdc44d1a4982d1")
139 (version (git-version "5.0" revision commit))
144 (url "https://github.com/dolphin-emu/dolphin")
146 (file-name (git-file-name name version))
147 (modules '((guix build utils)))
150 ;; Remove external stuff we don't need.
151 (for-each (lambda (dir)
152 (delete-file-recursively
153 (string-append "Externals/" dir)))
154 '("LZO" "OpenAL" "Qt" "SFML" "curl" "ffmpeg"
155 "gettext" "hidapi" "libpng" "libusb" "mbedtls"
156 "miniupnpc" "MoltenVK" "zlib"))
158 (for-each delete-file (find-files "." ".*\\.(bin|dsy|exe|jar|rar)$"))
162 "0ic08ii4vlqlmk2wkfc99jiy6nji2wfq56r7slj23wgvhznnaabk"))))
163 (build-system cmake-build-system)
167 (modify-phases %standard-phases
168 (add-before 'configure 'generate-fonts&hardcore-libvulkan-path
169 (lambda* (#:key inputs outputs #:allow-other-keys)
171 (string-append (assoc-ref inputs "font-wqy-microhei")
172 "/share/fonts/truetype/wqy-microhei.ttc"))
174 (string-append (assoc-ref inputs "vulkan-loader")
175 "/lib/libvulkan.so")))
177 (invoke "bash" "-c" "g++ -O2 $(freetype-config \
178 --cflags --libs) gc-font-tool.cpp -o gc-font-tool")
179 (invoke "./gc-font-tool" "a" fontfile "font_western.bin")
180 (invoke "./gc-font-tool" "s" fontfile "font_japanese.bin")
181 (copy-file "font_japanese.bin" "../Data/Sys/GC/font_japanese.bin")
182 (copy-file "font_western.bin" "../Data/Sys/GC/font_western.bin")
184 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
185 (("\"vulkan\", 1") (string-append "\"vulkan\"")))
186 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
187 (("\"vulkan\"") (string-append "\"" libvulkan "\"")))
188 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
189 (("Common::DynamicLibrary::GetVersionedFilename") ""))
192 ;; The FindGTK2 cmake script only checks hardcoded directories for
196 (list (string-append "-DX11_INCLUDE_DIR="
197 (assoc-ref %build-inputs "libx11")
199 (string-append "-DX11_LIBRARIES="
200 (assoc-ref %build-inputs "libx11")
204 `(("pkg-config" ,pkg-config)
205 ("gettext" ,gettext-minimal)))
207 `(("alsa-lib" ,alsa-lib)
213 ("font-wqy-microhei" ,font-wqy-microhei)
214 ("freetype" ,freetype)
220 ("libevdev" ,libevdev)
225 ("libxrandr" ,libxrandr)
227 ("mbedtls-apache" ,mbedtls-apache)
229 ("miniupnpc" ,miniupnpc)
232 ("pulseaudio" ,pulseaudio)
237 ("soundtouch" ,soundtouch)
238 ("vulkan-loader" ,vulkan-loader)
240 (home-page "https://dolphin-emu.org/")
241 (synopsis "Nintendo Wii and GameCube emulator")
243 "Dolphin is an emulator for two Nintendo video game consoles: the
244 GameCube and the Wii. It provides compatibility with all PC controllers,
245 turbo speed, networked multiplayer, and graphical enhancements.")
246 (supported-systems '("x86_64-linux" "aarch64-linux"))
247 ; dolphin/Data/Sys/GC/font_*.bin: Licensed under ASL2.0.
248 (license (list license:gpl2+ license:asl2.0 license:fdl1.2+)))))
250 (define-public dosbox
256 (uri (string-append "https://sourceforge.net/projects/dosbox"
257 "/files/dosbox/" version "/dosbox-"
258 version ".tar.gz/download"))
259 (file-name (string-append name "-" version ".tar.gz"))
262 "02i648i50dwicv1vaql15rccv4g8h5blf5g6inv67lrfxpbkvlf0"))))
263 (build-system gnu-build-system)
265 `(("autoconf" ,autoconf)
266 ("automake" ,automake)))
271 ("alsa-lib" ,alsa-lib)
274 (home-page "https://www.dosbox.com")
275 (synopsis "X86 emulator with CGA/EGA/VGA/etc. graphics and sound")
276 (description "DOSBox is a DOS-emulator that uses the SDL library. DOSBox
277 also emulates CPU:286/386 realmode/protected mode, Directory
278 FileSystem/XMS/EMS, Tandy/Hercules/CGA/EGA/VGA/VESA graphics, a
279 SoundBlaster/Gravis Ultra Sound card for excellent sound compatibility with
281 (license license:gpl2+)))
283 (define-public qtmips
290 (url "https://github.com/cvut/QtMips")
291 (commit (string-append "v" version))))
292 (file-name (git-file-name name version))
295 "1khvwgqz4h6q6mhbbq0yx43ajz8gx9wmwzs8784vmfrglndbxgax"))))
296 (build-system cmake-build-system)
299 (modify-phases %standard-phases
301 (lambda* (#:key outputs #:allow-other-keys)
303 (string-append "PREFIX=" (assoc-ref outputs "out"))
306 (lambda* (#:key tests? #:allow-other-keys)
307 (substitute* "tests/test.sh"
308 (("qtchooser.*") ""))
309 (substitute* '("tests/cpu_trap/test.sh"
310 "tests/registers/test.sh")
311 (("sub-qtmips_cli") "qtmips_cli"))
313 (invoke "tests/run-all.sh")
316 ;; There is no install target.
317 (lambda* (#:key outputs #:allow-other-keys)
318 (let* ((out (assoc-ref outputs "out"))
319 (bin (string-append out "/bin"))
320 (apps (string-append out "/share/applications"))
321 (icons (string-append out "/share/icons/hicolor")))
322 (install-file "qtmips_gui/qtmips_gui" bin)
323 (install-file "qtmips_cli/qtmips_cli" bin)
324 (install-file "data/qtmips.desktop" apps)
325 (install-file "data/icons/qtmips_gui.svg"
326 (string-append icons "/scalable/apps"))
327 (install-file "data/icons/qtmips_gui.png"
328 (string-append icons "/48x48/apps"))
330 #:tests? #f)) ; test suite wants mips toolchain
332 `(("elfutils" ,elfutils)
334 (home-page "https://github.com/cvut/QtMips")
335 (synopsis "MIPS CPU emulator")
336 (description "This package contains a MIPS CPU emulator. The simulator
337 accepts ELF statically linked executables compiled for 32-bit big-endian
338 MIPS target, targeting mips-linux-gnu or mips-elf.")
339 (license license:gpl2+))) ; License file says GPL3
341 (define-public emulation-station
342 ;; No release for a long time, new commits fix build issues
343 (let ((commit "9cc42adff67946175d2b7e25c6ae69cc374e98a0")
346 (name "emulation-station")
347 (version (git-version "2.0.1" revision commit))
349 (method git-fetch) ; no tarball available
351 (url "https://github.com/Aloshi/EmulationStation")
352 (commit commit))) ; no version tag
353 (file-name (git-file-name name version))
356 "1cva0ns650v17lfn8in095zci6lc43d23f1x3mlzc41qfqa6mbd1"))))
357 (build-system cmake-build-system)
359 '(#:tests? #f)) ; no tests
361 `(("alsa-lib" ,alsa-lib)
365 ("freeimage" ,freeimage)
366 ("freetype" ,freetype)
369 (synopsis "Video game console emulator front-end")
370 (description "EmulationStation provides a graphical front-end to a large
371 number of video game console emulators. It features an interface that is
372 usable with any game controller that has at least 4 buttons, theming support,
373 and a game metadata scraper.")
374 (home-page "https://emulationstation.org")
375 (license license:expat))))
385 (url "https://github.com/higan-emu/higan")
386 (commit (string-append "v" version))))
387 (file-name (git-file-name name version))
389 (base32 "11rvm53c3p2f6zk8xbyv2j51xp8zmqnch7zravhj3fk590qrjrr2"))))
390 (build-system gnu-build-system)
392 `(("pkg-config" ,pkg-config)))
394 `(("alsa-lib" ,alsa-lib)
398 ("gtksourceview-2" ,gtksourceview-2)
399 ("libxrandr" ,libxrandr)
403 ("pulseaudio" ,pulseaudio)
407 (let ((build-phase (assoc-ref %standard-phases 'build))
408 (install-phase (assoc-ref %standard-phases 'install)))
409 (modify-phases %standard-phases
410 ;; The higan build system has no configure phase.
412 (add-before 'build 'chdir-to-higan
416 (add-before 'install 'create-/share/applications
417 (lambda* (#:key outputs #:allow-other-keys)
418 (let ((out (assoc-ref outputs "out")))
419 ;; It seems the author forgot to do this in the Makefile.
420 (mkdir-p (string-append out "/share/applications"))
422 (add-after 'install 'chdir-to-icarus
426 (add-after 'chdir-to-icarus 'build-icarus build-phase)
427 (add-after 'build-icarus 'install-icarus install-phase)
428 (add-after 'install-icarus 'wrap-higan-executable
429 (lambda* (#:key inputs outputs #:allow-other-keys)
430 (let* ((out (assoc-ref outputs "out"))
431 (bin (string-append out "/bin"))
432 (higan (string-append bin "/higan"))
433 (higan-original (string-append higan "-original"))
434 (bash (string-append (assoc-ref inputs "bash")
436 (coreutils (assoc-ref inputs "coreutils"))
437 (mkdir (string-append coreutils "/bin/mkdir"))
438 (cp (string-append coreutils "/bin/cp"))
439 (cp-r (string-append cp " -r --no-preserve=mode")))
440 ;; First, have the executable make sure ~/.local/share/higan
441 ;; contains up to date files. Higan insists on looking there
442 ;; for these data files.
443 (rename-file higan higan-original)
444 (with-output-to-file higan
449 ;; higan doesn't respect $XDG_DATA_HOME
450 mkdir " -p ~/.local/share\n"
451 cp-r " " out "/share/higan ~/.local/share\n"
452 "exec " higan-original))))
454 ;; Second, make sure higan will find icarus in PATH.
456 `("PATH" ":" prefix (,bin)))
460 (string-append "prefix=" (assoc-ref %outputs "out")))
461 ;; There is no test suite.
463 (home-page "https://github.com/higan-emu/higan/")
464 (synopsis "Multi-system emulator")
466 "higan is a multi-system emulator with an uncompromising focus on
467 accuracy and code readability.
469 It currently emulates the following systems: Famicom, Famicom Disk System,
470 Super Famicom, Super Game Boy, Game Boy, Game Boy Color, Game Boy Advance,
471 Game Boy Player, SG-1000, SC-3000, Master System, Game Gear, Mega Drive, Mega
472 CD, PC Engine, SuperGrafx, MSX, MSX2, ColecoVision, Neo Geo Pocket, Neo Geo
473 Pocket Color, WonderSwan, WonderSwan Color, SwanCrystal, Pocket Challenge
475 (license license:gpl3+)))
477 (define-public mednafen
484 (uri (string-append "https://mednafen.github.io/releases/files/"
485 "mednafen-" version ".tar.xz"))
487 (base32 "03zplcfvmnnv7grhacmr1zy789pb2wda36wylmzmar23g0zqbsix"))))
488 (build-system gnu-build-system)
492 ;; "--with-external-mpcdec"
493 "--with-external-lzo")))
495 `(("pkg-config" ,pkg-config)))
498 ;; ("libmpcdec" ,libmpcdec) FIXME: not recognized.
499 ("libsndfile" ,libsndfile)
503 (home-page "https://mednafen.github.io/")
504 (synopsis "Multi-system emulator utilizing OpenGL and SDL")
506 "Mednafen is a portable, utilizing OpenGL and SDL, argument-driven
507 multi-system emulator. Mednafen has the ability to remap hotkey functions and
508 virtual system inputs to a keyboard, a joystick, or both simultaneously. Save
509 states are supported, as is real-time game rewinding. Screen snapshots may be
510 taken, in the PNG file format, at the press of a button. Mednafen can record
511 audiovisual movies in the QuickTime file format, with several different
512 lossless codecs supported.
514 The following systems are supported:
519 @item Neo Geo Pocket (Color)
521 @item GameBoy (Color)
522 @item GameBoy Advance
523 @item Nintendo Entertainment System
524 @item Super Nintendo Entertainment System/Super Famicom
526 @item PC Engine/TurboGrafx 16 (CD)
530 @item Sega Genesis/Megadrive
531 @item Sega Master System
532 @item Sega Saturn (experimental, x86_64 only)
533 @item Sony PlayStation
535 ;; Main license is GPL2+. Some parts are BSD-3.
536 (license (list license:gpl2+ license:bsd-3))))
546 (url "https://github.com/mgba-emu/mgba")
548 (file-name (git-file-name name version))
550 (base32 "0rwlfjdr0rzbq4kaplvwsgyb8xq6nrzxss2c8xrgw9hqw3ymx4s3"))
551 (modules '((guix build utils)))
553 ;; Make sure we don't use the bundled software.
557 (let ((lib-subdir (string-append "src/third-party/" subdir)))
558 (delete-file-recursively lib-subdir)))
559 '("libpng" "lzma" "sqlite3" "zlib"))
561 (build-system cmake-build-system)
563 `(#:tests? #f ;no "test" target
565 (list "-DUSE_LZMA=OFF" ;do not use bundled LZMA
566 "-DUSE_LIBZIP=OFF"))) ;use "zlib" instead
567 (native-inputs `(("pkg-config" ,pkg-config)
568 ("qttools" ,qttools)))
569 (inputs `(("ffmpeg" ,ffmpeg)
570 ("imagemagick" ,imagemagick)
573 ("libepoxy" ,libepoxy)
579 ("qtmultimedia" ,qtmultimedia)
583 (home-page "https://mgba.io")
584 (synopsis "Game Boy Advance emulator")
586 "mGBA is an emulator for running Game Boy Advance games. It aims to be
587 faster and more accurate than many existing Game Boy Advance emulators, as
588 well as adding features that other emulators lack. It also supports Game Boy
589 and Game Boy Color games.")
590 ;; Code is mainly MPL 2.0. "blip_buf.c" is LGPL 2.1+, "inih.c" is
591 ;; BSD-3, and "discord-rpc" is Expat.
592 (license (list license:mpl2.0 license:lgpl2.1+ license:bsd-3 license:expat))))
594 (define-public sameboy
602 (url "https://github.com/LIJI32/SameBoy")
603 (commit (string-append "v" version))))
604 (file-name (git-file-name name version))
606 (base32 "04w8lybi7ssnax37ka4qw7pmcm7cgnmk90p9m73zbyp5chgpqqzc"))))
607 (build-system gnu-build-system)
611 ("pkg-config" ,pkg-config)))
615 `(#:tests? #f ; There are no tests
616 #:make-flags `("CC=gcc" "NATIVE_CC=gcc" "CONF=release"
617 ,(string-append "DATA_DIR="
618 (assoc-ref %outputs "out")
621 (modify-phases %standard-phases
624 (lambda* (#:key outputs #:allow-other-keys)
625 (let* ((out (assoc-ref outputs "out"))
626 (bin (string-append out "/bin"))
627 (data (string-append out "/share/sameboy/")))
628 (with-directory-excursion "build/bin/SDL"
629 (install-file "sameboy" bin)
630 (delete-file "sameboy")
631 (copy-recursively "." data))
633 (home-page "https://sameboy.github.io/")
634 (synopsis "Accurate Game Boy, Game Boy Color and Super Game Boy emulator")
635 (description "SameBoy is a user friendly Game Boy, Game Boy Color
636 and Super Game Boy emulator. SameBoy is accurate and includes a wide
637 range of debugging features. It has all the features one would expect
638 from an emulator---from save states to scaling filters.")
639 (license license:expat)))
641 (define-public mupen64plus-core
643 (name "mupen64plus-core")
649 (url "https://github.com/mupen64plus/mupen64plus-core")
651 (file-name (git-file-name name version))
653 (base32 "116fndl6652zrp1r6ag4xv3dzp1x52mlvadj8xwflq07fd5rhri1"))))
654 (build-system gnu-build-system)
656 `(("pkg-config" ,pkg-config)
659 `(("freetype" ,freetype)
667 (modify-phases %standard-phases
668 ;; The mupen64plus build system has no configure phase.
670 ;; Makefile is in a subdirectory.
672 'build 'chdir-to-project-directory
674 (chdir "projects/unix")
676 #:make-flags (let ((out (assoc-ref %outputs "out")))
677 (list "all" (string-append "PREFIX=" out)))
678 ;; There are no tests.
680 ;; As per the Makefile (in projects/unix/Makefile):
681 (supported-systems '("i686-linux" "x86_64-linux"))
682 (home-page "https://www.mupen64plus.org/")
683 (synopsis "Nintendo 64 emulator core library")
685 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
686 which is capable of accurately playing many games. This package contains the
688 (license license:gpl2+)))
690 (define-public mupen64plus-audio-sdl
692 (name "mupen64plus-audio-sdl")
698 (url "https://github.com/mupen64plus/mupen64plus-audio-sdl")
700 (file-name (git-file-name name version))
702 (base32 "0z19amfg9vr2pqjjri1ipc7hs681fzjcnb0f9y7bjhp5n8d7p6bb"))))
703 (build-system gnu-build-system)
705 `(("pkg-config" ,pkg-config)
708 `(("mupen64plus-core" ,mupen64plus-core)
712 (modify-phases %standard-phases
713 ;; The mupen64plus build system has no configure phase.
715 ;; Makefile is in a subdirectory.
717 'build 'cd-to-project-dir
719 (chdir "projects/unix"))))
721 (let ((out (assoc-ref %outputs "out"))
722 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
724 (string-append "PREFIX=" out)
725 (string-append "APIDIR=" m64p "/include/mupen64plus")))
726 ;; There are no tests.
728 (home-page "https://www.mupen64plus.org/")
729 (synopsis "Mupen64Plus SDL input plugin")
731 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
732 which is capable of accurately playing many games. This package contains the
734 (license license:gpl2+)))
736 (define-public mupen64plus-input-sdl
738 (name "mupen64plus-input-sdl")
744 (url "https://github.com/mupen64plus/mupen64plus-input-sdl")
746 (file-name (git-file-name name version))
748 (base32 "1dyazfbdjycdfslq8jixqiqhziw0rlkvach2r9dz91229jmkyc9c"))))
749 (build-system gnu-build-system)
753 `(("mupen64plus-core" ,mupen64plus-core)
757 (modify-phases %standard-phases
758 ;; The mupen64plus build system has no configure phase.
760 ;; Makefile is in a subdirectory.
762 'build 'cd-to-project-dir
764 (chdir "projects/unix"))))
766 (let ((out (assoc-ref %outputs "out"))
767 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
769 (string-append "PREFIX=" out)
770 (string-append "APIDIR=" m64p "/include/mupen64plus")))
771 ;; There are no tests.
773 (home-page "https://www.mupen64plus.org/")
774 (synopsis "Mupen64Plus SDL input plugin")
776 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
777 which is capable of accurately playing many games. This package contains the
779 (license license:gpl2+)))
781 (define-public mupen64plus-rsp-hle
783 (name "mupen64plus-rsp-hle")
789 (url "https://github.com/mupen64plus/mupen64plus-rsp-hle")
791 (file-name (git-file-name name version))
793 (base32 "0pi31qzjjp7aypdvvnz6ms18g09c4gqzxi6328zj8sji94b75gf0"))))
794 (build-system gnu-build-system)
796 `(("mupen64plus-core" ,mupen64plus-core)))
799 (modify-phases %standard-phases
800 ;; The mupen64plus build system has no configure phase.
802 ;; Makefile is in a subdirectory.
804 'build 'cd-to-project-dir
806 (chdir "projects/unix"))))
808 (let ((out (assoc-ref %outputs "out"))
809 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
811 (string-append "PREFIX=" out)
812 (string-append "APIDIR=" m64p "/include/mupen64plus")))
813 ;; There are no tests.
815 (home-page "https://www.mupen64plus.org/")
816 (synopsis "Mupen64Plus SDL input plugin")
818 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
819 which is capable of accurately playing many games. This package contains the
820 high-level emulation (HLE) RSP processor plugin.")
821 (license license:gpl2+)))
823 (define-public mupen64plus-rsp-z64
825 (name "mupen64plus-rsp-z64")
831 (url "https://github.com/mupen64plus/mupen64plus-rsp-z64")
833 (file-name (git-file-name name version))
835 (base32 "0nfyjns9k8xbg3aqs7593nfaxvlj72h3l8h467442xlk8ajfcylx"))))
836 (build-system gnu-build-system)
838 `(("mupen64plus-core" ,mupen64plus-core)))
841 (modify-phases %standard-phases
842 ;; The mupen64plus build system has no configure phase.
844 ;; Makefile is in a subdirectory.
846 'build 'cd-to-project-dir
848 (chdir "projects/unix"))))
850 (let ((out (assoc-ref %outputs "out"))
851 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
853 (string-append "PREFIX=" out)
854 (string-append "APIDIR=" m64p "/include/mupen64plus")))
855 ;; There are no tests.
857 (home-page "https://www.mupen64plus.org/")
858 (synopsis "Mupen64Plus SDL input plugin")
860 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
861 which is capable of accurately playing many games. This package contains the
862 Z64 RSP processor plugin.")
863 (license license:gpl2+)))
865 (define-public mupen64plus-video-arachnoid
867 (name "mupen64plus-video-arachnoid")
873 (url "https://github.com/mupen64plus/mupen64plus-video-arachnoid")
875 (file-name (git-file-name name version))
877 (base32 "1v9fqwpb6pawr8z5cm2ki7bqkks4iyr5c4jy4v5khj6h8zcv55gc"))))
878 (build-system gnu-build-system)
880 `(("pkg-config" ,pkg-config)
884 ("mupen64plus-core" ,mupen64plus-core)))
887 (modify-phases %standard-phases
888 ;; The mupen64plus build system has no configure phase.
890 ;; Makefile is in a subdirectory.
892 'build 'cd-to-project-dir
894 (chdir "projects/unix"))))
896 (let ((out (assoc-ref %outputs "out"))
897 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
899 (string-append "PREFIX=" out)
900 (string-append "APIDIR=" m64p "/include/mupen64plus")))
901 ;; There are no tests.
903 (home-page "https://www.mupen64plus.org/")
904 (synopsis "Mupen64Plus Rice Video plugin")
906 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
907 which is capable of accurately playing many games. This package contains the
908 Arachnoid video plugin.")
909 (license license:gpl2+)))
911 (define-public mupen64plus-video-glide64
913 (name "mupen64plus-video-glide64")
919 (url "https://github.com/mupen64plus/mupen64plus-video-glide64")
921 (file-name (git-file-name name version))
923 (base32 "0qn5za7g7796kh2ag3xpmhbqg0yf71g9liz6ks0rha8pz73lgs01"))))
924 (build-system gnu-build-system)
926 `(("pkg-config" ,pkg-config)
930 ("mupen64plus-core" ,mupen64plus-core)
934 (modify-phases %standard-phases
935 ;; The mupen64plus build system has no configure phase.
937 ;; Makefile is in a subdirectory.
939 'build 'cd-to-project-dir
941 (chdir "projects/unix")))
942 ;; XXX Should be unnecessary with the next release.
946 (substitute* "Makefile"
947 (("SDL_CONFIG = (.*)sdl-config" all prefix)
948 (string-append "SDL_CONFIG = " prefix "sdl2-config"))))))
950 (let ((out (assoc-ref %outputs "out"))
951 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
953 (string-append "PREFIX=" out)
954 (string-append "APIDIR=" m64p "/include/mupen64plus")))
955 ;; There are no tests.
957 (home-page "https://www.mupen64plus.org/")
958 (synopsis "Mupen64Plus Rice Video plugin")
960 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
961 which is capable of accurately playing many games. This package contains the
962 Glide64 video plugin.")
963 (license license:gpl2+)))
965 (define-public mupen64plus-video-glide64mk2
967 (name "mupen64plus-video-glide64mk2")
973 (url "https://github.com/mupen64plus/mupen64plus-video-glide64mk2")
975 (file-name (git-file-name name version))
977 (base32 "08pm28a36dpr0cvr8pzw0n5ksdazp7jqvlmqfy2lwb4dm0cwhkqd"))))
978 (build-system gnu-build-system)
980 `(("pkg-config" ,pkg-config)
986 ("mupen64plus-core" ,mupen64plus-core)
991 (modify-phases %standard-phases
992 ;; The mupen64plus build system has no configure phase.
994 ;; Makefile is in a subdirectory.
996 'build 'cd-to-project-dir
998 (chdir "projects/unix"))))
1000 (let ((out (assoc-ref %outputs "out"))
1001 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1003 (string-append "PREFIX=" out)
1004 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1005 ;; There are no tests.
1007 (home-page "https://www.mupen64plus.org/")
1008 (synopsis "Mupen64Plus Rice Video plugin")
1010 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1011 which is capable of accurately playing many games. This package contains the
1012 Glide64MK2 video plugin.")
1013 (license license:gpl2+)))
1015 (define-public mupen64plus-video-rice
1017 (name "mupen64plus-video-rice")
1023 (url "https://github.com/mupen64plus/mupen64plus-video-rice")
1025 (file-name (git-file-name name version))
1027 (base32 "0rpmbcq67gsj5h5jjis146378qc1mskskvx20y1ikx59yhbamh13"))))
1028 (build-system gnu-build-system)
1030 `(("pkg-config" ,pkg-config)
1033 `(("libpng" ,libpng)
1035 ("mupen64plus-core" ,mupen64plus-core)
1039 (modify-phases %standard-phases
1040 ;; The mupen64plus build system has no configure phase.
1042 ;; Makefile is in a subdirectory.
1044 'build 'cd-to-project-dir
1046 (chdir "projects/unix"))))
1048 (let ((out (assoc-ref %outputs "out"))
1049 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1051 (string-append "PREFIX=" out)
1052 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1053 ;; There are no tests.
1055 (home-page "https://www.mupen64plus.org/")
1056 (synopsis "Mupen64Plus Rice Video plugin")
1058 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1059 which is capable of accurately playing many games. This package contains the
1060 Rice Video plugin.")
1061 (license license:gpl2+)))
1063 (define-public mupen64plus-video-z64
1065 (name "mupen64plus-video-z64")
1071 (url "https://github.com/mupen64plus/mupen64plus-video-z64")
1073 (file-name (git-file-name name version))
1075 (base32 "04qa2fdd6dakpk2v0d4l80xh9b4h8gm71g80c0wyyxdhmhwk1r9c"))
1076 (patches (search-patches "mupen64plus-video-z64-glew-correct-path.patch"))))
1077 (build-system gnu-build-system)
1079 `(("pkg-config" ,pkg-config)
1083 ("mupen64plus-core" ,mupen64plus-core)
1087 (modify-phases %standard-phases
1088 ;; The mupen64plus build system has no configure phase.
1090 ;; Makefile is in a subdirectory.
1092 'build 'cd-to-project-dir
1094 (chdir "projects/unix")))
1095 ;; XXX Should be unnecessary with the next release.
1099 (substitute* "Makefile"
1100 (("SDL_CONFIG = (.*)sdl-config" all prefix)
1101 (string-append "SDL_CONFIG = " prefix "sdl2-config"))))))
1103 (let ((out (assoc-ref %outputs "out"))
1104 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1106 (string-append "PREFIX=" out)
1107 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1108 ;; There are no tests.
1110 (home-page "https://www.mupen64plus.org/")
1111 (synopsis "Mupen64Plus Z64 video plugin")
1113 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1114 which is capable of accurately playing many games. This package contains the
1116 (license license:gpl2+)))
1118 (define-public mupen64plus-ui-console
1120 (name "mupen64plus-ui-console")
1126 (url "https://github.com/mupen64plus/mupen64plus-ui-console")
1128 (file-name (git-file-name name version))
1130 (base32 "0vrf98qa6a0y3647kslsv644fag233dxh5dcr1yncjiiwickcr5a"))
1131 (patches (search-patches "mupen64plus-ui-console-notice.patch"))))
1132 (build-system gnu-build-system)
1134 `(("pkg-config" ,pkg-config)
1138 ;; Mupen64Plus supports a single data directory and a single plugin
1139 ;; directory in its configuration, yet we need data and plugin files from
1140 ;; a variety of packages. The best way to deal with this is to install
1141 ;; all packages from which data and plugin files are needed into one's
1142 ;; profile, and point the configuration there. Hence, propagate the most
1143 ;; important packages here to save the user from the bother. The patch
1144 ;; mupen64plus-ui-console-notice also gives users instructions on what
1145 ;; they need to do in order to point the configuration to their profile.
1147 `(("mupen64plus-core" ,mupen64plus-core)
1148 ("mupen64plus-audio-sdl" ,mupen64plus-audio-sdl)
1149 ("mupen64plus-input-sdl" ,mupen64plus-input-sdl)
1150 ("mupen64plus-rsp-hle" ,mupen64plus-rsp-hle)
1151 ("mupen64plus-video-glide64" ,mupen64plus-video-glide64)
1152 ("mupen64plus-video-glide64mk2" ,mupen64plus-video-glide64mk2)
1153 ("mupen64plus-video-rice" ,mupen64plus-video-rice)))
1156 (modify-phases %standard-phases
1157 ;; The mupen64plus build system has no configure phase.
1159 ;; Makefile is in a subdirectory.
1161 'build 'cd-to-project-dir
1163 (chdir "projects/unix"))))
1165 (let ((out (assoc-ref %outputs "out"))
1166 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1168 (string-append "PREFIX=" out)
1169 (string-append "APIDIR=" m64p "/include/mupen64plus")
1170 ;; Trailing slash matters here.
1171 (string-append "COREDIR=" m64p "/lib/")))
1172 ;; There are no tests.
1174 (home-page "https://www.mupen64plus.org/")
1175 (synopsis "Mupen64Plus command line user interface")
1177 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1178 which is capable of accurately playing many games. This package contains the
1179 command line user interface. Installing this package is the easiest way
1180 towards a working Mupen64Plus for casual users.")
1181 (license license:gpl2+)))
1183 (define-public nestopia-ue
1185 (name "nestopia-ue")
1191 (url "https://github.com/rdanbrook/nestopia")
1193 (file-name (git-file-name name version))
1195 (base32 "19c8vx5yxbysl0sszk5blfngwacshdgwbf44g1qaxvq8ywiyxmb4"))
1196 (modules '((guix build utils)))
1199 ;; We don't need libretro for the GNU/Linux build.
1200 (delete-file-recursively "libretro")
1202 (build-system cmake-build-system)
1204 `(("pkg-config" ,pkg-config)))
1208 ("libarchive" ,libarchive)
1209 ("libepoxy" ,libepoxy)
1214 (modify-phases %standard-phases
1215 ;; This fixes the file chooser crash that happens with GTK 3.
1216 (add-after 'install 'wrap-program
1217 (lambda* (#:key inputs outputs #:allow-other-keys)
1218 (let* ((out (assoc-ref outputs "out"))
1219 (nestopia (string-append out "/bin/nestopia"))
1220 (gtk (assoc-ref inputs "gtk+"))
1221 (gtk-share (string-append gtk "/share")))
1222 (wrap-program nestopia
1223 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))))))
1224 ;; There are no tests.
1226 (home-page "http://0ldsk00l.ca/nestopia/")
1227 (synopsis "Nintendo Entertainment System (NES/Famicom) emulator")
1229 "Nestopia UE (Undead Edition) is a fork of the Nintendo Entertainment
1230 System (NES/Famicom) emulator Nestopia, with enhancements from members of the
1231 emulation community. It provides highly accurate emulation.")
1232 (license license:gpl2+)))
1234 (define-public retroarch
1242 (url "https://github.com/libretro/RetroArch")
1243 (commit (string-append "v" version))))
1244 (file-name (git-file-name name version))
1246 (base32 "0y7rcpz7psf8k3agsrq277jdm651vbnn9xpqvmj2in1a786idya7"))
1248 (search-patches "retroarch-disable-online-updater.patch"))
1249 (modules '((guix build utils)))
1252 ;; Don't suggest using the Online Updater if available: it never
1253 ;; is. This disables translation of this particular message.
1254 (substitute* (find-files "menu/drivers" "\\.c$")
1255 (("msg_hash_to_str\\(MSG_MISSING_ASSETS\\)")
1256 "\"Warning: Missing assets, go get some\""))
1258 (build-system gnu-build-system)
1260 `(#:tests? #f ; no tests
1262 (modify-phases %standard-phases
1264 (lambda* (#:key inputs outputs #:allow-other-keys)
1265 (let* ((out (assoc-ref outputs "out"))
1266 (etc (string-append out "/etc"))
1267 (vulkan (assoc-ref inputs "vulkan-loader"))
1268 (wayland-protocols (assoc-ref inputs "wayland-protocols")))
1269 ;; Hard-code some store file names.
1270 (substitute* "gfx/common/vulkan_common.c"
1271 (("libvulkan.so") (string-append vulkan "/lib/libvulkan.so")))
1272 (substitute* "gfx/common/wayland/generate_wayland_protos.sh"
1273 (("/usr/local/share/wayland-protocols")
1274 (string-append wayland-protocols "/share/wayland-protocols")))
1275 (substitute* "qb/qb.libs.sh"
1276 (("/bin/true") (which "true")))
1279 (substitute* '("libretro-common/file/archive_file_zlib.c"
1280 "libretro-common/streams/trans_stream_zlib.c")
1281 (("<compat/zlib.h>") "<zlib.h>"))
1283 ;; The configure script does not yet accept the extra arguments
1284 ;; (like ‘CONFIG_SHELL=’) passed by the default configure phase.
1287 ,@(if (string-prefix? "armhf" (or (%current-target-system)
1289 '("--enable-neon" "--enable-floathard")
1291 (string-append "--prefix=" out)
1292 (string-append "--global-config-dir=" etc)
1293 "--disable-builtinminiupnpc")))))))
1295 `(("alsa-lib" ,alsa-lib)
1297 ("freetype" ,freetype)
1298 ("libxinerama" ,libxinerama)
1299 ("libxkbcommon" ,libxkbcommon)
1300 ("libxml2" ,libxml2)
1301 ("libxrandr" ,libxrandr)
1304 ("miniupnpc" ,miniupnpc)
1306 ("pulseaudio" ,pulseaudio)
1311 ("vulkan-loader" ,vulkan-loader)
1312 ("wayland" ,wayland)
1315 `(("pkg-config" ,pkg-config)
1316 ("wayland-protocols" ,wayland-protocols)
1318 (home-page "https://www.libretro.com/")
1319 (synopsis "Reference frontend for the libretro API")
1321 "Libretro is a simple but powerful development interface that allows for
1322 the easy creation of emulators, games and multimedia applications that can plug
1323 straight into any libretro-compatible frontend. RetroArch is the official
1324 reference frontend for the libretro API, currently used by most as a modular
1325 multi-system game/emulator system.")
1326 (license license:gpl3+)))
1328 (define-public scummvm
1335 (uri (string-append "http://www.scummvm.org/frs/scummvm/" version
1336 "/scummvm-" version ".tar.xz"))
1338 (base32 "11vknasm5dna2vqr6gk343qynh7nhsq3kf60zayarn1vb5z6as8l"))))
1339 (build-system gnu-build-system)
1341 `(#:tests? #f ;require "git"
1342 #:configure-flags (list "--enable-release") ;for optimizations
1344 (modify-phases %standard-phases
1346 ;; configure does not work followed by both "SHELL=..." and
1347 ;; "CONFIG_SHELL=..."; set environment variables instead
1348 (lambda* (#:key outputs configure-flags #:allow-other-keys)
1349 (let* ((out (assoc-ref outputs "out"))
1350 (bash (which "bash"))
1351 (flags `(,(string-append "--prefix=" out)
1352 ,@configure-flags)))
1353 (setenv "SHELL" bash)
1354 (setenv "CONFIG_SHELL" bash)
1355 (apply invoke "./configure" flags)))))))
1358 ("pkg-config" ,pkg-config)))
1360 `(("alsa-lib" ,alsa-lib)
1362 ("fluidsynth" ,fluidsynth)
1363 ("freetype" ,freetype)
1364 ("fribidi" ,fribidi)
1367 ("libjpeg-turbo" ,libjpeg-turbo)
1369 ("libmpeg2" ,libmpeg2)
1372 ("libtheora" ,libtheora)
1373 ("libvorbis" ,libvorbis)
1374 ("sdl2" ,(sdl-union (list sdl2 sdl2-net)))
1376 (home-page "https://www.scummvm.org/")
1377 (synopsis "Engine for several graphical adventure games")
1378 (description "ScummVM is a program which allows you to run certain
1379 classic graphical point-and-click adventure games, provided you
1380 already have their data files. The clever part about this: ScummVM
1381 just replaces the executables shipped with the games, allowing you to
1382 play them on systems for which they were never designed!")
1383 (license license:gpl2+)))
1393 (url "https://github.com/mamedev/mame")
1394 (commit (apply string-append "mame" (string-split version #\.)))))
1395 (file-name (git-file-name name version))
1397 (base32 "1n61v1yqmc69399khcm8gdabqaz8rwwj822m8vm5mbyxnw92icqg"))
1398 (modules '((guix build utils)))
1400 ;; Remove bundled libraries.
1402 (with-directory-excursion "3rdparty"
1403 (for-each delete-file-recursively
1404 '("asio" "expat" "glm" "libflac" "libjpeg" "lua"
1405 "portaudio" "portmidi" "pugixml" "rapidjson" "SDL2"
1406 "SDL2-override" "sqlite3" "utf8proc" "zlib")))
1408 (build-system gnu-build-system)
1412 ;; A 'strict-overflow' error pops up on i686 so disable '-Werror'.
1414 (string-append "QT_HOME=" (assoc-ref %build-inputs "qtbase"))
1415 (string-append "SDL_INI_PATH="
1416 (assoc-ref %outputs "out")
1419 (string-append "USE_SYSTEM_LIB_" (string-upcase lib) "=1"))
1420 '("asio" "expat" "flac" "glm" "jpeg" "lua" "portaudio" "portmidi"
1421 "pugixml" "rapidjson" "sqlite3" "utf8proc" "zlib")))
1422 #:tests? #f ;no test in regular release
1424 (modify-phases %standard-phases
1426 (add-after 'build 'build-documentation
1427 (lambda _ (invoke "make" "-C" "docs" "man" "info")))
1429 ;; Upstream does not provide an installation phase.
1430 (lambda* (#:key outputs #:allow-other-keys)
1431 (let* ((out (assoc-ref outputs "out"))
1432 (share (string-append out "/share/mame")))
1434 (for-each (lambda (dir)
1435 (copy-recursively dir (string-append share "/" dir)))
1436 '("artwork" "bgfx" "ctrlr" "hash" "ini" "language"
1437 "plugins" "samples"))
1438 (let ((keymaps (string-append share "/keymaps")))
1439 (for-each (lambda (file) (install-file file keymaps))
1440 (find-files "keymaps" ".*LINUX\\.map")))
1441 (let ((fonts (string-append share "/fonts")))
1442 (install-file "uismall.bdf" fonts))
1443 (when (file-exists? "mame64")
1444 (rename-file "mame64" "mame"))
1445 (install-file "mame" (string-append out "/bin")))
1447 (add-after 'install 'install-documentation
1448 (lambda* (#:key outputs #:allow-other-keys)
1449 (let* ((out (assoc-ref outputs "out"))
1450 (man (string-append out "/share/man/man1"))
1451 (info (string-append out "/share/info")))
1452 (install-file "docs/build/man/MAME.1" man)
1453 (install-file "docs/build/texinfo/MAME.info" info))
1455 (add-after 'install 'install-ini-file
1456 ;; Generate an ini file so as to set some directories (e.g., roms)
1457 ;; to a writable location, i.e., "$HOME/.mame/" and "$HOME/mame/".
1459 ;; XXX: We need to insert absolute references to the store. It can
1460 ;; be an issue if they leak into user's home directory, e.g., with
1461 ;; "mame -createconfig" and the package is later GC'ed.
1462 (lambda* (#:key outputs #:allow-other-keys)
1463 (let* ((out (assoc-ref outputs "out"))
1464 (share (string-append out "/share/mame"))
1465 (ini (string-append share "/ini")))
1466 (with-output-to-file (string-append ini "/mame.ini")
1469 "inipath $HOME/.mame;~a/ini~@
1470 homepath $HOME/mame~@
1471 rompath $HOME/mame/roms~@
1472 samplepath $HOME/mame/samples;~a/samples~@
1473 cheatpath $HOME/mame/cheat~@
1474 artpath $HOME/mame/artwork;~a/artwork~@
1475 crosshairpath $HOME/mame/crosshair~@
1476 snapshot_directory $HOME/mame/snapshots~@
1478 fontpath $HOME/mame/fonts;~a/fonts~@
1479 ctrlrpath $HOME/mame/ctrlr;~a/ctrlr~@
1481 pluginspath $HOME/mame/plugins;~a/plugins~@
1482 languagepath ~a/language~@
1483 cfg_directory $HOME/.mame/cfg~@
1484 nvram_directory $HOME/.mame/nvram~@
1485 input_directory $HOME/.mame/inp~@
1486 state_directory $HOME/.mame/sta~@
1487 diff_directory $HOME/.mame/diff~@
1488 comment_directory $HOME/.mame/comments~%"
1489 share share share share share share share share
1491 (with-output-to-file (string-append ini "/ui.ini")
1494 "historypath $HOME/mame/history~@
1495 categorypath $HOME/mame/folders~@
1496 cabinets_directory $HOME/mame/cabinets~@
1497 cpanels_directory $HOME/mame/cpanel~@
1498 pcbs_directory $HOME/mame/pcb~@
1499 flyers_directory $HOME/mame/flyers~@
1500 titles_directory $HOME/mame/titles~@
1501 ends_directory $HOME/mame/ends~@
1502 marquees_directory $HOME/mame/marquees~@
1503 artwork_preview_directory $HOME/mame/artpreview~@
1504 bosses_directory $HOME/mame/bosses~@
1505 logos_directory $HOME/mame/logo~@
1506 scores_directory $HOME/mame/scores~@
1507 versus_directory $HOME/mame/versus~@
1508 gameover_directory $HOME/mame/gameover~@
1509 howto_directory $HOME/mame/howto~@
1510 select_directory $HOME/mame/select~@
1511 icons_directory $HOME/mame/icons~@
1512 covers_directory $HOME/mame/covers~@
1513 ui_path $HOME/.mame/ui~%")))
1515 (add-after 'install 'install-desktop-file
1516 (lambda* (#:key outputs #:allow-other-keys)
1517 (let* ((out (assoc-ref outputs "out"))
1518 (desktop (string-append out "/share/applications"))
1519 (executable (string-append out "/bin/mame")))
1521 (with-output-to-file (string-append desktop "/mame.desktop")
1526 Comment=Multi-purpose emulation framework~@
1531 Categories=Game;Emulator;~@
1532 Keywords=Game;Emulator;Arcade;~%"
1536 `(("pkg-config" ,pkg-config)
1537 ("sphinx" ,python-sphinx)
1538 ("sphinxcontrib-svg2pdfconverter" ,python-sphinxcontrib-svg2pdfconverter)
1539 ("texinfo" ,texinfo)))
1541 `(("alsa-lib" ,alsa-lib)
1545 ("fontconfig" ,fontconfig)
1547 ("libjpeg" ,libjpeg-turbo)
1549 ("libxinerama" ,libxinerama)
1551 ("portaudio" ,portaudio)
1552 ("portmidi" ,portmidi)
1553 ("pugixml" ,pugixml)
1554 ("python-wrapper" ,python-wrapper)
1556 ("rapidjson" ,rapidjson)
1557 ("sdl" ,(sdl-union (list sdl2 sdl2-ttf)))
1559 ("utf8proc" ,utf8proc)
1561 (home-page "https://www.mamedev.org")
1562 (synopsis "Multi-purpose emulation framework")
1563 (description "MAME's purpose is to preserve decades of software
1564 history. As electronic technology continues to rush forward, MAME
1565 prevents this important @emph{vintage} software from being lost and
1566 forgotten. This is achieved by documenting the hardware and how it
1567 functions. The source code to MAME serves as this documentation.")
1568 ;; The MAME project as a whole is distributed under the terms of GPL2+.
1569 ;; However, over 90% of the files are under Expat license. Also, artwork,
1570 ;; keymaps, languages and samples are under CC0.
1571 (license (list license:gpl2+ license:expat license:cc0))))
1573 (define-public gnome-arcade
1575 (name "gnome-arcade")
1581 (url "https://github.com/strippato/gnome-arcade")
1582 (commit (string-append "v." version))))
1583 (file-name (git-file-name name version))
1586 "1qc01a62p65qb6mwjfmxqsd6n3rglsfwrjhsp25nr7q54107n55l"))))
1587 (build-system cmake-build-system)
1589 `(#:tests? #f ; No tests.
1590 #:configure-flags (list
1591 (string-append "-DMAME_BIN=\""
1592 (assoc-ref %build-inputs "mame")
1594 (string-append "-DAPP_RES=\""
1595 (assoc-ref %outputs "out")
1596 "/share/gnome-arcade/\""))
1598 (modify-phases %standard-phases
1599 (add-before 'build 'fix-paths
1600 (lambda* (#:key outputs #:allow-other-keys)
1601 (let ((out (assoc-ref outputs "out")))
1603 (substitute* "../source/src/config.c"
1604 (("/usr/share") (string-append out "/share"))))
1607 (lambda* (#:key outputs #:allow-other-keys)
1608 (let* ((out (assoc-ref outputs "out"))
1609 (bin (string-append out "/bin"))
1610 (rom (string-append out "/share/gnome-arcade/data/rom"))
1611 (tile (string-append out "/share/gnome-arcade/data/tile")))
1613 (install-file "../gnome-arcade" bin)
1614 (copy-recursively "../source/res"
1615 (string-append out "/share/gnome-arcade/res"))
1617 (install-file "../source/data/rom/ROM.TXT" rom)
1619 (install-file "../source/data/tile/TILE.TXT" tile))
1622 `(("pkg-config" ,pkg-config)))
1626 ("libevdev" ,libevdev)
1628 ("libarchive" ,libarchive)))
1629 (home-page "https://github.com/strippato/gnome-arcade")
1630 (synopsis "Minimal MAME frontend")
1632 "A minimal GTK+ frontend for MAME, the multi-purpose arcade and console
1634 (license license:gpl3+)))
1636 (define-public pcsxr
1637 ;; No release since 2017.
1638 (let ((commit "6484236cb0281e8040ff6c8078c87899a3407534"))
1641 ;; Version is tagged here: https://github.com/frealgagu/PCSX-Reloaded
1647 (url "https://github.com/pcsxr/PCSX-Reloaded")
1651 "138mayp7zi9v4l3lm5f6xxkds619w1fgg769zm8s45c84jbz7dza"))
1652 (file-name (git-file-name name commit))))
1653 (build-system cmake-build-system)
1655 `(#:tests? #f ;no "test" target
1657 (list "-DSND_BACKEND=pulse"
1658 "-DENABLE_CCDDA='ON'"
1659 "-DUSE_LIBARCHIVE='ON'"
1660 "-DUSE_LIBCDIO='ON'")
1662 (modify-phases %standard-phases
1663 (add-after 'unpack 'cd-subdir
1664 (lambda _ (chdir "pcsxr") #t))
1665 (add-before 'configure 'fix-cdio-lookup
1666 (lambda* (#:key inputs #:allow-other-keys)
1667 (substitute* "cmake/FindCdio.cmake"
1668 (("/usr/include/cdio")
1669 (string-append (assoc-ref inputs "libcdio") "/include/cdio")))
1671 (add-after 'install 'wrap-program
1672 (lambda* (#:key inputs outputs #:allow-other-keys)
1673 (wrap-program (string-append (assoc-ref outputs "out")
1675 ;; For GtkFileChooserDialog.
1676 `("GSETTINGS_SCHEMA_DIR" =
1677 (,(string-append (assoc-ref inputs "gtk+")
1678 "/share/glib-2.0/schemas"))))
1681 `(("pkg-config" ,pkg-config)
1682 ("intltool" ,intltool)
1683 ("glib" ,glib "bin")))
1685 `(("libcdio" ,libcdio)
1690 ("libarchive" ,libarchive)
1691 ("pulseaudio" ,pulseaudio)))
1692 (home-page "https://archive.codeplex.com/?p=pcsxr")
1693 (synopsis "PlayStation emulator")
1695 "A PlayStation emulator based on PCSX-df Project with bugfixes and
1697 (license license:gpl2+))))
1699 (define-public gens-gs
1706 (uri (string-append "https://retrocdn.net/images/6/6d/Gens-gs-r"
1710 "1ha5s6d3y7s9aq9f4zmn9p88109c3mrj36z2w68jhiw5xrxws833"))))
1711 (build-system glib-or-gtk-build-system)
1713 `(#:system "i686-linux"
1715 (modify-phases %standard-phases
1716 (add-after 'unpack 'fix-CFLAGS
1718 ;; Remove GTK API deprecation flags that cause build errors.
1719 (substitute* "configure"
1720 (("GTK_CFLAGS=\"\\$GTK_CFLAGS .*\"") ""))
1723 `(("pkg-config" ,pkg-config)
1728 (home-page "https://segaretro.org/Gens/GS")
1729 (synopsis "Emulator for Sega Genesis/Mega Drive systems")
1731 "Gens/GS is an emulator for the Mega Drive (also known as Sega Genesis),
1732 derived from Gens. Project goals include clean source code, combined features
1733 from various forks of Gens, and improved platform portability.")
1734 (supported-systems '("i686-linux" "x86_64-linux"))
1735 (license license:gpl2+)))
1737 (define-public bsnes
1745 (url "https://github.com/bsnes-emu/bsnes")
1746 (commit (string-append "v" version))))
1747 (file-name (git-file-name name version))
1750 "0j054x38fwai61vj36sc04r3zkzay5acq2cgd9zqv5hs51s36g5b"))))
1751 (build-system gnu-build-system)
1753 `(#:make-flags (list "-C" "bsnes"
1754 (string-append "prefix=" (assoc-ref %outputs "out")))
1755 #:tests? #f ; No tests.
1756 #:phases (modify-phases %standard-phases
1757 (delete 'configure))))
1759 `(("pkg-config" ,pkg-config)))
1761 `(("alsa-lib" ,alsa-lib)
1765 ("gtksourceview-2" ,gtksourceview-2)
1766 ("libxrandr" ,libxrandr)
1769 ("pulseaudio" ,pulseaudio)
1771 (home-page "https://bsnes.dev/")
1772 (synopsis "Emulator for the Super Nintendo / Super Famicom systems")
1774 "bsnes is a Super Nintendo / Super Famicom emulator that focuses on
1775 performance, features, and ease of use.")
1776 (license license:gpl3)))
1778 ;; python-pwntools requires a -rc release of unicorn
1779 (define-public unicorn
1782 (if (member (%current-system) '("x86_64-linux" "i686-linux"))
1787 (version "1.0.2-rc4")
1788 ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications.
1793 (url "https://github.com/unicorn-engine/unicorn")
1795 (file-name (git-file-name name version))
1798 "17nyccgk7hpc4hab24yn57f1xnmr7kq4px98zbp2bkwcrxny8gwy"))))
1799 (outputs '("out" "python"))
1800 ;; The main library is not written in Python, but the build process has
1801 ;; little in common with any defined build system, so we might as well
1802 ;; build on top of python-build-system and make use of all
1803 ;; the Python-specific phases that can be reused.
1804 (build-system python-build-system)
1806 `(#:modules ((srfi srfi-26)
1807 (guix build python-build-system)
1810 (modify-phases %standard-phases
1811 (add-after 'unpack 'install-bindings-to-python-output
1812 (lambda* (#:key outputs #:allow-other-keys)
1813 ;; python-build-system will build the bindings and install them to
1814 ;; the "out" output, so change the build-internal names of the
1817 ;; TODO: remove this once #40469 lands, through the core-updates
1818 ;; holding zone, on master.
1819 (set-car! (assoc "out" outputs) "lib")
1820 (set-car! (assoc "python" outputs) "out")
1822 (add-before 'build 'build-library
1823 (lambda* (#:key inputs #:allow-other-keys)
1825 "-j" (number->string (parallel-job-count))
1828 (add-after 'build-library 'install-library
1829 (lambda* (#:key outputs #:allow-other-keys)
1830 (invoke "make" "install"
1834 (assoc-ref outputs "lib")))))
1835 (add-before 'build 'prepare-bindings
1836 (lambda* (#:key outputs #:allow-other-keys)
1837 (chdir "bindings/python")
1838 ;; Set this environment variable so that the Python bindings
1839 ;; don't build their own copy of the shared object, but use
1840 ;; a dummy value such that the bindings test suite uses the
1841 ;; same mechanism for loading the library as any other user.
1842 (setenv "LIBUNICORN_PATH" "1")
1843 (substitute* "unicorn/unicorn.py"
1844 (("_path_list = \\[.*")
1847 (assoc-ref outputs "lib")
1848 ;; eat the rest of the list
1851 (add-before 'check 'check-library
1852 (lambda* (#:key outputs #:allow-other-keys)
1855 (with-directory-excursion
1856 (string-append "../../tests/" suite)
1857 (invoke "make" "test" "CC=gcc"
1859 '("AS=i686-unknown-linux-gnu-as"
1860 "OBJCOPY=i686-unknown-linux-gnu-objcopy")))))
1861 '("unit" "regress"))
1863 (add-after 'install 'install-samples
1864 (lambda* (#:key outputs #:allow-other-keys)
1865 (let* ((python-samples (find-files "." "sample_.*"))
1866 (c-samples (find-files "../../samples" ".*\\.c"))
1868 (string-append (assoc-ref outputs "out")
1869 "/share/doc/unicorn/samples"))
1871 (string-append (assoc-ref outputs "lib")
1872 "/share/doc/unicorn/samples")))
1873 (for-each (cut install-file <> c-docdir) c-samples)
1874 (for-each (cut install-file <> python-docdir) python-samples)
1877 ;; NOTE: cross-binutils needs to be wrapped with unless-x86, as otherwise
1878 ;; the linker provided by the package will be used, circumventing the ld-wrapper.
1880 `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu"))))
1882 ("hexdump-for-tests" ,util-linux)))
1883 (home-page "http://www.unicorn-engine.org")
1884 (synopsis "Unicorn CPU emulator framework")
1886 "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator
1887 framework based on QEMU.")
1888 (license license:gpl2+))))
1890 (define-public ppsspp
1898 (url "https://github.com/hrydgard/ppsspp")
1899 (commit (string-append "v" version))))
1901 (base32 "0znxlbj6cfw7gn0naay0mzhc0k5saw8nrwpspcn7gap1023p06w2"))
1902 (file-name (git-file-name name version))
1904 (search-patches "ppsspp-disable-upgrade-and-gold.patch"))
1905 (modules '((guix build utils)))
1908 ;; The following is quite a heavy-handed way of unbundling PPSSPP.
1909 ;; There are still a number of external sources, that we don't
1910 ;; remove here. Some may be packaged, others are not.
1911 ;; First, we patch existing sources to include the right headers.
1912 (substitute* (append (list "ext/native/thin3d/vulkan_utils.cpp"
1913 "ext/native/thin3d/thin3d_vulkan.cpp")
1914 (find-files "Common" ".*\\.(h|cpp)")
1915 (find-files "Core" ".*\\.(h|cpp)")
1916 (find-files "GPU" ".*\\.(h|cpp)")
1917 (find-files "SDL" ".*\\.(h|cpp)")
1918 (find-files "UI" ".*\\.(h|cpp)"))
1919 ;; These headers are all hard-coded in the original source.
1920 (("ext/cityhash/") "")
1921 (("ext/glslang/") "")
1922 (("ext/SPIRV-Cross/") "spirv_cross/")
1923 (("ext/vulkan/") "vulkan/")
1924 (("ext/xxhash.h") "xxhash.h")
1925 ;; These definitions do not actually exist in the Vulkan headers,
1926 ;; but PPSSPP defines them in ext/vulkan.
1927 (("VK_FORMAT_BEGIN_RANGE") "VK_FORMAT_UNDEFINED")
1928 (("VK_FORMAT_END_RANGE") "VK_FORMAT_ASTC_12x12_SRGB_BLOCK"))
1929 ;; Next, we patch CMakeLists.
1930 (substitute* "CMakeLists.txt"
1931 ;; Drop unnecessary includes and targets.
1932 (("include_directories\\(ext/glslang\\)") "")
1933 (("include_directories\\(ext/xxhash\\)") "")
1934 (("include_directories\\(ext/cityhash\\)") "")
1935 (("set_target_properties\\(cityhash .*\\)") "")
1936 ;; Fix linking to GLEW.
1937 (("TARGET Ext::GLEW") "true")
1938 (("target_link_libraries\\(native Ext::GLEW\\)")
1939 "find_package(GLEW)\ntarget_link_libraries(native GLEW::GLEW)")
1940 (("Ext::Snappy") "snappy")
1941 ;; Don't search for cityhash/xxhash, we already have them.
1942 (("add_library\\((city|xx)hash STATIC") "if()\nendif(")
1943 (("ext/xxhash\\.[ch]") "")
1944 (("ext/native/ext/cityhash/.*\\.(cpp|h)") "")
1945 ;; Link all of spirv-cross.
1946 (("spirv-cross-glsl" all)
1948 " spirv-cross-core spirv-cross-cpp"
1949 " spirv-cross-reflect spirv-cross-util")))
1950 (substitute* "ext/CMakeLists.txt"
1951 (("add_subdirectory\\(glew\\)") "")
1952 (("add_subdirectory\\(glslang( [A-Z_]*)*\\)") "")
1953 (("add_subdirectory\\(snappy\\)") "")
1954 (("add_subdirectory\\(SPIRV-Cross-build\\)") ""))
1955 ;; Finally, we can delete the bundled sources.
1956 (for-each delete-file-recursively
1959 "ext/glslang" "ext/glslang-build"
1960 "ext/native/ext/cityhash"
1961 "ext/native/ext/libpng17"
1962 "ext/native/ext/libzip"
1964 "ext/SPIRV-Cross" "ext/SPIRV-Cross-build"
1969 ;; Since we are not including git as an input, PPSSPP is confused
1970 ;; about its version. Let's fix that here.
1971 (substitute* "git-version.cmake"
1972 (("unknown") ,version))))))
1973 (build-system cmake-build-system)
1975 `(("pkg-config" ,pkg-config)
1976 ("python" ,python)))
1978 `(("cityhash" ,cityhash)
1981 ("glslang" ,glslang)
1987 ("spirv-cross" ,spirv-cross)
1988 ("vulkan-headers" ,vulkan-headers)
1989 ("vulkan-loader" ,vulkan-loader)
1992 ;; TODO: unbundle armips.
1993 ("armips-source" ,(package-source armips))
1995 ,(let ((commit "1c64b8fbd3cb6bd87935eb53f302f7de6f86e209"))
1999 (url "https://github.com/hrydgard/ppsspp-lang")
2002 (base32 "0rprn3yd8xfrvi0fm62sgpqa8n73jk7zmlscp8cp0h2fawqpiamd"))
2003 (file-name (git-file-name "ppsspp-lang" commit)))))
2005 ,(let ((commit "328b839c7243e7f733f9eae88d059485e3d808e7"))
2009 (url "https://github.com/hrydgard/pspautotests")
2012 (base32 "1gj1kr5ijxrqwvz7c41phskjr70ndp8iz0gr8c3xxsd8p9z5gdvm"))
2013 (file-name (git-file-name "pspautotests" commit)))))))
2015 `(#:out-of-source? #f
2016 #:configure-flags (list "-DUSE_DISCORD=OFF"
2017 "-DUSE_SYSTEM_FFMPEG=ON"
2018 "-DUSE_SYSTEM_LIBZIP=ON"
2020 "-DUNITTEST=ON" "-DHEADLESS=ON")
2022 (modify-phases %standard-phases
2023 (add-after 'unpack 'add-external-sources
2024 (lambda* (#:key inputs #:allow-other-keys)
2025 ;; TODO: unbundle armips.
2026 (copy-recursively (assoc-ref inputs "armips-source")
2028 ;; Some tests are externalised, so we add them here.
2029 (copy-recursively (assoc-ref inputs "tests")
2031 ;; i18n is externalised, so we add it here.
2032 (copy-recursively (assoc-ref inputs "lang")
2038 (lambda (t) (invoke "./unitTest" t))
2039 '("Arm64Emitter" "ArmEmitter" "X64Emitter" "VertexJit" "Asin"
2040 "SinCos" "VFPUSinCos" "MathUtil" "Parsers" "Jit"
2041 "MatrixTranspose" "ParseLBN" "QuickTexHash" "CLZ" "MemMap"))
2042 (invoke "python3" "test.py" "-g")
2045 (lambda* (#:key inputs outputs #:allow-other-keys)
2046 (let* ((out (assoc-ref outputs "out"))
2047 (bin/ppsspp (string-append out "/bin/ppsspp"))
2048 (share (string-append out "/share/ppsspp")))
2049 (copy-recursively "icons/hicolor"
2050 (string-append out "/share/icons/hicolor"))
2051 (install-file "PPSSPPSDL" share)
2052 (copy-recursively "assets" (string-append share "/assets"))
2054 (make-desktop-entry-file
2055 (string-append out "/share/applications/ppsspp.desktop")
2057 #:exec (string-append share "/PPSSPPSDL")
2059 (mkdir-p (string-append out "/bin"))
2060 (with-output-to-file bin/ppsspp
2062 (format #t "#!~a~%exec ~a/PPSSPPSDL \"$@\""
2063 (which "sh") share)))
2064 (chmod bin/ppsspp #o755)
2066 (home-page "https://www.ppsspp.org/")
2067 (synopsis "PSP emulator")
2069 "PPSSPP is a ``high-level'' emulator simulating the PSP operating
2071 (license license:gpl2+)))