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