aboutsummaryrefslogtreecommitdiff
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
parentcb36e3d0aed39ec92f01a83cfb685dc04a2b1327 (diff)
downloadguix-5aadcaaa6577c452fe8042dbd738dba6c3051b4b.tar.gz
guix-5aadcaaa6577c452fe8042dbd738dba6c3051b4b.zip
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
-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 90c3845243..49a1b12713 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -99,6 +99,7 @@
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
+ #:use-module (gnu packages python-xyz)
#:use-module (gnu packages qt)
#:use-module (gnu packages sdl)
#:use-module (gnu packages sphinx)
@@ -290,7 +291,8 @@ console.")
(file-name (git-file-name name version))
(sha256
(base32 "1p8qsxlabgmz3nic0a9ghh9d3lzl5f8i3kmdrrvx6w8kdlp33018"))
- (modules '((guix build utils)))
+ (modules '((guix build utils)
+ (ice-9 regex)))
(snippet
'(begin
;; Remove external stuff we don't need.
@@ -318,9 +320,19 @@ console.")
"miniupnpc" "minizip" "MoltenVK" "pugixml"
"soundtouch"
"xxhash" "zlib" "zstd"))
- ;; Clean up source.
+ ;; Clean up the source.
(for-each delete-file
- (find-files "." ".*\\.(bin|dsy|exe|jar|rar)$"))
+ (find-files
+ "."
+ (lambda (file _)
+ (and (string-match "\\.(bin|dsy|exe|jar|rar)$" file)
+ ;; Preserve the important wc24 .bin
+ ;; configuration *data* files.
+ (not (member (basename file)
+ '("misc.bin"
+ "nwc24dl.bin"
+ "nwc24fl.bin"
+ "nwc24fls.bin")))))))
;; Do not attempt to include now-missing directories.
(substitute* "CMakeLists.txt"
((".*add_subdirectory.*Externals/enet.*") "")
@@ -372,7 +384,30 @@ console.")
"FileSystemTest"
"PowerPCTest"
"VertexLoaderTest")
- "|")))))))
+ "|"))))))
+ (add-before 'install 'build-codeloader.bin
+ (lambda _
+ (with-directory-excursion "../source/docs"
+ ;; The following command-line is adapted from the example in
+ ;; codehandler.s.
+ (invoke "powerpc-linux-gnu-gcc" "-mpowerpc" "-mbig"
+ "codehandler.s" "-nostartfiles" "-nodefaultlibs"
+ "-nostdlib" "-T" "codehandler.ld"
+ "-o" "codehandler.bin")
+ (copy-file "codehandler.bin" "../Data/Sys/codehandler.bin"))))
+ (add-before 'install 'build-dsp_rom.bin
+ (lambda _
+ ;; Ensure dsptool is on PATH.
+ (setenv "PATH" (string-append (getenv "PATH") ":"
+ (getcwd) "/Binaries"))
+ (with-directory-excursion "../source"
+ (invoke "dsptool" "-o" "Data/Sys/GC/dsp_rom.bin"
+ "docs/DSP/free_dsp_rom/dsp_rom.ds"))))
+ (add-before 'install 'build-dsp_coefs.bin
+ (lambda _
+ (with-directory-excursion "../source"
+ (invoke "python3" "docs/DSP/free_dsp_rom/generate_coefs.py")
+ (rename-file "dsp_coef.bin" "Data/Sys/GC/dsp_coef.bin")))))
;; The FindGTK2 cmake script only checks hardcoded directories for
;; glib/gtk headers. Also add some include directories via the CXX
;; flags to let GCC find some headers not actively searched by the
@@ -381,6 +416,7 @@ console.")
#~(list (string-append "-DCMAKE_CXX_FLAGS="
"-I" (search-input-directory
%build-inputs "include/soundtouch"))
+ "-DDSPTOOL=ON"
(string-append "-DX11_INCLUDE_DIR="
#$(this-package-input "libx11")
"/include")
@@ -390,7 +426,11 @@ console.")
"-DX11_FOUND=1")
#:test-target "unittests"))
(native-inputs
- (list gettext-minimal pkg-config))
+ (list (cross-gcc "powerpc-linux-gnu")
+ gettext-minimal
+ pkg-config
+ python-minimal
+ python-numpy))
(inputs
(list alsa-lib
ao