gnu: dolphin-emu: Unbundle more libraries and enable tests.

* gnu/packages/emulators.scm (dolphin-emu)
[source] <snippet>: Delete bzip2, cubeb, enet, fmt, pugixml, soundtouch,
xxhash and zstd sources and de-register enet, soundtouch and xxhash from the
build system.
[arguments] <#:tests?>: Delete argument.
<#:phases>: Add remove-unittests-target-post-build-command and post-check
phases.
<#:configure-flags>: Specify CMAKE_CXX_FLAGS to locate soundtouch headers.
<#:test-target>: New argument.
[inputs]: Add bzip2, cubeb, enet, fmt-7, minizip-ng, xxhash and
zstd:lib.  Replace soundtouch with soundtouch-1/integer-samples.

Reviewed-by: Sou Bunnbu (宋文武) <iyzsong@member.fsf.org>
Change-Id: Id996d992674f9efbbb2eb562286447a388716a82
This commit is contained in:
Maxim Cournoyer 2025-01-14 22:59:48 +09:00
parent 9ad90f5491
commit cb36e3d0ae
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -15,7 +15,7 @@
;;; Copyright © 2020 Christopher Howard <christopher@librehacker.com> ;;; Copyright © 2020 Christopher Howard <christopher@librehacker.com>
;;; Copyright © 2021 Felipe Balbi <balbi@kernel.org> ;;; Copyright © 2021 Felipe Balbi <balbi@kernel.org>
;;; Copyright © 2021, 2024 Felix Gruber <felgru@posteo.net> ;;; Copyright © 2021, 2024 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2021, 2025 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2021, 2024, 2025 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net> ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2023 c4droid <c4droid@foxmail.com> ;;; Copyright © 2023 c4droid <c4droid@foxmail.com>
;;; Copyright © 2023 Yovan Naumovski <yovan@gorski.stream> ;;; Copyright © 2023 Yovan Naumovski <yovan@gorski.stream>
@ -95,6 +95,7 @@
#:use-module (gnu packages ncurses) #:use-module (gnu packages ncurses)
#:use-module (gnu packages networking) #:use-module (gnu packages networking)
#:use-module (gnu packages pkg-config) #:use-module (gnu packages pkg-config)
#:use-module (gnu packages pretty-print)
#:use-module (gnu packages pulseaudio) #:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python) #:use-module (gnu packages python)
#:use-module (gnu packages python-build) #:use-module (gnu packages python-build)
@ -295,58 +296,112 @@ console.")
;; Remove external stuff we don't need. ;; Remove external stuff we don't need.
(for-each (lambda (dir) (for-each (lambda (dir)
(delete-file-recursively (delete-file-recursively
(string-append "Externals/" dir))) (string-append "Externals/" dir)))
'("LZO" "OpenAL" "Qt" "SFML" "curl" "ffmpeg" '("LZO" "OpenAL" "Qt" "SFML" "bzip2"
"gettext" "hidapi" "libpng" "libusb" "mbedtls" ;; XXX: Attempting to use the vulkan-headers package
"miniupnpc" "MoltenVK" "zlib")) ;; results in "error:
;; VK_PRESENT_MODE_RANGE_SIZE_KHR was not declared
;; in this scope".
;;"Vulkan"
"cubeb" "curl" "enet"
"ffmpeg" "fmt" "gettext"
;; XXX: Attempting to use an unbundled glslang at the
;; exact commit used by Dolphin still results in
;; "error: DefaultTBuiltInResource is not a member
;; of glslang".
;;"glslang"
;; XXX: Googletest cannot currently easily be
;; unbundled, as there are missing linking
;; directives.
;;"gtest"
"hidapi" "libpng" "libusb" "mbedtls"
"miniupnpc" "minizip" "MoltenVK" "pugixml"
"soundtouch"
"xxhash" "zlib" "zstd"))
;; Clean up source. ;; Clean up source.
(for-each delete-file (for-each delete-file
(find-files "." ".*\\.(bin|dsy|exe|jar|rar)$")))))) (find-files "." ".*\\.(bin|dsy|exe|jar|rar)$"))
;; Do not attempt to include now-missing directories.
(substitute* "CMakeLists.txt"
((".*add_subdirectory.*Externals/enet.*") "")
((".*add_subdirectory.*Externals/soundtouch.*") "")
((".*add_subdirectory.*Externals/xxhash.*") ""))))))
(build-system cmake-build-system) (build-system cmake-build-system)
(arguments (arguments
'(#:tests? #f (list
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-before 'configure 'generate-fonts&hardcore-libvulkan-path (add-before 'configure 'remove-unittests-target-post-build-command
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda _
(let ((fontfile ;; To skip a few problematic tests, CTest will be manually
(search-input-file inputs ;; invoked in the post-check phase.
"/share/fonts/truetype/wqy-microhei.ttc")) (with-directory-excursion "Source/UnitTests"
(libvulkan (substitute* "CMakeLists.txt"
(search-input-file inputs "/lib/libvulkan.so"))) (("add_custom_command\\(TARGET unittests POST_BUILD.*")
(chdir "docs") "")))))
(invoke "bash" "-c" "g++ -O2 $(freetype-config \ (add-before 'configure 'generate-fonts&hardcore-libvulkan-path
(lambda* (#:key inputs #:allow-other-keys)
(let ((fontfile
(search-input-file inputs
"/share/fonts/truetype/wqy-microhei.ttc"))
(libvulkan
(search-input-file inputs "/lib/libvulkan.so")))
(chdir "docs")
(invoke "bash" "-c" "g++ -O2 $(freetype-config \
--cflags --libs) gc-font-tool.cpp -o gc-font-tool") --cflags --libs) gc-font-tool.cpp -o gc-font-tool")
(invoke "./gc-font-tool" "a" fontfile "font_western.bin") (invoke "./gc-font-tool" "a" fontfile "font_western.bin")
(invoke "./gc-font-tool" "s" fontfile "font_japanese.bin") (invoke "./gc-font-tool" "s" fontfile "font_japanese.bin")
(copy-file "font_japanese.bin" "../Data/Sys/GC/font_japanese.bin") (copy-file "font_japanese.bin" "../Data/Sys/GC/font_japanese.bin")
(copy-file "font_western.bin" "../Data/Sys/GC/font_western.bin") (copy-file "font_western.bin" "../Data/Sys/GC/font_western.bin")
(chdir "..") (chdir "..")
(substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp" (substitute* "Source/Core/VideoBackends/Vulkan/VulkanLoader.cpp"
(("\"vulkan\", 1") (string-append "\"vulkan\"")) (("\"vulkan\", 1") (string-append "\"vulkan\""))
(("\"vulkan\"") (string-append "\"" libvulkan "\"")) (("\"vulkan\"") (string-append "\"" libvulkan "\""))
(("Common::DynamicLibrary::GetVersionedFilename") "")))))) (("Common::DynamicLibrary::GetVersionedFilename") "")))))
(add-after 'check 'post-check
;; The FindGTK2 cmake script only checks hardcoded directories for (lambda* (#:key tests? #:allow-other-keys)
;; glib/gtk headers. (when tests?
(with-directory-excursion "Source/UnitTests"
#:configure-flags (invoke "ctest" "-V" "--output-on-failure"
(list (string-append "-DX11_INCLUDE_DIR=" ;; These tests fail due to libusb failing to
(assoc-ref %build-inputs "libx11") ;; init inside the build container.
"/include") "-E" (string-join
(string-append "-DX11_LIBRARIES=" '("MMIOTest"
(assoc-ref %build-inputs "libx11") "PageFaultTest"
"/lib/libX11.so") "CoreTimingTest"
"-DX11_FOUND=1"))) "FileSystemTest"
"PowerPCTest"
"VertexLoaderTest")
"|")))))))
;; 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
;; build system.
#:configure-flags
#~(list (string-append "-DCMAKE_CXX_FLAGS="
"-I" (search-input-directory
%build-inputs "include/soundtouch"))
(string-append "-DX11_INCLUDE_DIR="
#$(this-package-input "libx11")
"/include")
(string-append "-DX11_LIBRARIES="
(search-input-file %build-inputs
"lib/libX11.so"))
"-DX11_FOUND=1")
#:test-target "unittests"))
(native-inputs (native-inputs
(list gettext-minimal pkg-config)) (list gettext-minimal pkg-config))
(inputs (inputs
(list alsa-lib (list alsa-lib
ao ao
bluez bluez
bzip2
cubeb
curl curl
enet
eudev eudev
ffmpeg-4 ffmpeg-4
fmt-7
font-wqy-microhei font-wqy-microhei
freetype freetype
glew glew
@ -364,6 +419,7 @@ console.")
mbedtls-lts mbedtls-lts
mesa mesa
miniupnpc miniupnpc
minizip-ng
openal openal
pugixml pugixml
pulseaudio pulseaudio
@ -371,9 +427,11 @@ console.")
sdl2 sdl2
sfml sfml
soil soil
soundtouch soundtouch-1/integer-samples
vulkan-loader vulkan-loader
zlib)) xxhash
zlib
`(,zstd "lib")))
(home-page "https://dolphin-emu.org/") (home-page "https://dolphin-emu.org/")
(synopsis "Nintendo Wii and GameCube emulator") (synopsis "Nintendo Wii and GameCube emulator")
(description (description
@ -381,7 +439,7 @@ console.")
GameCube and the Wii. It provides compatibility with all PC controllers, GameCube and the Wii. It provides compatibility with all PC controllers,
turbo speed, networked multiplayer, and graphical enhancements.") turbo speed, networked multiplayer, and graphical enhancements.")
(supported-systems '("x86_64-linux" "aarch64-linux")) (supported-systems '("x86_64-linux" "aarch64-linux"))
; dolphin/Data/Sys/GC/font_*.bin: Licensed under ASL2.0. ;; dolphin/Data/Sys/GC/font_*.bin: Licensed under ASL2.0.
(license (list license:gpl2+ license:asl2.0 license:fdl1.2+))))) (license (list license:gpl2+ license:asl2.0 license:fdl1.2+)))))
(define-public dosbox (define-public dosbox