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, 2021 Sou Bunnbu <iyzsong@member.fsf.org>
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, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
10 ;;; Copyright © 2017, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
12 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
13 ;;; Copyright © 2019 David Wilson <david@daviwil.com>
14 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
15 ;;; Copyright © 2020 Christopher Howard <christopher@librehacker.com>
16 ;;; Copyright © 2021 Felipe Balbi <balbi@kernel.org>
17 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
18 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
20 ;;; This file is part of GNU Guix.
22 ;;; GNU Guix is free software; you can redistribute it and/or modify it
23 ;;; under the terms of the GNU General Public License as published by
24 ;;; the Free Software Foundation; either version 3 of the License, or (at
25 ;;; your option) any later version.
27 ;;; GNU Guix is distributed in the hope that it will be useful, but
28 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 ;;; GNU General Public License for more details.
32 ;;; You should have received a copy of the GNU General Public License
33 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
35 (define-module (gnu packages emulators)
36 #:use-module (ice-9 match)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix git-download)
41 #:use-module (guix svn-download)
42 #:use-module (guix hg-download)
43 #:use-module (guix utils)
44 #:use-module (gnu packages)
45 #:use-module (gnu packages algebra)
46 #:use-module (gnu packages assembly)
47 #:use-module (gnu packages audio)
48 #:use-module (gnu packages autogen)
49 #:use-module (gnu packages autotools)
50 #:use-module (gnu packages base)
51 #:use-module (gnu packages bison)
52 #:use-module (gnu packages boost)
53 #:use-module (gnu packages backup)
54 #:use-module (gnu packages cdrom)
55 #:use-module (gnu packages check)
56 #:use-module (gnu packages compression)
57 #:use-module (gnu packages cross-base)
58 #:use-module (gnu packages curl)
59 #:use-module (gnu packages digest)
60 #:use-module (gnu packages elf)
61 #:use-module (gnu packages flex)
62 #:use-module (gnu packages fonts)
63 #:use-module (gnu packages fontutils)
64 #:use-module (gnu packages freedesktop)
65 #:use-module (gnu packages fribidi)
66 #:use-module (gnu packages game-development)
67 #:use-module (gnu packages gcc)
68 #:use-module (gnu packages gettext)
69 #:use-module (gnu packages gl)
70 #:use-module (gnu packages glib)
71 #:use-module (gnu packages gtk)
72 #:use-module (gnu packages image)
73 #:use-module (gnu packages libedit)
74 #:use-module (gnu packages libusb)
75 #:use-module (gnu packages linux)
76 #:use-module (gnu packages lua)
77 #:use-module (gnu packages maths)
78 #:use-module (gnu packages mp3)
79 #:use-module (gnu packages music)
80 #:use-module (gnu packages ncurses)
81 #:use-module (gnu packages networking)
82 #:use-module (gnu packages pkg-config)
83 #:use-module (gnu packages pulseaudio)
84 #:use-module (gnu packages python)
85 #:use-module (gnu packages qt)
86 #:use-module (gnu packages sdl)
87 #:use-module (gnu packages sphinx)
88 #:use-module (gnu packages sqlite)
89 #:use-module (gnu packages texinfo)
90 #:use-module (gnu packages textutils)
91 #:use-module (gnu packages tls)
92 #:use-module (gnu packages upnp)
93 #:use-module (gnu packages video)
94 #:use-module (gnu packages vulkan)
95 #:use-module (gnu packages wxwidgets)
96 #:use-module (gnu packages xdisorg)
97 #:use-module (gnu packages xiph)
98 #:use-module (gnu packages xml)
99 #:use-module (gnu packages xorg)
100 #:use-module (gnu packages web)
101 #:use-module (guix build-system cmake)
102 #:use-module (guix build-system glib-or-gtk)
103 #:use-module (guix build-system gnu)
104 #:use-module (guix build-system python))
113 (uri (string-append "mirror://sourceforge/vice-emu/releases/"
114 "vice-" version ".tar.gz"))
117 "03nwcldg2h7dxj6aa77ggqc0442hqc1lsq5x69h8kcmqmvx7ifan"))))
118 (build-system gnu-build-system)
120 `(#:configure-flags '("--disable-pdf-docs")))
123 ("dos2unix" ,dos2unix)
125 ("glib" ,glib "bin") ; for glib-genmarshal, etc.
126 ("pkg-config" ,pkg-config)))
128 `(("alsa-lib" ,alsa-lib)
132 ("pulseaudio" ,pulseaudio)
134 ("sdl-image" ,sdl-image)
136 (home-page "https://vice-emu.sourceforge.io/")
137 (synopsis "The versatile Commodore emulator")
139 "VICE is a program that emulates the C64, the C64DTV, the C128, the
140 VIC20, practically all PET models, the PLUS4 and the CBM-II (aka
141 C610/C510). An extra emulator is provided for C64 expanded with the CMD
143 (license license:gpl2+)))
145 (define-public blastem
152 (url "https://www.retrodev.com/repos/blastem")
153 (changeset (string-append "v" version))))
154 (file-name (string-append name "-" version "-checkout"))
157 "08ycfisivh9rb9vmijlrpdryaw8spd81ck48960p15cnf8h2535q"))
158 (modules '((guix build utils)))
161 ;; TODO: Separately package and unbundle nuklear
162 (delete-file-recursively "zlib")))))
163 (build-system gnu-build-system)
165 `(#:make-flags (list (string-append "CC=" ,(cc-for-target))
167 "HAS_PROC=-DHAS_PROC"
168 (string-append "CONFIG_PATH="
169 %output "/share/blastem")
170 (string-append "DATA_PATH="
171 %output "/share/blastem"))
172 #:tests? #f ; No check target and custom tests don't seem to build
174 ((guix build copy-build-system)
175 ,@%gnu-build-system-modules)
177 (((guix build copy-build-system)
179 (guix build gnu-build-system)
182 (modify-phases %standard-phases
183 (add-after 'unpack 'fix-source
185 (substitute* (find-files "." ".*\\.[ch]")
186 (("\"zlib/zlib.h\"") "<zlib.h>"))))
190 (apply (assoc-ref copy:%standard-phases 'install)
192 '(("." "bin" #:include ("blastem" "vgmplay"))
194 #:include ("default.cfg" "rom.db")
195 #:exclude ("android"))
196 ("shaders" "share/blastem/shaders"))
204 `(("pkg-config" ,pkg-config)))
205 (home-page "https://www.retrodev.com/blastem/")
206 (synopsis "Genesis/Mega Drive emulator")
207 (description "Blastem is an emulator for the Sega Genesis/Mega Drive
209 (license license:gpl3+)))
211 (define-public desmume
219 "mirror://sourceforge/desmume/desmume/"
220 version "/desmume-" version ".tar.gz"))
223 "15l8wdw3q61fniy3h93d84dnm6s4pyadvh95a0j6d580rjk4pcrs"))
224 (patches (search-patches "desmume-gcc6-fixes.patch"
225 "desmume-gcc7-fixes.patch"))))
226 (build-system gnu-build-system)
228 ;; Enable support for WiFi and microphone.
229 `(#:configure-flags '("--enable-wifi"
232 `(("pkg-config" ,pkg-config)
233 ("intltool" ,intltool)))
240 (home-page "http://desmume.org/")
241 (synopsis "Nintendo DS emulator")
243 "DeSmuME is an emulator for the Nintendo DS handheld gaming console.")
244 (license license:gpl2)))
246 ;; Building from recent Git because the official 5.0 release no longer builds.
247 ;; Following commits and revision numbers of beta versions listed at
248 ;; https://dolphin-emu.org/download/.
249 (define-public dolphin-emu
250 (let ((commit "a34823df61df65168aa40ef5e82e44defd4a0138")
254 (version (git-version "5.0" revision commit))
259 (url "https://github.com/dolphin-emu/dolphin")
261 (file-name (git-file-name name version))
262 (modules '((guix build utils)))
265 ;; Remove external stuff we don't need.
266 (for-each (lambda (dir)
267 (delete-file-recursively
268 (string-append "Externals/" dir)))
269 '("LZO" "OpenAL" "Qt" "SFML" "curl" "ffmpeg"
270 "gettext" "hidapi" "libpng" "libusb" "mbedtls"
271 "miniupnpc" "MoltenVK" "zlib"))
273 (for-each delete-file (find-files "." ".*\\.(bin|dsy|exe|jar|rar)$"))
277 "0j6hnj60iai366kl0kdbn1jkwc183l02g65mp2vq4qb2yd4399l1"))))
278 (build-system cmake-build-system)
282 (modify-phases %standard-phases
283 (add-before 'configure 'generate-fonts&hardcore-libvulkan-path
284 (lambda* (#:key inputs outputs #:allow-other-keys)
286 (string-append (assoc-ref inputs "font-wqy-microhei")
287 "/share/fonts/truetype/wqy-microhei.ttc"))
289 (string-append (assoc-ref inputs "vulkan-loader")
290 "/lib/libvulkan.so")))
292 (invoke "bash" "-c" "g++ -O2 $(freetype-config \
293 --cflags --libs) gc-font-tool.cpp -o gc-font-tool")
294 (invoke "./gc-font-tool" "a" fontfile "font_western.bin")
295 (invoke "./gc-font-tool" "s" fontfile "font_japanese.bin")
296 (copy-file "font_japanese.bin" "../Data/Sys/GC/font_japanese.bin")
297 (copy-file "font_western.bin" "../Data/Sys/GC/font_western.bin")
299 (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
300 (("\"vulkan\", 1") (string-append "\"vulkan\""))
301 (("\"vulkan\"") (string-append "\"" libvulkan "\""))
302 (("Common::DynamicLibrary::GetVersionedFilename") ""))
305 ;; The FindGTK2 cmake script only checks hardcoded directories for
309 (list (string-append "-DX11_INCLUDE_DIR="
310 (assoc-ref %build-inputs "libx11")
312 (string-append "-DX11_LIBRARIES="
313 (assoc-ref %build-inputs "libx11")
317 `(("pkg-config" ,pkg-config)
318 ("gettext" ,gettext-minimal)))
320 `(("alsa-lib" ,alsa-lib)
326 ("font-wqy-microhei" ,font-wqy-microhei)
327 ("freetype" ,freetype)
333 ("libevdev" ,libevdev)
338 ("libxrandr" ,libxrandr)
340 ("mbedtls-apache" ,mbedtls-apache)
342 ("miniupnpc" ,miniupnpc)
345 ("pulseaudio" ,pulseaudio)
350 ("soundtouch" ,soundtouch)
351 ("vulkan-loader" ,vulkan-loader)
353 (home-page "https://dolphin-emu.org/")
354 (synopsis "Nintendo Wii and GameCube emulator")
356 "Dolphin is an emulator for two Nintendo video game consoles: the
357 GameCube and the Wii. It provides compatibility with all PC controllers,
358 turbo speed, networked multiplayer, and graphical enhancements.")
359 (supported-systems '("x86_64-linux" "aarch64-linux"))
360 ; dolphin/Data/Sys/GC/font_*.bin: Licensed under ASL2.0.
361 (license (list license:gpl2+ license:asl2.0 license:fdl1.2+)))))
363 (define-public dosbox
369 (uri (string-append "https://sourceforge.net/projects/dosbox"
370 "/files/dosbox/" version "/dosbox-"
371 version ".tar.gz/download"))
372 (file-name (string-append name "-" version ".tar.gz"))
375 "02i648i50dwicv1vaql15rccv4g8h5blf5g6inv67lrfxpbkvlf0"))))
376 (build-system gnu-build-system)
378 `(("autoconf" ,autoconf)
379 ("automake" ,automake)))
384 ("alsa-lib" ,alsa-lib)
387 (home-page "https://www.dosbox.com")
388 (synopsis "X86 emulator with CGA/EGA/VGA/etc. graphics and sound")
389 (description "DOSBox is a DOS-emulator that uses the SDL library. DOSBox
390 also emulates CPU:286/386 realmode/protected mode, Directory
391 FileSystem/XMS/EMS, Tandy/Hercules/CGA/EGA/VGA/VESA graphics, a
392 SoundBlaster/Gravis Ultra Sound card for excellent sound compatibility with
394 (license license:gpl2+)))
396 (define-public dosbox-staging
397 ;; This is not a patch staging area for DOSBox, but an unaffiliated fork.
399 (name "dosbox-staging")
405 (url "https://github.com/dosbox-staging/dosbox-staging")
406 (commit (string-append "v" version))))
407 (file-name (git-file-name name version))
409 (base32 "14zlkm9qmaq2x4zdiadczsxvdnrf35w13ccvkxzd8cwrzxv84fvd"))))
410 (build-system gnu-build-system)
413 (let* ((flags (list "-O3"
414 ;; From scripts/automator/build/gcc-defaults.
420 "-ffunction-sections"
422 (CFLAGS (string-join flags " ")))
423 ;; Several files #include <SDL_net.h> instead of <SDL2/SDL_net.h>,
424 ;; including configure.ac itself.
425 (list (string-append "CPPFLAGS=-I" (assoc-ref %build-inputs "sdl2")
427 (string-append "CFLAGS=" CFLAGS)
428 (string-append "CXXFLAGS=-DNDEBUG " CFLAGS)))))
430 `(("autoconf" ,autoconf)
431 ("automake" ,automake)
432 ("pkg-config" ,pkg-config)))
434 `(("alsa-lib" ,alsa-lib)
435 ("fluidsynth" ,fluidsynth)
437 ("opusfile" ,opusfile)
438 ("sdl2" ,(sdl-union (list sdl2 sdl2-net)))
440 (home-page "https://dosbox-staging.github.io")
441 (synopsis "DOS/x86 PC emulator focusing on ease of use")
443 "The DOSBox Staging project attempts to modernize DOSBox.
445 DOSBox emulates an Intel x86 personal computer running an IBM PC compatible disk
446 operating system (@dfn{DOS}) in both real and protected modes. It was primarily
447 designed to run old DOS games, but aims to be fully compatible with all DOS
448 programs and replicate the experience as accurately as possible.
450 This fork fixes some perceived issues with DOSBox and adds new features such as
451 Wayland support, PowerPC/POWER dynamic recompilation, and FluidSynth MIDI.
452 Other features may be removed: for example, physical CDs can no longer be
453 played, only emulated media.
455 Graphical emulation includes contemporary text mode, Hercules, CGA, EGA, VGA,
456 VESA, S3@tie{}Trio@tie{}64, and Tandy hardware.
458 Emulated legacy sound devices range from a rudimentary `PC speaker' buzzer to
459 the once state-of-the-art Gravis Utrasound sampling sound card. The default is
460 a SoundBlaster 16 providing 16-bit stereo sound. MIDI is forwarded to the host
461 through an emulated MPU-401.
463 An emulated hardware modem is also included, letting one host or dial a
464 @acronym{BBS, Bulletin Board System} across the Internet, network over IPX, and
465 emulate a serial nullmodem over TCP/IP.")
466 (license license:gpl3+)))
468 (define-public qtmips
475 (url "https://github.com/cvut/QtMips")
476 (commit (string-append "v" version))))
477 (file-name (git-file-name name version))
480 "1fal7a8y5g0rqqjrk795jh1l50ihz01ppjnrfjrk9vkjbd59szbp"))))
481 (build-system cmake-build-system)
484 (modify-phases %standard-phases
486 (lambda* (#:key outputs #:allow-other-keys)
488 (string-append "PREFIX=" (assoc-ref outputs "out"))
491 (lambda* (#:key tests? #:allow-other-keys)
492 (substitute* "tests/test.sh"
493 (("qtchooser.*") ""))
494 (substitute* '("tests/cpu_trap/test.sh"
495 "tests/registers/test.sh")
496 (("sub-qtmips_cli") "qtmips_cli"))
498 (invoke "tests/run-all.sh")
501 ;; There is no install target.
502 (lambda* (#:key outputs #:allow-other-keys)
503 (let* ((out (assoc-ref outputs "out"))
504 (bin (string-append out "/bin"))
505 (apps (string-append out "/share/applications"))
506 (icons (string-append out "/share/icons/hicolor")))
507 (install-file "qtmips_gui/qtmips_gui" bin)
508 (install-file "qtmips_cli/qtmips_cli" bin)
509 (install-file "data/qtmips.desktop" apps)
510 (install-file "data/icons/qtmips_gui.svg"
511 (string-append icons "/scalable/apps"))
512 (install-file "data/icons/qtmips_gui.png"
513 (string-append icons "/48x48/apps"))
515 #:tests? #f)) ; test suite wants mips toolchain
517 `(("elfutils" ,elfutils)
518 ("qtbase" ,qtbase-5)))
519 (home-page "https://github.com/cvut/QtMips")
520 (synopsis "MIPS CPU emulator")
521 (description "This package contains a MIPS CPU emulator. The simulator
522 accepts ELF statically linked executables compiled for 32-bit big-endian
523 MIPS target, targeting mips-linux-gnu or mips-elf.")
524 (license license:gpl2+))) ; License file says GPL3
526 (define-public emulation-station
527 ;; No release for a long time, new commits fix build issues
528 (let ((commit "9cc42adff67946175d2b7e25c6ae69cc374e98a0")
531 (name "emulation-station")
532 (version (git-version "2.0.1" revision commit))
534 (method git-fetch) ; no tarball available
536 (url "https://github.com/Aloshi/EmulationStation")
537 (commit commit))) ; no version tag
538 (file-name (git-file-name name version))
541 "1cva0ns650v17lfn8in095zci6lc43d23f1x3mlzc41qfqa6mbd1"))))
542 (build-system cmake-build-system)
544 '(#:tests? #f)) ; no tests
546 `(("alsa-lib" ,alsa-lib)
550 ("freeimage" ,freeimage)
551 ("freetype" ,freetype)
554 (synopsis "Video game console emulator front-end")
555 (description "EmulationStation provides a graphical front-end to a large
556 number of video game console emulators. It features an interface that is
557 usable with any game controller that has at least 4 buttons, theming support,
558 and a game metadata scraper.")
559 (home-page "https://emulationstation.org")
560 (license license:expat))))
570 (url "https://github.com/higan-emu/higan")
571 (commit (string-append "v" version))))
572 (file-name (git-file-name name version))
574 (base32 "11rvm53c3p2f6zk8xbyv2j51xp8zmqnch7zravhj3fk590qrjrr2"))))
575 (build-system gnu-build-system)
577 `(("pkg-config" ,pkg-config)))
579 `(("alsa-lib" ,alsa-lib)
583 ("gtksourceview-2" ,gtksourceview-2)
584 ("libxrandr" ,libxrandr)
588 ("pulseaudio" ,pulseaudio)
592 (let ((build-phase (assoc-ref %standard-phases 'build))
593 (install-phase (assoc-ref %standard-phases 'install)))
594 (modify-phases %standard-phases
595 ;; The higan build system has no configure phase.
597 (add-before 'build 'chdir-to-higan
601 (add-before 'install 'create-/share/applications
602 (lambda* (#:key outputs #:allow-other-keys)
603 (let ((out (assoc-ref outputs "out")))
604 ;; It seems the author forgot to do this in the Makefile.
605 (mkdir-p (string-append out "/share/applications"))
607 (add-after 'install 'chdir-to-icarus
611 (add-after 'chdir-to-icarus 'build-icarus build-phase)
612 (add-after 'build-icarus 'install-icarus install-phase)
613 (add-after 'install-icarus 'wrap-higan-executable
614 (lambda* (#:key inputs outputs #:allow-other-keys)
615 (let* ((out (assoc-ref outputs "out"))
616 (bin (string-append out "/bin"))
617 (higan (string-append bin "/higan"))
618 (higan-original (string-append higan "-original"))
619 (bash (string-append (assoc-ref inputs "bash")
621 (coreutils (assoc-ref inputs "coreutils"))
622 (mkdir (string-append coreutils "/bin/mkdir"))
623 (cp (string-append coreutils "/bin/cp"))
624 (cp-r (string-append cp " -r --no-preserve=mode")))
625 ;; First, have the executable make sure ~/.local/share/higan
626 ;; contains up to date files. Higan insists on looking there
627 ;; for these data files.
628 (rename-file higan higan-original)
629 (with-output-to-file higan
634 ;; higan doesn't respect $XDG_DATA_HOME
635 mkdir " -p ~/.local/share\n"
636 cp-r " " out "/share/higan ~/.local/share\n"
637 "exec " higan-original))))
639 ;; Second, make sure higan will find icarus in PATH.
641 `("PATH" ":" prefix (,bin)))
645 (string-append "prefix=" (assoc-ref %outputs "out")))
646 ;; There is no test suite.
648 (home-page "https://github.com/higan-emu/higan/")
649 (synopsis "Multi-system emulator")
651 "higan is a multi-system emulator with an uncompromising focus on
652 accuracy and code readability.
654 It currently emulates the following systems: Famicom, Famicom Disk System,
655 Super Famicom, Super Game Boy, Game Boy, Game Boy Color, Game Boy Advance,
656 Game Boy Player, SG-1000, SC-3000, Master System, Game Gear, Mega Drive, Mega
657 CD, PC Engine, SuperGrafx, MSX, MSX2, ColecoVision, Neo Geo Pocket, Neo Geo
658 Pocket Color, WonderSwan, WonderSwan Color, SwanCrystal, Pocket Challenge
660 (license license:gpl3+)))
662 (define-public mednafen
669 (uri (string-append "https://mednafen.github.io/releases/files/"
670 "mednafen-" version ".tar.xz"))
672 (base32 "1ysmb56wzr17ki6f1b486r2dzjr11igd021qb4r3437l68prpa7k"))))
673 (build-system gnu-build-system)
677 ;; "--with-external-mpcdec"
678 "--with-external-lzo")))
680 `(("pkg-config" ,pkg-config)))
684 ;; ("libmpcdec" ,libmpcdec) FIXME: not recognized.
685 ("libsndfile" ,libsndfile)
689 (home-page "https://mednafen.github.io/")
690 (synopsis "Multi-system emulator utilizing OpenGL and SDL")
692 "Mednafen is a portable, utilizing OpenGL and SDL, argument-driven
693 multi-system emulator. Mednafen has the ability to remap hotkey functions and
694 virtual system inputs to a keyboard, a joystick, or both simultaneously. Save
695 states are supported, as is real-time game rewinding. Screen snapshots may be
696 taken, in the PNG file format, at the press of a button. Mednafen can record
697 audiovisual movies in the QuickTime file format, with several different
698 lossless codecs supported.
700 The following systems are supported:
705 @item Neo Geo Pocket (Color)
707 @item GameBoy (Color)
708 @item GameBoy Advance
709 @item Nintendo Entertainment System
710 @item Super Nintendo Entertainment System/Super Famicom
712 @item PC Engine/TurboGrafx 16 (CD)
716 @item Sega Genesis/Megadrive
717 @item Sega Master System
718 @item Sega Saturn (experimental, x86_64 only)
719 @item Sony PlayStation
721 ;; Main license is GPL2+. Some parts are BSD-3.
722 (license (list license:gpl2+ license:bsd-3))))
732 (url "https://github.com/mgba-emu/mgba")
734 (file-name (git-file-name name version))
736 (base32 "163azad5y4zxwzxyrb481rwfc2p86v99pf7nvdr6bavzq98x2z8h"))
737 (modules '((guix build utils)))
739 ;; Make sure we don't use the bundled software.
743 (let ((lib-subdir (string-append "src/third-party/" subdir)))
744 (delete-file-recursively lib-subdir)))
745 '("libpng" "lzma" "sqlite3" "zlib"))
747 (build-system cmake-build-system)
749 `(#:tests? #f ;no "test" target
751 (list "-DUSE_LZMA=OFF" ;do not use bundled LZMA
752 "-DUSE_LIBZIP=OFF"))) ;use "zlib" instead
753 (native-inputs `(("pkg-config" ,pkg-config)
754 ("qttools" ,qttools)))
755 (inputs `(("ffmpeg" ,ffmpeg)
758 ("libepoxy" ,libepoxy)
764 ("qtmultimedia" ,qtmultimedia)
768 (home-page "https://mgba.io")
769 (synopsis "Game Boy Advance emulator")
771 "mGBA is an emulator for running Game Boy Advance games. It aims to be
772 faster and more accurate than many existing Game Boy Advance emulators, as
773 well as adding features that other emulators lack. It also supports Game Boy
774 and Game Boy Color games.")
775 ;; Code is mainly MPL 2.0. "blip_buf.c" is LGPL 2.1+, "inih.c" is
776 ;; BSD-3, and "discord-rpc" is Expat.
777 (license (list license:mpl2.0 license:lgpl2.1+ license:bsd-3 license:expat))))
779 (define-public sameboy
787 (url "https://github.com/LIJI32/SameBoy")
788 (commit (string-append "v" version))))
789 (file-name (git-file-name name version))
791 (base32 "1dipidx12ai62hnzf0pvnsk1cgjcmw1h5x2r7ilxq0k0pkia5b7a"))))
792 (build-system gnu-build-system)
795 ("pkg-config" ,pkg-config)))
799 `(#:tests? #f ; There are no tests
800 #:make-flags `(,(string-append "CC=" ,(cc-for-target))
801 "NATIVE_CC=gcc" "CONF=release"
802 ,(string-append "DATA_DIR="
803 (assoc-ref %outputs "out")
806 (modify-phases %standard-phases
809 (lambda* (#:key outputs #:allow-other-keys)
810 (let* ((out (assoc-ref outputs "out"))
811 (bin (string-append out "/bin"))
812 (data (string-append out "/share/sameboy/")))
813 (with-directory-excursion "build/bin/SDL"
814 (install-file "sameboy" bin)
815 (delete-file "sameboy")
816 (copy-recursively "." data))
818 (home-page "https://sameboy.github.io/")
819 (synopsis "Accurate Game Boy, Game Boy Color and Super Game Boy emulator")
820 (description "SameBoy is a user friendly Game Boy, Game Boy Color
821 and Super Game Boy emulator. SameBoy is accurate and includes a wide
822 range of debugging features. It has all the features one would expect
823 from an emulator---from save states to scaling filters.")
824 (license license:expat)))
826 (define-public mupen64plus-core
828 (name "mupen64plus-core")
834 (url "https://github.com/mupen64plus/mupen64plus-core")
836 (file-name (git-file-name name version))
838 (base32 "116fndl6652zrp1r6ag4xv3dzp1x52mlvadj8xwflq07fd5rhri1"))))
839 (build-system gnu-build-system)
841 `(("pkg-config" ,pkg-config)
844 `(("freetype" ,freetype)
852 (modify-phases %standard-phases
853 ;; The mupen64plus build system has no configure phase.
855 ;; Makefile is in a subdirectory.
857 'build 'chdir-to-project-directory
859 (chdir "projects/unix")
861 #:make-flags (let ((out (assoc-ref %outputs "out")))
862 (list "all" (string-append "PREFIX=" out)))
863 ;; There are no tests.
865 ;; As per the Makefile (in projects/unix/Makefile):
866 (supported-systems '("i686-linux" "x86_64-linux"))
867 (home-page "https://www.mupen64plus.org/")
868 (synopsis "Nintendo 64 emulator core library")
870 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
871 which is capable of accurately playing many games. This package contains the
873 (license license:gpl2+)))
875 (define-public mupen64plus-audio-sdl
877 (name "mupen64plus-audio-sdl")
883 (url "https://github.com/mupen64plus/mupen64plus-audio-sdl")
885 (file-name (git-file-name name version))
887 (base32 "0z19amfg9vr2pqjjri1ipc7hs681fzjcnb0f9y7bjhp5n8d7p6bb"))))
888 (build-system gnu-build-system)
890 `(("pkg-config" ,pkg-config)
893 `(("mupen64plus-core" ,mupen64plus-core)
897 (modify-phases %standard-phases
898 ;; The mupen64plus build system has no configure phase.
900 ;; Makefile is in a subdirectory.
902 'build 'cd-to-project-dir
904 (chdir "projects/unix"))))
906 (let ((out (assoc-ref %outputs "out"))
907 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
909 (string-append "PREFIX=" out)
910 (string-append "APIDIR=" m64p "/include/mupen64plus")))
911 ;; There are no tests.
913 (home-page "https://www.mupen64plus.org/")
914 (synopsis "Mupen64Plus SDL input plugin")
916 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
917 which is capable of accurately playing many games. This package contains the
919 (license license:gpl2+)))
921 (define-public mupen64plus-input-sdl
923 (name "mupen64plus-input-sdl")
929 (url "https://github.com/mupen64plus/mupen64plus-input-sdl")
931 (file-name (git-file-name name version))
933 (base32 "1dyazfbdjycdfslq8jixqiqhziw0rlkvach2r9dz91229jmkyc9c"))))
934 (build-system gnu-build-system)
938 `(("mupen64plus-core" ,mupen64plus-core)
942 (modify-phases %standard-phases
943 ;; The mupen64plus build system has no configure phase.
945 ;; Makefile is in a subdirectory.
947 'build 'cd-to-project-dir
949 (chdir "projects/unix"))))
951 (let ((out (assoc-ref %outputs "out"))
952 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
954 (string-append "PREFIX=" out)
955 (string-append "APIDIR=" m64p "/include/mupen64plus")))
956 ;; There are no tests.
958 (home-page "https://www.mupen64plus.org/")
959 (synopsis "Mupen64Plus SDL input plugin")
961 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
962 which is capable of accurately playing many games. This package contains the
964 (license license:gpl2+)))
966 (define-public mupen64plus-rsp-hle
968 (name "mupen64plus-rsp-hle")
974 (url "https://github.com/mupen64plus/mupen64plus-rsp-hle")
976 (file-name (git-file-name name version))
978 (base32 "0pi31qzjjp7aypdvvnz6ms18g09c4gqzxi6328zj8sji94b75gf0"))))
979 (build-system gnu-build-system)
981 `(("mupen64plus-core" ,mupen64plus-core)))
984 (modify-phases %standard-phases
985 ;; The mupen64plus build system has no configure phase.
987 ;; Makefile is in a subdirectory.
989 'build 'cd-to-project-dir
991 (chdir "projects/unix"))))
993 (let ((out (assoc-ref %outputs "out"))
994 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
996 (string-append "PREFIX=" out)
997 (string-append "APIDIR=" m64p "/include/mupen64plus")))
998 ;; There are no tests.
1000 (home-page "https://www.mupen64plus.org/")
1001 (synopsis "Mupen64Plus SDL input plugin")
1003 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1004 which is capable of accurately playing many games. This package contains the
1005 high-level emulation (HLE) RSP processor plugin.")
1006 (license license:gpl2+)))
1008 (define-public mupen64plus-rsp-z64
1010 (name "mupen64plus-rsp-z64")
1016 (url "https://github.com/mupen64plus/mupen64plus-rsp-z64")
1018 (file-name (git-file-name name version))
1020 (base32 "0nfyjns9k8xbg3aqs7593nfaxvlj72h3l8h467442xlk8ajfcylx"))))
1021 (build-system gnu-build-system)
1023 `(("mupen64plus-core" ,mupen64plus-core)))
1026 (modify-phases %standard-phases
1027 ;; The mupen64plus build system has no configure phase.
1029 ;; Makefile is in a subdirectory.
1031 'build 'cd-to-project-dir
1033 (chdir "projects/unix"))))
1035 (let ((out (assoc-ref %outputs "out"))
1036 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1038 (string-append "PREFIX=" out)
1039 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1040 ;; There are no tests.
1042 (home-page "https://www.mupen64plus.org/")
1043 (synopsis "Mupen64Plus SDL input plugin")
1045 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1046 which is capable of accurately playing many games. This package contains the
1047 Z64 RSP processor plugin.")
1048 (license license:gpl2+)))
1050 (define-public mupen64plus-video-arachnoid
1052 (name "mupen64plus-video-arachnoid")
1058 (url "https://github.com/mupen64plus/mupen64plus-video-arachnoid")
1060 (file-name (git-file-name name version))
1062 (base32 "1v9fqwpb6pawr8z5cm2ki7bqkks4iyr5c4jy4v5khj6h8zcv55gc"))))
1063 (build-system gnu-build-system)
1065 `(("pkg-config" ,pkg-config)
1069 ("mupen64plus-core" ,mupen64plus-core)))
1072 (modify-phases %standard-phases
1073 ;; The mupen64plus build system has no configure phase.
1075 ;; Makefile is in a subdirectory.
1077 'build 'cd-to-project-dir
1079 (chdir "projects/unix"))))
1081 (let ((out (assoc-ref %outputs "out"))
1082 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1084 (string-append "PREFIX=" out)
1085 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1086 ;; There are no tests.
1088 (home-page "https://www.mupen64plus.org/")
1089 (synopsis "Mupen64Plus Rice Video plugin")
1091 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1092 which is capable of accurately playing many games. This package contains the
1093 Arachnoid video plugin.")
1094 (license license:gpl2+)))
1096 (define-public mupen64plus-video-glide64
1098 (name "mupen64plus-video-glide64")
1104 (url "https://github.com/mupen64plus/mupen64plus-video-glide64")
1106 (file-name (git-file-name name version))
1108 (base32 "0qn5za7g7796kh2ag3xpmhbqg0yf71g9liz6ks0rha8pz73lgs01"))))
1109 (build-system gnu-build-system)
1111 `(("pkg-config" ,pkg-config)
1115 ("mupen64plus-core" ,mupen64plus-core)
1119 (modify-phases %standard-phases
1120 ;; The mupen64plus build system has no configure phase.
1122 ;; Makefile is in a subdirectory.
1124 'build 'cd-to-project-dir
1126 (chdir "projects/unix")))
1127 ;; XXX Should be unnecessary with the next release.
1131 (substitute* "Makefile"
1132 (("SDL_CONFIG = (.*)sdl-config" all prefix)
1133 (string-append "SDL_CONFIG = " prefix "sdl2-config"))))))
1135 (let ((out (assoc-ref %outputs "out"))
1136 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1138 (string-append "PREFIX=" out)
1139 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1140 ;; There are no tests.
1142 (home-page "https://www.mupen64plus.org/")
1143 (synopsis "Mupen64Plus Rice Video plugin")
1145 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1146 which is capable of accurately playing many games. This package contains the
1147 Glide64 video plugin.")
1148 (license license:gpl2+)))
1150 (define-public mupen64plus-video-glide64mk2
1152 (name "mupen64plus-video-glide64mk2")
1158 (url "https://github.com/mupen64plus/mupen64plus-video-glide64mk2")
1160 (file-name (git-file-name name version))
1162 (base32 "08pm28a36dpr0cvr8pzw0n5ksdazp7jqvlmqfy2lwb4dm0cwhkqd"))))
1163 (build-system gnu-build-system)
1165 `(("pkg-config" ,pkg-config)
1171 ("mupen64plus-core" ,mupen64plus-core)
1176 (modify-phases %standard-phases
1177 ;; The mupen64plus build system has no configure phase.
1179 ;; Makefile is in a subdirectory.
1181 'build 'cd-to-project-dir
1183 (chdir "projects/unix"))))
1185 (let ((out (assoc-ref %outputs "out"))
1186 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1188 (string-append "PREFIX=" out)
1189 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1190 ;; There are no tests.
1192 (home-page "https://www.mupen64plus.org/")
1193 (synopsis "Mupen64Plus Rice Video plugin")
1195 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1196 which is capable of accurately playing many games. This package contains the
1197 Glide64MK2 video plugin.")
1198 (license license:gpl2+)))
1200 (define-public mupen64plus-video-rice
1202 (name "mupen64plus-video-rice")
1208 (url "https://github.com/mupen64plus/mupen64plus-video-rice")
1210 (file-name (git-file-name name version))
1212 (base32 "0rpmbcq67gsj5h5jjis146378qc1mskskvx20y1ikx59yhbamh13"))))
1213 (build-system gnu-build-system)
1215 `(("pkg-config" ,pkg-config)
1218 `(("libpng" ,libpng)
1220 ("mupen64plus-core" ,mupen64plus-core)
1224 (modify-phases %standard-phases
1225 ;; The mupen64plus build system has no configure phase.
1227 ;; Makefile is in a subdirectory.
1229 'build 'cd-to-project-dir
1231 (chdir "projects/unix"))))
1233 (let ((out (assoc-ref %outputs "out"))
1234 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1236 (string-append "PREFIX=" out)
1237 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1238 ;; There are no tests.
1240 (home-page "https://www.mupen64plus.org/")
1241 (synopsis "Mupen64Plus Rice Video plugin")
1243 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1244 which is capable of accurately playing many games. This package contains the
1245 Rice Video plugin.")
1246 (license license:gpl2+)))
1248 (define-public mupen64plus-video-z64
1250 (name "mupen64plus-video-z64")
1256 (url "https://github.com/mupen64plus/mupen64plus-video-z64")
1258 (file-name (git-file-name name version))
1260 (base32 "04qa2fdd6dakpk2v0d4l80xh9b4h8gm71g80c0wyyxdhmhwk1r9c"))
1261 (patches (search-patches "mupen64plus-video-z64-glew-correct-path.patch"))))
1262 (build-system gnu-build-system)
1264 `(("pkg-config" ,pkg-config)
1268 ("mupen64plus-core" ,mupen64plus-core)
1272 (modify-phases %standard-phases
1273 ;; The mupen64plus build system has no configure phase.
1275 ;; Makefile is in a subdirectory.
1277 'build 'cd-to-project-dir
1279 (chdir "projects/unix")))
1280 ;; XXX Should be unnecessary with the next release.
1284 (substitute* "Makefile"
1285 (("SDL_CONFIG = (.*)sdl-config" all prefix)
1286 (string-append "SDL_CONFIG = " prefix "sdl2-config"))))))
1288 (let ((out (assoc-ref %outputs "out"))
1289 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1291 (string-append "PREFIX=" out)
1292 (string-append "APIDIR=" m64p "/include/mupen64plus")))
1293 ;; There are no tests.
1295 (home-page "https://www.mupen64plus.org/")
1296 (synopsis "Mupen64Plus Z64 video plugin")
1298 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1299 which is capable of accurately playing many games. This package contains the
1301 (license license:gpl2+)))
1303 (define-public mupen64plus-ui-console
1305 (name "mupen64plus-ui-console")
1311 (url "https://github.com/mupen64plus/mupen64plus-ui-console")
1313 (file-name (git-file-name name version))
1315 (base32 "0vrf98qa6a0y3647kslsv644fag233dxh5dcr1yncjiiwickcr5a"))
1316 (patches (search-patches "mupen64plus-ui-console-notice.patch"))))
1317 (build-system gnu-build-system)
1319 `(("pkg-config" ,pkg-config)
1323 ;; Mupen64Plus supports a single data directory and a single plugin
1324 ;; directory in its configuration, yet we need data and plugin files from
1325 ;; a variety of packages. The best way to deal with this is to install
1326 ;; all packages from which data and plugin files are needed into one's
1327 ;; profile, and point the configuration there. Hence, propagate the most
1328 ;; important packages here to save the user from the bother. The patch
1329 ;; mupen64plus-ui-console-notice also gives users instructions on what
1330 ;; they need to do in order to point the configuration to their profile.
1332 `(("mupen64plus-core" ,mupen64plus-core)
1333 ("mupen64plus-audio-sdl" ,mupen64plus-audio-sdl)
1334 ("mupen64plus-input-sdl" ,mupen64plus-input-sdl)
1335 ("mupen64plus-rsp-hle" ,mupen64plus-rsp-hle)
1336 ("mupen64plus-video-glide64" ,mupen64plus-video-glide64)
1337 ("mupen64plus-video-glide64mk2" ,mupen64plus-video-glide64mk2)
1338 ("mupen64plus-video-rice" ,mupen64plus-video-rice)))
1341 (modify-phases %standard-phases
1342 ;; The mupen64plus build system has no configure phase.
1344 ;; Makefile is in a subdirectory.
1346 'build 'cd-to-project-dir
1348 (chdir "projects/unix"))))
1350 (let ((out (assoc-ref %outputs "out"))
1351 (m64p (assoc-ref %build-inputs "mupen64plus-core")))
1353 (string-append "PREFIX=" out)
1354 (string-append "APIDIR=" m64p "/include/mupen64plus")
1355 ;; Trailing slash matters here.
1356 (string-append "COREDIR=" m64p "/lib/")))
1357 ;; There are no tests.
1359 (home-page "https://www.mupen64plus.org/")
1360 (synopsis "Mupen64Plus command line user interface")
1362 "Mupen64Plus is a cross-platform plugin-based Nintendo 64 (N64) emulator
1363 which is capable of accurately playing many games. This package contains the
1364 command line user interface. Installing this package is the easiest way
1365 towards a working Mupen64Plus for casual users.")
1366 (license license:gpl2+)))
1368 (define-public nestopia-ue
1370 (name "nestopia-ue")
1376 (url "https://github.com/rdanbrook/nestopia")
1378 (file-name (git-file-name name version))
1380 (base32 "19c8vx5yxbysl0sszk5blfngwacshdgwbf44g1qaxvq8ywiyxmb4"))
1381 (modules '((guix build utils)))
1384 ;; We don't need libretro for the GNU/Linux build.
1385 (delete-file-recursively "libretro")
1387 (build-system cmake-build-system)
1389 `(("pkg-config" ,pkg-config)))
1393 ("libarchive" ,libarchive)
1394 ("libepoxy" ,libepoxy)
1399 (modify-phases %standard-phases
1400 ;; This fixes the file chooser crash that happens with GTK 3.
1401 (add-after 'install 'wrap-program
1402 (lambda* (#:key inputs outputs #:allow-other-keys)
1403 (let* ((out (assoc-ref outputs "out"))
1404 (nestopia (string-append out "/bin/nestopia"))
1405 (gtk (assoc-ref inputs "gtk+"))
1406 (gtk-share (string-append gtk "/share")))
1407 (wrap-program nestopia
1408 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))))))
1409 ;; There are no tests.
1411 (home-page "http://0ldsk00l.ca/nestopia/")
1412 (synopsis "Nintendo Entertainment System (NES/Famicom) emulator")
1414 "Nestopia UE (Undead Edition) is a fork of the Nintendo Entertainment
1415 System (NES/Famicom) emulator Nestopia, with enhancements from members of the
1416 emulation community. It provides highly accurate emulation.")
1417 (license license:gpl2+)))
1419 (define-public libretro-lowresnx
1421 (name "libretro-lowresnx")
1426 (url "https://github.com/timoinutilis/lowres-nx")
1427 (commit (string-append "v" version))))
1428 (file-name (git-file-name name version))
1431 "0b0vg3iz342dpkffvf7frsnqh8inj8yzi8550bsx8vnbpq5r2ay5"))))
1432 (build-system gnu-build-system)
1434 `(#:tests? #f ; no tests
1435 #:make-flags (list "-C" "platform/LibRetro"
1436 (string-append "CC=" ,(cc-for-target)))
1438 (modify-phases %standard-phases
1439 (delete 'configure) ; no configure script
1441 (lambda* (#:key outputs #:allow-other-keys)
1442 (let* ((out (assoc-ref outputs "out"))
1443 (libretrodir (string-append out "/lib/libretro")))
1444 (install-file "platform/LibRetro/lowresnx_libretro.so"
1447 (home-page "https://lowresnx.inutilis.com/")
1448 (synopsis "Libretro core for LowRES NX")
1449 (description "LowRES NX is a simulated retro game console, which can be
1450 programmed in the classic BASIC language. This package provides a libretro
1451 core allowing the lowRES NX programs to be used with libretro frontends such
1453 (license license:zlib)))
1455 (define-public retroarch
1463 (url "https://github.com/libretro/RetroArch")
1464 (commit (string-append "v" version))))
1465 (file-name (git-file-name name version))
1467 (base32 "1wky28y52nsjmannks3y1hbjgw0dvqh85gxrllr98f9y7kvk1cvf"))
1469 (search-patches "retroarch-LIBRETRO_DIRECTORY.patch"))))
1470 (build-system gnu-build-system)
1472 `(#:tests? #f ; no tests
1474 (modify-phases %standard-phases
1476 (lambda* (#:key inputs outputs #:allow-other-keys)
1477 (let* ((out (assoc-ref outputs "out"))
1478 (etc (string-append out "/etc"))
1479 (vulkan (assoc-ref inputs "vulkan-loader"))
1480 (wayland-protocols (assoc-ref inputs "wayland-protocols")))
1481 ;; Hard-code some store file names.
1482 (substitute* "gfx/common/vulkan_common.c"
1483 (("libvulkan.so") (string-append vulkan "/lib/libvulkan.so")))
1484 (substitute* "gfx/common/wayland/generate_wayland_protos.sh"
1485 (("/usr/local/share/wayland-protocols")
1486 (string-append wayland-protocols "/share/wayland-protocols")))
1487 (substitute* "qb/qb.libs.sh"
1488 (("/bin/true") (which "true")))
1491 (substitute* '("libretro-common/file/archive_file_zlib.c"
1492 "libretro-common/streams/trans_stream_zlib.c")
1493 (("<compat/zlib.h>") "<zlib.h>"))
1495 ;; The configure script does not yet accept the extra arguments
1496 ;; (like ‘CONFIG_SHELL=’) passed by the default configure phase.
1499 ,@(if (string-prefix? "armhf" (or (%current-target-system)
1501 '("--enable-neon" "--enable-floathard")
1503 (string-append "--prefix=" out)
1504 ;; Non-free software are available through the core updater,
1505 ;; disable it. See <https://issues.guix.gnu.org/38360>.
1506 "--disable-update_cores"
1507 "--disable-builtinminiupnpc")))))))
1509 `(("alsa-lib" ,alsa-lib)
1511 ("freetype" ,freetype)
1512 ("libxinerama" ,libxinerama)
1513 ("libxkbcommon" ,libxkbcommon)
1514 ("libxml2" ,libxml2)
1515 ("libxrandr" ,libxrandr)
1518 ("miniupnpc" ,miniupnpc)
1520 ("pulseaudio" ,pulseaudio)
1522 ("qtbase" ,qtbase-5)
1525 ("vulkan-loader" ,vulkan-loader)
1526 ("wayland" ,wayland)
1529 `(("pkg-config" ,pkg-config)
1530 ("wayland-protocols" ,wayland-protocols)
1532 (native-search-paths
1533 (list (search-path-specification
1534 (variable "LIBRETRO_DIRECTORY")
1535 (separator #f) ; single entry
1536 (files '("lib/libretro")))))
1537 (home-page "https://www.libretro.com/")
1538 (synopsis "Reference frontend for the libretro API")
1540 "Libretro is a simple but powerful development interface that allows for
1541 the easy creation of emulators, games and multimedia applications that can plug
1542 straight into any libretro-compatible frontend. RetroArch is the official
1543 reference frontend for the libretro API, currently used by most as a modular
1544 multi-system game/emulator system.")
1545 (license license:gpl3+)))
1547 (define-public scummvm
1554 (uri (string-append "https://downloads.scummvm.org/frs/scummvm/" version
1555 "/scummvm-" version ".tar.xz"))
1557 (base32 "11vknasm5dna2vqr6gk343qynh7nhsq3kf60zayarn1vb5z6as8l"))))
1558 (build-system gnu-build-system)
1560 `(#:tests? #f ;require "git"
1561 #:configure-flags (list "--enable-release") ;for optimizations
1563 (modify-phases %standard-phases
1565 ;; configure does not work followed by both "SHELL=..." and
1566 ;; "CONFIG_SHELL=..."; set environment variables instead
1567 (lambda* (#:key outputs configure-flags #:allow-other-keys)
1568 (let* ((out (assoc-ref outputs "out"))
1569 (bash (which "bash"))
1570 (flags `(,(string-append "--prefix=" out)
1571 ,@configure-flags)))
1572 (setenv "SHELL" bash)
1573 (setenv "CONFIG_SHELL" bash)
1574 (apply invoke "./configure" flags)))))))
1577 ("pkg-config" ,pkg-config)))
1579 `(("alsa-lib" ,alsa-lib)
1581 ("fluidsynth" ,fluidsynth)
1582 ("freetype" ,freetype)
1583 ("fribidi" ,fribidi)
1586 ("libjpeg-turbo" ,libjpeg-turbo)
1588 ("libmpeg2" ,libmpeg2)
1591 ("libtheora" ,libtheora)
1592 ("libvorbis" ,libvorbis)
1593 ("sdl2" ,(sdl-union (list sdl2 sdl2-net)))
1595 (home-page "https://www.scummvm.org/")
1596 (synopsis "Engine for several graphical adventure games")
1597 (description "ScummVM is a program which allows you to run certain
1598 classic graphical point-and-click adventure games, provided you
1599 already have their data files. The clever part about this: ScummVM
1600 just replaces the executables shipped with the games, allowing you to
1601 play them on systems for which they were never designed!")
1602 (license license:gpl2+)))
1604 (define-public libticables2
1606 (name "libticables2")
1610 (uri "https://www.ticalc.org/pub/unix/tilibs.tar.gz")
1613 "07cfwwlidgx4fx88whnlch6y1342x16h15lkvkkdlp2y26sn2yxg"))))
1614 (build-system gnu-build-system)
1616 `(#:configure-flags (list "--enable-libusb10")
1618 (modify-phases %standard-phases
1620 (lambda* (#:key source #:allow-other-keys)
1621 (invoke "tar" "xvkf" source)
1622 (invoke "tar" "xvkf"
1623 (string-append "tilibs2/libticables2-"
1624 ,version ".tar.bz2"))
1625 (chdir (string-append "libticables2-" ,version))
1628 `(("autoconf" ,autoconf)
1629 ("autogen" ,autogen)
1630 ("automake" ,automake)
1631 ("gettext" ,gnu-gettext)
1632 ("libtool" ,libtool)
1633 ("pkg-config" ,pkg-config)))
1636 ("libusb" ,libusb)))
1637 (synopsis "Link cable library for TI calculators")
1639 "This package contains libticables, a library for operations on
1640 @acronym{TI, Texas Instruments} calculator link cables.
1642 This is a part of the TiLP project.")
1643 (home-page "http://lpg.ticalc.org/prj_tilp/")
1644 (license license:gpl2+)))
1646 (define-public libticonv
1652 (uri "https://www.ticalc.org/pub/unix/tilibs.tar.gz")
1655 "07cfwwlidgx4fx88whnlch6y1342x16h15lkvkkdlp2y26sn2yxg"))))
1656 (build-system gnu-build-system)
1658 ;; build fails with out --enable-iconv (...?)
1659 `(#:configure-flags (list "--enable-iconv")
1661 (modify-phases %standard-phases
1663 (lambda* (#:key source #:allow-other-keys)
1664 (invoke "tar" "xvkf" source)
1665 (invoke "tar" "xvkf"
1666 (string-append "tilibs2/libticonv-"
1667 ,version ".tar.bz2"))
1668 (chdir (string-append "libticonv-" ,version))
1671 `(("autoconf" ,autoconf)
1672 ("automake" ,automake)
1673 ("libtool" ,libtool)
1674 ("pkg-config" ,pkg-config)))
1677 (synopsis "Character conversion library for TI calculators")
1679 "This package contains libticonv, a library to support working with
1680 @acronym{TI, Texas Instruments} calculator charsets.
1682 This is a part of the TiLP project.")
1683 (home-page "http://lpg.ticalc.org/prj_tilp/")
1684 (license license:gpl2+)))
1686 (define-public libtifiles2
1688 (name "libtifiles2")
1692 (uri "https://www.ticalc.org/pub/unix/tilibs.tar.gz")
1695 "07cfwwlidgx4fx88whnlch6y1342x16h15lkvkkdlp2y26sn2yxg"))))
1696 (build-system gnu-build-system)
1699 (modify-phases %standard-phases
1701 (lambda* (#:key source #:allow-other-keys)
1702 (invoke "tar" "xvkf" source)
1703 (invoke "tar" "xvkf"
1704 (string-append "tilibs2/libtifiles2-"
1705 ,version ".tar.bz2"))
1706 (chdir (string-append "libtifiles2-" ,version))
1709 `(("autoconf" ,autoconf)
1710 ("automake" ,automake)
1711 ("gettext" ,gnu-gettext)
1712 ("libtool" ,libtool)
1713 ("pkg-config" ,pkg-config)))
1716 ("libarchive" ,libarchive)
1717 ("libticonv" ,libticonv)))
1718 (synopsis "File functions library for TI calculators")
1720 "This package contains libticonv, a library to support working with
1721 @acronym{TI, Texas Instruments} calculator files.
1723 This is a part of the TiLP project.")
1724 (home-page "http://lpg.ticalc.org/prj_tilp/")
1725 (license license:gpl2+)))
1727 (define-public libticalcs2
1729 (name "libticalcs2")
1733 (uri "https://www.ticalc.org/pub/unix/tilibs.tar.gz")
1736 "07cfwwlidgx4fx88whnlch6y1342x16h15lkvkkdlp2y26sn2yxg"))))
1737 (build-system gnu-build-system)
1740 (modify-phases %standard-phases
1742 (lambda* (#:key source #:allow-other-keys)
1743 (invoke "tar" "xvkf" source)
1744 (invoke "tar" "xvkf"
1745 (string-append "tilibs2/libticalcs2-"
1746 ,version ".tar.bz2"))
1747 (chdir (string-append "libticalcs2-" ,version))
1750 `(("autoconf" ,autoconf)
1751 ("automake" ,automake)
1752 ("gettext" ,gnu-gettext)
1753 ("libtool" ,libtool)
1754 ("pkg-config" ,pkg-config)))
1757 ("libarchive" ,libarchive)
1758 ("libticables2" ,libticables2)
1759 ("libticonv" ,libticonv)
1760 ("libtifiles2" ,libtifiles2)))
1761 (synopsis "Support library for TI calculators")
1763 "This project aims to develop a multi-platform linking program for use
1764 with all @acronym{TI, Texas Instruments} graphing calculators (TI73 to
1767 This is a part of the TiLP project.")
1768 (home-page "http://lpg.ticalc.org/prj_tilp/")
1769 (license license:gpl2+)))
1779 (url "https://github.com/mamedev/mame")
1780 (commit (apply string-append "mame" (string-split version #\.)))))
1781 (file-name (git-file-name name version))
1783 (base32 "1zq7hvss004mwczk3jvyalkj9c5v6npswhkc2wj7dxyxz770clb3"))
1784 (modules '((guix build utils)))
1786 ;; Remove bundled libraries.
1788 (with-directory-excursion "3rdparty"
1789 (for-each delete-file-recursively
1790 '("asio" "expat" "glm" "libflac" "libjpeg" "lua"
1791 "portaudio" "portmidi" "pugixml" "rapidjson" "SDL2"
1792 "SDL2-override" "sqlite3" "utf8proc" "zlib")))
1794 (build-system gnu-build-system)
1798 ;; A 'strict-overflow' error pops up on i686 so disable '-Werror'.
1800 (string-append "QT_HOME=" (assoc-ref %build-inputs "qtbase"))
1801 (string-append "SDL_INI_PATH="
1802 (assoc-ref %outputs "out")
1805 (string-append "USE_SYSTEM_LIB_" (string-upcase lib) "=1"))
1806 '("asio" "expat" "flac" "glm" "jpeg" "lua" "portaudio" "portmidi"
1807 "pugixml" "rapidjson" "sqlite3" "utf8proc" "zlib")))
1808 #:tests? #f ;no test in regular release
1810 (modify-phases %standard-phases
1812 (add-after 'build 'build-documentation
1813 (lambda _ (invoke "make" "-C" "docs" "man" "info")))
1815 ;; Upstream does not provide an installation phase.
1816 (lambda* (#:key outputs #:allow-other-keys)
1817 (let* ((out (assoc-ref outputs "out"))
1818 (share (string-append out "/share/mame")))
1820 (for-each (lambda (dir)
1821 (copy-recursively dir (string-append share "/" dir)))
1822 '("artwork" "bgfx" "ctrlr" "hash" "ini" "language"
1823 "plugins" "samples"))
1824 (let ((keymaps (string-append share "/keymaps")))
1825 (for-each (lambda (file) (install-file file keymaps))
1826 (find-files "keymaps" ".*LINUX\\.map")))
1827 (let ((fonts (string-append share "/fonts")))
1828 (install-file "uismall.bdf" fonts))
1829 (when (file-exists? "mame64")
1830 (rename-file "mame64" "mame"))
1831 (install-file "mame" (string-append out "/bin")))
1833 (add-after 'install 'install-documentation
1834 (lambda* (#:key outputs #:allow-other-keys)
1835 (let* ((out (assoc-ref outputs "out"))
1836 (man (string-append out "/share/man/man1"))
1837 (info (string-append out "/share/info")))
1838 (install-file "docs/build/man/MAME.1" man)
1839 (install-file "docs/build/texinfo/MAME.info" info))
1841 (add-after 'install 'install-ini-file
1842 ;; Generate an ini file so as to set some directories (e.g., roms)
1843 ;; to a writable location, i.e., "$HOME/.mame/" and "$HOME/mame/".
1845 ;; XXX: We need to insert absolute references to the store. It can
1846 ;; be an issue if they leak into user's home directory, e.g., with
1847 ;; "mame -createconfig" and the package is later GC'ed.
1848 (lambda* (#:key outputs #:allow-other-keys)
1849 (let* ((out (assoc-ref outputs "out"))
1850 (share (string-append out "/share/mame"))
1851 (ini (string-append share "/ini")))
1852 (with-output-to-file (string-append ini "/mame.ini")
1855 "inipath $HOME/.mame;~a/ini~@
1856 homepath $HOME/mame~@
1857 rompath $HOME/mame/roms~@
1858 samplepath $HOME/mame/samples;~a/samples~@
1859 cheatpath $HOME/mame/cheat~@
1860 artpath $HOME/mame/artwork;~a/artwork~@
1861 crosshairpath $HOME/mame/crosshair~@
1862 snapshot_directory $HOME/mame/snapshots~@
1864 fontpath $HOME/mame/fonts;~a/fonts~@
1865 ctrlrpath $HOME/mame/ctrlr;~a/ctrlr~@
1867 pluginspath $HOME/mame/plugins;~a/plugins~@
1868 languagepath ~a/language~@
1869 cfg_directory $HOME/.mame/cfg~@
1870 nvram_directory $HOME/.mame/nvram~@
1871 input_directory $HOME/.mame/inp~@
1872 state_directory $HOME/.mame/sta~@
1873 diff_directory $HOME/.mame/diff~@
1874 comment_directory $HOME/.mame/comments~%"
1875 share share share share share share share share
1877 (with-output-to-file (string-append ini "/ui.ini")
1880 "historypath $HOME/mame/history~@
1881 categorypath $HOME/mame/folders~@
1882 cabinets_directory $HOME/mame/cabinets~@
1883 cpanels_directory $HOME/mame/cpanel~@
1884 pcbs_directory $HOME/mame/pcb~@
1885 flyers_directory $HOME/mame/flyers~@
1886 titles_directory $HOME/mame/titles~@
1887 ends_directory $HOME/mame/ends~@
1888 marquees_directory $HOME/mame/marquees~@
1889 artwork_preview_directory $HOME/mame/artpreview~@
1890 bosses_directory $HOME/mame/bosses~@
1891 logos_directory $HOME/mame/logo~@
1892 scores_directory $HOME/mame/scores~@
1893 versus_directory $HOME/mame/versus~@
1894 gameover_directory $HOME/mame/gameover~@
1895 howto_directory $HOME/mame/howto~@
1896 select_directory $HOME/mame/select~@
1897 icons_directory $HOME/mame/icons~@
1898 covers_directory $HOME/mame/covers~@
1899 ui_path $HOME/.mame/ui~%")))
1901 (add-after 'install 'install-desktop-file
1902 (lambda* (#:key outputs #:allow-other-keys)
1903 (let* ((out (assoc-ref outputs "out"))
1904 (desktop (string-append out "/share/applications"))
1905 (executable (string-append out "/bin/mame")))
1907 (with-output-to-file (string-append desktop "/mame.desktop")
1912 Comment=Multi-purpose emulation framework~@
1917 Categories=Game;Emulator;~@
1918 Keywords=Game;Emulator;Arcade;~%"
1922 `(("pkg-config" ,pkg-config)
1923 ("sphinx" ,python-sphinx)
1924 ("sphinxcontrib-svg2pdfconverter" ,python-sphinxcontrib-svg2pdfconverter)
1925 ("texinfo" ,texinfo)))
1927 `(("alsa-lib" ,alsa-lib)
1928 ("asio" ,asio-1.12) ;the bundled copy is at 1.11
1931 ("fontconfig" ,fontconfig)
1933 ("libjpeg" ,libjpeg-turbo)
1935 ("libxinerama" ,libxinerama)
1937 ("portaudio" ,portaudio)
1938 ("portmidi" ,portmidi)
1939 ("pugixml" ,pugixml)
1940 ("pulseaudio" ,pulseaudio)
1941 ("python-wrapper" ,python-wrapper)
1942 ("qtbase" ,qtbase-5)
1943 ("rapidjson" ,rapidjson)
1944 ("sdl" ,(sdl-union (list sdl2 sdl2-ttf)))
1946 ("utf8proc" ,utf8proc)
1948 (home-page "https://www.mamedev.org")
1949 (synopsis "Multi-purpose emulation framework")
1950 (description "MAME's purpose is to preserve decades of software
1951 history. As electronic technology continues to rush forward, MAME
1952 prevents this important @emph{vintage} software from being lost and
1953 forgotten. This is achieved by documenting the hardware and how it
1954 functions. The source code to MAME serves as this documentation.")
1955 ;; The MAME project as a whole is distributed under the terms of GPL2+.
1956 ;; However, over 90% of the files are under Expat license. Also, artwork,
1957 ;; keymaps, languages and samples are under CC0.
1958 (license (list license:gpl2+ license:expat license:cc0))))
1960 (define-public gnome-arcade
1962 (name "gnome-arcade")
1968 (url "https://github.com/strippato/gnome-arcade")
1969 (commit (string-append "v." version))))
1970 (file-name (git-file-name name version))
1973 "1qc01a62p65qb6mwjfmxqsd6n3rglsfwrjhsp25nr7q54107n55l"))))
1974 (build-system cmake-build-system)
1976 `(#:tests? #f ; No tests.
1977 #:configure-flags (list
1978 (string-append "-DMAME_BIN=\""
1979 (assoc-ref %build-inputs "mame")
1981 (string-append "-DAPP_RES=\""
1982 (assoc-ref %outputs "out")
1983 "/share/gnome-arcade/\""))
1985 (modify-phases %standard-phases
1986 (add-before 'build 'fix-paths
1987 (lambda* (#:key outputs #:allow-other-keys)
1988 (let ((out (assoc-ref outputs "out")))
1990 (substitute* "../source/src/config.c"
1991 (("/usr/share") (string-append out "/share"))))
1994 (lambda* (#:key outputs #:allow-other-keys)
1995 (let* ((out (assoc-ref outputs "out"))
1996 (bin (string-append out "/bin"))
1997 (rom (string-append out "/share/gnome-arcade/data/rom"))
1998 (tile (string-append out "/share/gnome-arcade/data/tile")))
2000 (install-file "../gnome-arcade" bin)
2001 (copy-recursively "../source/res"
2002 (string-append out "/share/gnome-arcade/res"))
2004 (install-file "../source/data/rom/ROM.TXT" rom)
2006 (install-file "../source/data/tile/TILE.TXT" tile))
2009 `(("pkg-config" ,pkg-config)))
2013 ("libevdev" ,libevdev)
2015 ("libarchive" ,libarchive)))
2016 (home-page "https://github.com/strippato/gnome-arcade")
2017 (synopsis "Minimal MAME frontend")
2019 "A minimal GTK+ frontend for MAME, the multi-purpose arcade and console
2021 (license license:gpl3+)))
2023 (define-public pcsxr
2024 ;; No release since 2017.
2025 (let ((commit "6484236cb0281e8040ff6c8078c87899a3407534"))
2028 ;; Version is tagged here: https://github.com/frealgagu/PCSX-Reloaded
2034 (url "https://github.com/pcsxr/PCSX-Reloaded")
2038 "138mayp7zi9v4l3lm5f6xxkds619w1fgg769zm8s45c84jbz7dza"))
2039 (file-name (git-file-name name commit))))
2040 (build-system cmake-build-system)
2042 `(#:tests? #f ;no "test" target
2044 (list "-DSND_BACKEND=pulse"
2045 "-DENABLE_CCDDA='ON'"
2046 "-DUSE_LIBARCHIVE='ON'"
2047 "-DUSE_LIBCDIO='ON'")
2049 (modify-phases %standard-phases
2050 (add-after 'unpack 'cd-subdir
2051 (lambda _ (chdir "pcsxr") #t))
2052 (add-before 'configure 'fix-cdio-lookup
2053 (lambda* (#:key inputs #:allow-other-keys)
2054 (substitute* "cmake/FindCdio.cmake"
2055 (("/usr/include/cdio")
2056 (string-append (assoc-ref inputs "libcdio") "/include/cdio")))
2058 (add-after 'install 'wrap-program
2059 (lambda* (#:key inputs outputs #:allow-other-keys)
2060 (wrap-program (string-append (assoc-ref outputs "out")
2062 ;; For GtkFileChooserDialog.
2063 `("GSETTINGS_SCHEMA_DIR" =
2064 (,(string-append (assoc-ref inputs "gtk+")
2065 "/share/glib-2.0/schemas"))))
2068 `(("pkg-config" ,pkg-config)
2069 ("intltool" ,intltool)
2070 ("glib" ,glib "bin")))
2072 `(("libcdio" ,libcdio)
2077 ("libarchive" ,libarchive)
2078 ("pulseaudio" ,pulseaudio)))
2079 (home-page "https://archive.codeplex.com/?p=pcsxr")
2080 (synopsis "PlayStation emulator")
2082 "A PlayStation emulator based on PCSX-df Project with bugfixes and
2084 (license license:gpl2+))))
2086 (define-public gens-gs
2093 (uri (string-append "https://retrocdn.net/images/6/6d/Gens-gs-r"
2097 "1ha5s6d3y7s9aq9f4zmn9p88109c3mrj36z2w68jhiw5xrxws833"))))
2098 (build-system glib-or-gtk-build-system)
2100 `(#:system "i686-linux"
2102 (modify-phases %standard-phases
2103 (add-after 'unpack 'fix-CFLAGS
2105 ;; Remove GTK API deprecation flags that cause build errors.
2106 (substitute* "configure"
2107 (("GTK_CFLAGS=\"\\$GTK_CFLAGS .*\"") ""))
2110 `(("pkg-config" ,pkg-config)
2115 (home-page "https://segaretro.org/Gens/GS")
2116 (synopsis "Emulator for Sega Genesis/Mega Drive systems")
2118 "Gens/GS is an emulator for the Mega Drive (also known as Sega Genesis),
2119 derived from Gens. Project goals include clean source code, combined features
2120 from various forks of Gens, and improved platform portability.")
2121 (supported-systems '("i686-linux" "x86_64-linux"))
2122 (license license:gpl2+)))
2124 (define-public bsnes
2132 (url "https://github.com/bsnes-emu/bsnes")
2133 (commit (string-append "v" version))))
2134 (file-name (git-file-name name version))
2137 "0j054x38fwai61vj36sc04r3zkzay5acq2cgd9zqv5hs51s36g5b"))))
2138 (build-system gnu-build-system)
2140 `(#:make-flags (list "-C" "bsnes"
2141 ;; Remove march=native
2143 (string-append "prefix=" (assoc-ref %outputs "out")))
2144 #:tests? #f ; No tests.
2145 #:phases (modify-phases %standard-phases
2146 (delete 'configure))))
2148 `(("pkg-config" ,pkg-config)))
2150 `(("alsa-lib" ,alsa-lib)
2154 ("gtksourceview-2" ,gtksourceview-2)
2155 ("libxrandr" ,libxrandr)
2158 ("pulseaudio" ,pulseaudio)
2160 (home-page "https://bsnes.dev/")
2161 (synopsis "Emulator for the Super Nintendo / Super Famicom systems")
2163 "bsnes is a Super Nintendo / Super Famicom emulator that focuses on
2164 performance, features, and ease of use.")
2165 (license license:gpl3)))
2167 ;; python-pwntools requires a -rc release of unicorn
2168 (define-public unicorn
2171 (if (member (%current-system) '("x86_64-linux" "i686-linux"))
2176 (version "1.0.2-rc4")
2177 ;; NOTE: unicorn ships a bundled QEMU, but with a lot of custom modifications.
2182 (url "https://github.com/unicorn-engine/unicorn")
2184 (file-name (git-file-name name version))
2187 "17nyccgk7hpc4hab24yn57f1xnmr7kq4px98zbp2bkwcrxny8gwy"))))
2188 (outputs '("out" "python"))
2189 ;; The main library is not written in Python, but the build process has
2190 ;; little in common with any defined build system, so we might as well
2191 ;; build on top of python-build-system and make use of all
2192 ;; the Python-specific phases that can be reused.
2193 (build-system python-build-system)
2195 `(#:modules ((srfi srfi-26)
2196 (guix build python-build-system)
2199 (modify-phases %standard-phases
2200 (add-after 'unpack 'install-bindings-to-python-output
2201 (lambda* (#:key outputs #:allow-other-keys)
2202 ;; python-build-system will build the bindings and install them to
2203 ;; the "out" output, so change the build-internal names of the
2206 ;; TODO: remove this once #40469 lands, through the core-updates
2207 ;; holding zone, on master.
2208 (set-car! (assoc "out" outputs) "lib")
2209 (set-car! (assoc "python" outputs) "out")
2211 (add-before 'build 'build-library
2212 (lambda* (#:key inputs #:allow-other-keys)
2214 "-j" (number->string (parallel-job-count))
2217 (add-after 'build-library 'install-library
2218 (lambda* (#:key outputs #:allow-other-keys)
2219 (invoke "make" "install"
2223 (assoc-ref outputs "lib")))))
2224 (add-before 'build 'prepare-bindings
2225 (lambda* (#:key outputs #:allow-other-keys)
2226 (chdir "bindings/python")
2227 ;; Set this environment variable so that the Python bindings
2228 ;; don't build their own copy of the shared object, but use
2229 ;; a dummy value such that the bindings test suite uses the
2230 ;; same mechanism for loading the library as any other user.
2231 (setenv "LIBUNICORN_PATH" "1")
2232 (substitute* "unicorn/unicorn.py"
2233 (("_path_list = \\[.*")
2236 (assoc-ref outputs "lib")
2237 ;; eat the rest of the list
2240 (add-before 'check 'check-library
2241 (lambda* (#:key outputs #:allow-other-keys)
2244 (with-directory-excursion
2245 (string-append "../../tests/" suite)
2246 (invoke "make" "test" "CC=gcc"
2248 '("AS=i686-unknown-linux-gnu-as"
2249 "OBJCOPY=i686-unknown-linux-gnu-objcopy")))))
2250 '("unit" "regress"))
2252 (add-after 'install 'install-samples
2253 (lambda* (#:key outputs #:allow-other-keys)
2254 (let* ((python-samples (find-files "." "sample_.*"))
2255 (c-samples (find-files "../../samples" ".*\\.c"))
2257 (string-append (assoc-ref outputs "out")
2258 "/share/doc/unicorn/samples"))
2260 (string-append (assoc-ref outputs "lib")
2261 "/share/doc/unicorn/samples")))
2262 (for-each (cut install-file <> c-docdir) c-samples)
2263 (for-each (cut install-file <> python-docdir) python-samples)
2266 ;; NOTE: cross-binutils needs to be wrapped with unless-x86, as otherwise
2267 ;; the linker provided by the package will be used, circumventing the ld-wrapper.
2269 `(("assembler-for-tests" ,(cross-binutils "i686-unknown-linux-gnu"))))
2271 ("hexdump-for-tests" ,util-linux)))
2272 (home-page "https://www.unicorn-engine.org")
2273 (synopsis "Unicorn CPU emulator framework")
2275 "Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator
2276 framework based on QEMU.")
2277 (license license:gpl2+))))
2279 (define-public ppsspp
2280 ;; Use a recent commit as fixes for ffmpeg 4.4 haven't been released as of
2282 (let ((commit "69fa20744958aef8da9ca052ba7675fdc1636e46")
2286 (version (git-version "1.11.3" revision commit))
2291 (url "https://github.com/hrydgard/ppsspp")
2294 (base32 "0r8w4hllhn6zsfxlajxw3sn3f8vsri45srr4mdwsffzcb4hvl0cr"))
2295 (file-name (git-file-name name version))
2297 (search-patches "ppsspp-disable-upgrade-and-gold.patch"))
2298 (modules '((guix build utils)))
2301 ;; The following is quite a heavy-handed way of unbundling PPSSPP.
2302 ;; There are still a number of external sources, that we don't
2303 ;; remove here. Some may be packaged, others are not.
2304 ;; First, we patch existing sources to include the right headers.
2305 (substitute* (append (find-files "Common" ".*\\.(h|cpp)")
2306 (find-files "Core" ".*\\.(h|cpp)")
2307 (find-files "GPU" ".*\\.(h|cpp)")
2308 (find-files "SDL" ".*\\.(h|cpp)")
2309 (find-files "UI" ".*\\.(h|cpp)"))
2310 ;; These headers are all hard-coded in the original source.
2311 (("ext/cityhash/") "")
2312 (("ext/glslang/glslang/") "glslang/")
2313 (("ext/glslang/") "glslang/")
2314 (("ext/miniupnp/") "")
2315 (("ext/SPIRV-Cross/") "spirv_cross/")
2316 (("ext/vulkan/") "vulkan/")
2317 (("ext/xxhash.h") "xxhash.h")
2318 ;; These definitions do not actually exist in the Vulkan headers,
2319 ;; but PPSSPP defines them in ext/vulkan.
2320 (("VK_FORMAT_BEGIN_RANGE") "VK_FORMAT_UNDEFINED")
2321 (("VK_FORMAT_END_RANGE") "VK_FORMAT_ASTC_12x12_SRGB_BLOCK"))
2322 ;; Next, we patch CMakeLists.
2323 (substitute* "CMakeLists.txt"
2324 ;; Drop unnecessary includes and targets.
2325 (("include_directories\\(ext/glslang\\)") "")
2326 (("include_directories\\(ext/xxhash\\)") "")
2327 (("include_directories\\(ext/cityhash\\)") "")
2328 (("include_directories\\(ext/zstd.*") "")
2329 (("libzstd_static") "zstd")
2330 (("set_target_properties\\(cityhash .*\\)") "")
2331 ;; Fix linking to GLEW.
2332 (("TARGET Ext::GLEW") "true")
2333 (("target_link_libraries\\(native Ext::GLEW\\)")
2334 "find_package(GLEW)\ntarget_link_libraries(native GLEW::GLEW)")
2335 (("Ext::Snappy") "snappy")
2336 ;; Don't search for cityhash/xxhash, we already have them.
2337 (("add_library\\((city|xx)hash STATIC") "if()\nendif(")
2338 (("ext/xxhash\\.[ch]") "")
2339 (("ext/cityhash/.*\\.(cpp|h)") "")
2340 (("if\\(USE_MINIUPNPC\\)" all)
2341 (string-append all "
2342 find_package(miniupnpc)
2343 target_link_libraries(${CoreLibName} miniupnpc ${LDLIBS})
2345 ;; Link all of spirv-cross.
2346 (("spirv-cross-glsl" all)
2348 " spirv-cross-core spirv-cross-cpp"
2349 " spirv-cross-reflect spirv-cross-util")))
2350 (substitute* "ext/CMakeLists.txt"
2351 (("add_subdirectory\\(glew.*") "")
2352 (("add_subdirectory\\(glslang.*") "")
2353 (("add_subdirectory\\(snappy.*") "")
2354 (("add_subdirectory\\(SPIRV-Cross-build.*") "")
2355 (("add_subdirectory\\(zstd.*") ""))
2356 ;; Finally, we can delete the bundled sources.
2357 (for-each delete-file-recursively
2361 "ext/glslang" "ext/glslang-build"
2362 "ext/miniupnp" "ext/miniupnp-build"
2365 "ext/SPIRV-Cross" "ext/SPIRV-Cross-build"
2371 ;; Since we are not including git as an input, PPSSPP is confused
2372 ;; about its version. Let's fix that here.
2373 (substitute* "git-version.cmake"
2374 (("unknown") ,version))))))
2375 (build-system cmake-build-system)
2377 `(("pkg-config" ,pkg-config)
2378 ("python" ,python)))
2380 `(("cityhash" ,cityhash)
2381 ;; ppsspp doesn't yet build with ffmpeg 4.4 (see:
2384 ("glslang" ,glslang)
2388 ("miniupnpc" ,miniupnpc)
2391 ("spirv-cross" ,spirv-cross)
2392 ("vulkan-headers" ,vulkan-headers)
2393 ("vulkan-loader" ,vulkan-loader)
2396 ("zstd" ,zstd "lib")
2397 ; ("zstd" ,zstd "static")
2398 ;; TODO: unbundle armips.
2399 ("armips-source" ,(package-source armips))
2401 ,(let ((commit "6bd5b4bc983917ea8402f73c726b46e36f3de0b4"))
2405 (url "https://github.com/hrydgard/ppsspp-lang")
2408 (base32 "08npr3a4xskf85gnlxidl4ksc3rhc7m5rgnj7vsbjvhvw5ap02qx"))
2409 (file-name (git-file-name "ppsspp-lang" commit)))))
2411 ,(let ((commit "1047400eaec6bcbdb2a64d326375ef6a6617c4ac"))
2415 (url "https://github.com/hrydgard/pspautotests")
2418 (base32 "0nxv1lskcr8zbg6nrfai21mxsw0n5vaqhbsa41c3cxfyx5c4w2pg"))
2419 (file-name (git-file-name "pspautotests" commit)))))))
2421 `(#:out-of-source? #f
2422 #:configure-flags (list "-DUSE_DISCORD=OFF"
2423 "-DUSE_SYSTEM_FFMPEG=ON"
2424 "-DUSE_SYSTEM_LIBZIP=ON"
2426 "-DUNITTEST=ON" "-DHEADLESS=ON")
2428 (modify-phases %standard-phases
2429 (add-after 'unpack 'add-external-sources
2430 (lambda* (#:key inputs #:allow-other-keys)
2431 ;; TODO: unbundle armips.
2432 (copy-recursively (assoc-ref inputs "armips-source")
2434 ;; Some tests are externalised, so we add them here.
2435 (copy-recursively (assoc-ref inputs "tests")
2437 ;; i18n is externalised, so we add it here.
2438 (copy-recursively (assoc-ref inputs "lang")
2441 (add-after 'unpack 'fix-unittest-build
2443 (substitute* "CMakeLists.txt"
2444 (("unittest/TestVertexJit.cpp" all)
2445 (string-append all " unittest/TestShaderGenerators.cpp")))
2446 (substitute* "unittest/TestVertexJit.cpp"
2447 (("#include \"unittest/UnitTest.h\"" all)
2448 (string-append all "\n#include <cmath>")))
2453 (lambda (t) (invoke "./unitTest" t))
2454 '("Arm64Emitter" "ArmEmitter" "X64Emitter" "VertexJit" "Asin"
2455 "SinCos" #|"VFPUSinCos" SIGSEGV|# "MathUtil" "Parsers" "Jit"
2456 "MatrixTranspose" "ParseLBN" "QuickTexHash" "CLZ"
2457 #|"ShaderGenerators"|#))
2458 (invoke "python3" "test.py" "-g")
2461 (lambda* (#:key inputs outputs #:allow-other-keys)
2462 (let* ((out (assoc-ref outputs "out"))
2463 (bin/ppsspp (string-append out "/bin/ppsspp"))
2464 (share (string-append out "/share/ppsspp")))
2465 (copy-recursively "icons/hicolor"
2466 (string-append out "/share/icons/hicolor"))
2467 (install-file "PPSSPPSDL" share)
2468 (copy-recursively "assets" (string-append share "/assets"))
2470 (make-desktop-entry-file
2471 (string-append out "/share/applications/ppsspp.desktop")
2473 #:exec (string-append share "/PPSSPPSDL")
2475 (mkdir-p (string-append out "/bin"))
2476 (with-output-to-file bin/ppsspp
2478 (format #t "#!~a~%exec ~a/PPSSPPSDL \"$@\""
2479 (which "sh") share)))
2480 (chmod bin/ppsspp #o755)
2482 (home-page "https://www.ppsspp.org/")
2483 (synopsis "PSP emulator")
2485 "PPSSPP is a ``high-level'' emulator simulating the PSP operating
2487 (license license:gpl2+))))