summaryrefslogtreecommitdiff
path: root/gnu/packages/emulators.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-01-17 11:31:55 +0900
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-01-26 22:59:59 +0900
commit5aadcaaa6577c452fe8042dbd738dba6c3051b4b (patch)
tree65557be8fdf137384dc4c3d94486df1129c1b647 /gnu/packages/emulators.scm
parentcb36e3d0aed39ec92f01a83cfb685dc04a2b1327 (diff)
gnu: dolphin-emu: Build .bin binary files and preserve data ones.
These files are necessary to save games, enable cheat codes, etc. * gnu/packages/emulators.scm (dolphin-emu) [source] <snippet>: Refine to avoid deleting a few .bin which are not executable objects but rather configuration files samples. [phases]: Add build-codeloader.bin, build-dsp_rom.bin and build-dsp_coefs.bin phases. [arguments] <configure-flags>: Add -DDSPTOOL=ON. [native-inputs]: Add a cross-compiler for powerpc. Add python-minimal and python-numpy. Reviewed-by: Sou Bunnbu (宋文武) <iyzsong@member.fsf.org> Change-Id: Ida8df1add940e1708c557223409d854aa995e8a5
Diffstat (limited to 'gnu/packages/emulators.scm')
-rw-r--r--gnu/packages/emulators.scm50
1 files changed, 45 insertions, 5 deletions
diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 90c38452437..49a1b12713b 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -99,6 +99,7 @@
99 #:use-module (gnu packages pulseaudio) 99 #:use-module (gnu packages pulseaudio)
100 #:use-module (gnu packages python) 100 #:use-module (gnu packages python)
101 #:use-module (gnu packages python-build) 101 #:use-module (gnu packages python-build)
102 #:use-module (gnu packages python-xyz)
102 #:use-module (gnu packages qt) 103 #:use-module (gnu packages qt)
103 #:use-module (gnu packages sdl) 104 #:use-module (gnu packages sdl)
104 #:use-module (gnu packages sphinx) 105 #:use-module (gnu packages sphinx)
@@ -290,7 +291,8 @@ console.")
290 (file-name (git-file-name name version)) 291 (file-name (git-file-name name version))
291 (sha256 292 (sha256
292 (base32 "1p8qsxlabgmz3nic0a9ghh9d3lzl5f8i3kmdrrvx6w8kdlp33018")) 293 (base32 "1p8qsxlabgmz3nic0a9ghh9d3lzl5f8i3kmdrrvx6w8kdlp33018"))
293 (modules '((guix build utils))) 294 (modules '((guix build utils)
295 (ice-9 regex)))
294 (snippet 296 (snippet
295 '(begin 297 '(begin
296 ;; Remove external stuff we don't need. 298 ;; Remove external stuff we don't need.
@@ -318,9 +320,19 @@ console.")
318 "miniupnpc" "minizip" "MoltenVK" "pugixml" 320 "miniupnpc" "minizip" "MoltenVK" "pugixml"
319 "soundtouch" 321 "soundtouch"
320 "xxhash" "zlib" "zstd")) 322 "xxhash" "zlib" "zstd"))
321 ;; Clean up source. 323 ;; Clean up the source.
322 (for-each delete-file 324 (for-each delete-file
323 (find-files "." ".*\\.(bin|dsy|exe|jar|rar)$")) 325 (find-files
326 "."
327 (lambda (file _)
328 (and (string-match "\\.(bin|dsy|exe|jar|rar)$" file)
329 ;; Preserve the important wc24 .bin
330 ;; configuration *data* files.
331 (not (member (basename file)
332 '("misc.bin"
333 "nwc24dl.bin"
334 "nwc24fl.bin"
335 "nwc24fls.bin")))))))
324 ;; Do not attempt to include now-missing directories. 336 ;; Do not attempt to include now-missing directories.
325 (substitute* "CMakeLists.txt" 337 (substitute* "CMakeLists.txt"
326 ((".*add_subdirectory.*Externals/enet.*") "") 338 ((".*add_subdirectory.*Externals/enet.*") "")
@@ -372,7 +384,30 @@ console.")
372 "FileSystemTest" 384 "FileSystemTest"
373 "PowerPCTest" 385 "PowerPCTest"
374 "VertexLoaderTest") 386 "VertexLoaderTest")
375 "|"))))))) 387 "|"))))))
388 (add-before 'install 'build-codeloader.bin
389 (lambda _
390 (with-directory-excursion "../source/docs"
391 ;; The following command-line is adapted from the example in
392 ;; codehandler.s.
393 (invoke "powerpc-linux-gnu-gcc" "-mpowerpc" "-mbig"
394 "codehandler.s" "-nostartfiles" "-nodefaultlibs"
395 "-nostdlib" "-T" "codehandler.ld"
396 "-o" "codehandler.bin")
397 (copy-file "codehandler.bin" "../Data/Sys/codehandler.bin"))))
398 (add-before 'install 'build-dsp_rom.bin
399 (lambda _
400 ;; Ensure dsptool is on PATH.
401 (setenv "PATH" (string-append (getenv "PATH") ":"
402 (getcwd) "/Binaries"))
403 (with-directory-excursion "../source"
404 (invoke "dsptool" "-o" "Data/Sys/GC/dsp_rom.bin"
405 "docs/DSP/free_dsp_rom/dsp_rom.ds"))))
406 (add-before 'install 'build-dsp_coefs.bin
407 (lambda _
408 (with-directory-excursion "../source"
409 (invoke "python3" "docs/DSP/free_dsp_rom/generate_coefs.py")
410 (rename-file "dsp_coef.bin" "Data/Sys/GC/dsp_coef.bin")))))
376 ;; The FindGTK2 cmake script only checks hardcoded directories for 411 ;; The FindGTK2 cmake script only checks hardcoded directories for
377 ;; glib/gtk headers. Also add some include directories via the CXX 412 ;; glib/gtk headers. Also add some include directories via the CXX
378 ;; flags to let GCC find some headers not actively searched by the 413 ;; flags to let GCC find some headers not actively searched by the
@@ -381,6 +416,7 @@ console.")
381 #~(list (string-append "-DCMAKE_CXX_FLAGS=" 416 #~(list (string-append "-DCMAKE_CXX_FLAGS="
382 "-I" (search-input-directory 417 "-I" (search-input-directory
383 %build-inputs "include/soundtouch")) 418 %build-inputs "include/soundtouch"))
419 "-DDSPTOOL=ON"
384 (string-append "-DX11_INCLUDE_DIR=" 420 (string-append "-DX11_INCLUDE_DIR="
385 #$(this-package-input "libx11") 421 #$(this-package-input "libx11")
386 "/include") 422 "/include")
@@ -390,7 +426,11 @@ console.")
390 "-DX11_FOUND=1") 426 "-DX11_FOUND=1")
391 #:test-target "unittests")) 427 #:test-target "unittests"))
392 (native-inputs 428 (native-inputs
393 (list gettext-minimal pkg-config)) 429 (list (cross-gcc "powerpc-linux-gnu")
430 gettext-minimal
431 pkg-config
432 python-minimal
433 python-numpy))
394 (inputs 434 (inputs
395 (list alsa-lib 435 (list alsa-lib
396 ao 436 ao