From fc2ff004f70d59db80fcd70e659e6a0ff96e0a5f Mon Sep 17 00:00:00 2001 From: Liliana Marie Prikler Date: Sun, 23 Jan 2022 15:30:00 +0100 Subject: gnu: ppsspp: Update to 1.12.3. * gnu/packages/emulators.scm (ppsspp): Update to 1.12.3. [inputs]: Convert to new style. Add bash. Remove armips-source, lang and tests. [arguments]: Convert to list of g-exps. <#:phases>: Drop trailing #t. Directly refer to armips source and pspautotests. Check for #:tests? flag. Reenable VFPUSinCos test. * gnu/packages/patches/ppsspp-disable-upgrade-and-gold.patch: Adjust to version 1.12.3. --- gnu/packages/emulators.scm | 378 +++++++++++++++++++++------------------------ 1 file changed, 176 insertions(+), 202 deletions(-) (limited to 'gnu/packages/emulators.scm') diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm index 1a27ac236c..b260ca38f7 100644 --- a/gnu/packages/emulators.scm +++ b/gnu/packages/emulators.scm @@ -51,6 +51,7 @@ #:use-module (gnu packages autotools) #:use-module (gnu packages backup) #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages bison) #:use-module (gnu packages boost) #:use-module (gnu packages build-tools) @@ -2196,213 +2197,186 @@ framework based on QEMU.") (license license:gpl2+)))) (define-public ppsspp - ;; Use a recent commit as fixes for ffmpeg 4.4 haven't been released as of - ;; 1.11.3. - (let ((commit "69fa20744958aef8da9ca052ba7675fdc1636e46") - (revision "1")) - (package - (name "ppsspp") - (version (git-version "1.11.3" revision commit)) - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/hrydgard/ppsspp") - (commit commit))) - (sha256 - (base32 "0r8w4hllhn6zsfxlajxw3sn3f8vsri45srr4mdwsffzcb4hvl0cr")) - (file-name (git-file-name name version)) - (patches - (search-patches "ppsspp-disable-upgrade-and-gold.patch")) - (modules '((guix build utils))) - (snippet - `(begin - ;; The following is quite a heavy-handed way of unbundling PPSSPP. - ;; There are still a number of external sources, that we don't - ;; remove here. Some may be packaged, others are not. - ;; First, we patch existing sources to include the right headers. - (substitute* (append (find-files "Common" ".*\\.(h|cpp)") - (find-files "Core" ".*\\.(h|cpp)") - (find-files "GPU" ".*\\.(h|cpp)") - (find-files "SDL" ".*\\.(h|cpp)") - (find-files "UI" ".*\\.(h|cpp)")) - ;; These headers are all hard-coded in the original source. - (("ext/cityhash/") "") - (("ext/glslang/glslang/") "glslang/") - (("ext/glslang/") "glslang/") - (("ext/miniupnp/") "") - (("ext/SPIRV-Cross/") "spirv_cross/") - (("ext/vulkan/") "vulkan/") - (("ext/xxhash.h") "xxhash.h") - ;; These definitions do not actually exist in the Vulkan headers, - ;; but PPSSPP defines them in ext/vulkan. - (("VK_FORMAT_BEGIN_RANGE") "VK_FORMAT_UNDEFINED") - (("VK_FORMAT_END_RANGE") "VK_FORMAT_ASTC_12x12_SRGB_BLOCK")) - ;; Next, we patch CMakeLists. - (substitute* "CMakeLists.txt" - ;; Drop unnecessary includes and targets. - (("include_directories\\(ext/glslang\\)") "") - (("include_directories\\(ext/xxhash\\)") "") - (("include_directories\\(ext/cityhash\\)") "") - (("include_directories\\(ext/zstd.*") "") - (("libzstd_static") "zstd") - (("set_target_properties\\(cityhash .*\\)") "") - ;; Fix linking to GLEW. - (("TARGET Ext::GLEW") "true") - (("target_link_libraries\\(native Ext::GLEW\\)") - "find_package(GLEW)\ntarget_link_libraries(native GLEW::GLEW)") - (("Ext::Snappy") "snappy") - ;; Don't search for cityhash/xxhash, we already have them. - (("add_library\\((city|xx)hash STATIC") "if()\nendif(") - (("ext/xxhash\\.[ch]") "") - (("ext/cityhash/.*\\.(cpp|h)") "") - (("if\\(USE_MINIUPNPC\\)" all) - (string-append all " + (package + (name "ppsspp") + (version "1.12.3") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/hrydgard/ppsspp") + (commit (string-append "v" version)))) + (sha256 + (base32 "1p6pmp0lhqhk9h5r9xsjicd0zn08bwx3y8533npps96ixwbm2y15")) + (file-name (git-file-name name version)) + (patches + (search-patches "ppsspp-disable-upgrade-and-gold.patch")) + (modules '((guix build utils))) + (snippet + `(begin + ;; The following is quite a heavy-handed way of unbundling PPSSPP. + ;; There are still a number of external sources, that we don't + ;; remove here. Some may be packaged, others are not. + ;; First, we patch existing sources to include the right headers. + (substitute* (append (find-files "Common" ".*\\.(h|cpp)") + (find-files "Core" ".*\\.(h|cpp)") + (find-files "GPU" ".*\\.(h|cpp)") + (find-files "SDL" ".*\\.(h|cpp)") + (find-files "UI" ".*\\.(h|cpp)")) + ;; These headers are all hard-coded in the original source. + (("ext/cityhash/") "") + (("ext/glslang/glslang/") "glslang/") + (("ext/glslang/") "glslang/") + (("ext/miniupnp/") "") + (("ext/SPIRV-Cross/") "spirv_cross/") + (("ext/vulkan/") "vulkan/") + (("ext/xxhash.h") "xxhash.h") + ;; These definitions do not actually exist in the Vulkan headers, + ;; but PPSSPP defines them in ext/vulkan. + (("VK_FORMAT_BEGIN_RANGE") "VK_FORMAT_UNDEFINED") + (("VK_FORMAT_END_RANGE") "VK_FORMAT_ASTC_12x12_SRGB_BLOCK")) + ;; Next, we patch CMakeLists. + (substitute* "CMakeLists.txt" + ;; Drop unnecessary includes and targets. + (("include_directories\\(ext/glslang\\)") "") + (("include_directories\\(ext/xxhash\\)") "") + (("include_directories\\(ext/cityhash\\)") "") + (("include_directories\\(ext/zstd.*") "") + (("libzstd_static") "zstd") + (("set_target_properties\\(cityhash .*\\)") "") + ;; Fix linking to GLEW. + (("TARGET Ext::GLEW") "true") + (("target_link_libraries\\(native Ext::GLEW\\)") + "find_package(GLEW)\ntarget_link_libraries(native GLEW::GLEW)") + (("Ext::Snappy") "snappy") + ;; Don't search for cityhash/xxhash, we already have them. + (("add_library\\((city|xx)hash STATIC") "if()\nendif(") + (("ext/xxhash\\.[ch]") "") + (("ext/cityhash/.*\\.(cpp|h)") "") + (("if\\(USE_MINIUPNPC\\)" all) + (string-append all " find_package(miniupnpc) target_link_libraries(${CoreLibName} miniupnpc ${LDLIBS}) elseif(FALSE)")) - ;; Link all of spirv-cross. - (("spirv-cross-glsl" all) - (string-append all - " spirv-cross-core spirv-cross-cpp" - " spirv-cross-reflect spirv-cross-util"))) - (substitute* "ext/CMakeLists.txt" - (("add_subdirectory\\(glew.*") "") - (("add_subdirectory\\(glslang.*") "") - (("add_subdirectory\\(snappy.*") "") - (("add_subdirectory\\(SPIRV-Cross-build.*") "") - (("add_subdirectory\\(zstd.*") "")) - ;; Finally, we can delete the bundled sources. - (for-each delete-file-recursively - '("MoltenVK" - "ext/cmake" - "ext/glew" - "ext/glslang" "ext/glslang-build" - "ext/miniupnp" "ext/miniupnp-build" - "ext/native" - "ext/snappy" - "ext/SPIRV-Cross" "ext/SPIRV-Cross-build" - "ext/vulkan" - "ext/xxhash.c" - "ext/xxhash.h" - "ext/zlib" - "ext/zstd")) - ;; Since we are not including git as an input, PPSSPP is confused - ;; about its version. Let's fix that here. - (substitute* "git-version.cmake" - (("unknown") ,version)))))) - (build-system cmake-build-system) - (native-inputs - (list pkg-config python)) - (inputs - `(("cityhash" ,cityhash) - ;; ppsspp doesn't yet build with ffmpeg 4.4 (see: - ("ffmpeg" ,ffmpeg) - ("glew" ,glew) - ("glslang" ,glslang) - ("libpng" ,libpng) - ("libzip" ,libzip) - ("mesa" ,mesa) - ("miniupnpc" ,miniupnpc) - ("sdl2" ,sdl2) - ("snappy" ,snappy) - ("spirv-cross" ,spirv-cross) - ("vulkan-headers" ,vulkan-headers) - ("vulkan-loader" ,vulkan-loader) - ("xxhash" ,xxhash) - ("zlib" ,zlib) - ("zstd" ,zstd "lib") -; ("zstd" ,zstd "static") - ;; TODO: unbundle armips. - ("armips-source" ,(package-source armips)) - ("lang" - ,(let ((commit "6bd5b4bc983917ea8402f73c726b46e36f3de0b4")) - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/hrydgard/ppsspp-lang") - (commit commit))) - (sha256 - (base32 "08npr3a4xskf85gnlxidl4ksc3rhc7m5rgnj7vsbjvhvw5ap02qx")) - (file-name (git-file-name "ppsspp-lang" commit))))) - ("tests" - ,(let ((commit "1047400eaec6bcbdb2a64d326375ef6a6617c4ac")) - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/hrydgard/pspautotests") - (commit commit))) - (sha256 - (base32 "0nxv1lskcr8zbg6nrfai21mxsw0n5vaqhbsa41c3cxfyx5c4w2pg")) - (file-name (git-file-name "pspautotests" commit))))))) - (arguments - `(#:out-of-source? #f - #:configure-flags (list "-DUSE_DISCORD=OFF" - "-DUSE_SYSTEM_FFMPEG=ON" - "-DUSE_SYSTEM_LIBZIP=ON" - ;; for testing - "-DUNITTEST=ON" "-DHEADLESS=ON") - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'add-external-sources - (lambda* (#:key inputs #:allow-other-keys) - ;; TODO: unbundle armips. - (copy-recursively (assoc-ref inputs "armips-source") - "ext/armips") - ;; Some tests are externalised, so we add them here. - (copy-recursively (assoc-ref inputs "tests") - "pspautotests") - ;; i18n is externalised, so we add it here. - (copy-recursively (assoc-ref inputs "lang") - "assets/lang") - #t)) - (add-after 'unpack 'fix-unittest-build - (lambda _ - (substitute* "CMakeLists.txt" - (("unittest/TestVertexJit.cpp" all) - (string-append all " unittest/TestShaderGenerators.cpp"))) - (substitute* "unittest/TestVertexJit.cpp" - (("#include \"unittest/UnitTest.h\"" all) - (string-append all "\n#include "))) - #t)) - (replace 'check - (lambda _ - (for-each - (lambda (t) (invoke "./unitTest" t)) - '("Arm64Emitter" "ArmEmitter" "X64Emitter" "VertexJit" "Asin" - "SinCos" #|"VFPUSinCos" SIGSEGV|# "MathUtil" "Parsers" "Jit" - "MatrixTranspose" "ParseLBN" "QuickTexHash" "CLZ" - #|"ShaderGenerators"|#)) - (invoke "python3" "test.py" "-g") - #t)) - (replace 'install - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (bin/ppsspp (string-append out "/bin/ppsspp")) - (share (string-append out "/share/ppsspp"))) - (copy-recursively "icons/hicolor" - (string-append out "/share/icons/hicolor")) - (install-file "PPSSPPSDL" share) - (copy-recursively "assets" (string-append share "/assets")) + ;; Link all of spirv-cross. + (("spirv-cross-glsl" all) + (string-append all + " spirv-cross-core spirv-cross-cpp" + " spirv-cross-reflect spirv-cross-util"))) + (substitute* "ext/CMakeLists.txt" + (("add_subdirectory\\(glew.*") "") + (("add_subdirectory\\(glslang.*") "") + (("add_subdirectory\\(snappy.*") "") + (("add_subdirectory\\(SPIRV-Cross-build.*") "") + (("add_subdirectory\\(zstd.*") "")) + ;; Finally, we can delete the bundled sources. + (for-each delete-file-recursively + '("ext/cmake" + "ext/glew" + "ext/glslang" "ext/glslang-build" + "ext/miniupnp" "ext/miniupnp-build" + "ext/native" + "ext/snappy" + "ext/SPIRV-Cross" "ext/SPIRV-Cross-build" + "ext/vulkan" + "ext/xxhash.c" + "ext/xxhash.h" + "ext/zlib" + "ext/zstd")) + ;; Since we are not including git as an input, PPSSPP is confused + ;; about its version. Let's fix that here. + (substitute* "git-version.cmake" + (("unknown") ,version)))))) + (build-system cmake-build-system) + (native-inputs (list pkg-config python)) + (inputs (list bash + cityhash + ffmpeg + glew + glslang + libpng + libzip + mesa + miniupnpc + sdl2 + snappy + spirv-cross + vulkan-headers + vulkan-loader + xxhash + zlib + `(,zstd "lib"))) + (arguments + (list + #:out-of-source? #f + #:configure-flags #~(list "-DUSE_DISCORD=OFF" + "-DUSE_SYSTEM_FFMPEG=ON" + "-DUSE_SYSTEM_LIBZIP=ON" + ;; for testing + "-DUNITTEST=ON" "-DHEADLESS=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'add-external-sources + (lambda* (#:key inputs #:allow-other-keys) + ;; TODO: unbundle armips. + (copy-recursively #$(package-source armips) "ext/armips") + ;; Some tests are externalised, so we add them here. + (copy-recursively + #$(let ((commit "1047400eaec6bcbdb2a64d326375ef6a6617c4ac")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/hrydgard/pspautotests") + (commit commit))) + (sha256 + (base32 "0nxv1lskcr8zbg6nrfai21mxsw0n5vaqhbsa41c3cxfyx5c4w2pg")) + (file-name (git-file-name "pspautotests" commit)))) + "pspautotests"))) + (add-after 'unpack 'fix-unittest-build + (lambda _ + (substitute* "CMakeLists.txt" + (("unittest/TestVertexJit.cpp" all) + (string-append all " unittest/TestShaderGenerators.cpp"))) + (substitute* "unittest/TestVertexJit.cpp" + (("#include \"unittest/UnitTest.h\"" all) + (string-append all "\n#include "))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (for-each + (lambda (t) (invoke "./unitTest" t)) + '("Arm64Emitter" "ArmEmitter" "X64Emitter" "VertexJit" "Asin" + "SinCos" "VFPUSinCos" "MathUtil" "Parsers" "Jit" + "MatrixTranspose" "ParseLBN" "QuickTexHash" "CLZ" + #|"ShaderGenerators"|#)) + (invoke "python3" "test.py" "-g")))) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin/ppsspp (string-append out "/bin/ppsspp")) + (share (string-append out "/share/ppsspp"))) + (copy-recursively "icons/hicolor" + (string-append out "/share/icons/hicolor")) + (install-file "PPSSPPSDL" share) + (copy-recursively "assets" (string-append share "/assets")) - (make-desktop-entry-file - (string-append out "/share/applications/ppsspp.desktop") - #:name "PPSSPP" - #:exec (string-append share "/PPSSPPSDL") - #:icon "ppsspp") - (mkdir-p (string-append out "/bin")) - (with-output-to-file bin/ppsspp - (lambda () - (format #t "#!~a~%exec ~a/PPSSPPSDL \"$@\"" - (which "sh") share))) - (chmod bin/ppsspp #o755) - #t)))))) - (home-page "https://www.ppsspp.org/") - (synopsis "PSP emulator") - (description - "PPSSPP is a ``high-level'' emulator simulating the PSP operating + (make-desktop-entry-file + (string-append out "/share/applications/ppsspp.desktop") + #:name "PPSSPP" + #:exec (string-append share "/PPSSPPSDL") + #:icon "ppsspp") + (mkdir-p (string-append out "/bin")) + (with-output-to-file bin/ppsspp + (lambda () + (format #t "#!~a~%exec ~a/PPSSPPSDL \"$@\"" + (search-input-file inputs "/bin/bash") share))) + (chmod bin/ppsspp #o755))))))) + (home-page "https://www.ppsspp.org/") + (synopsis "PSP emulator") + (description + "PPSSPP is a ``high-level'' emulator simulating the PSP operating system.") - (license license:gpl2+)))) + (license license:gpl2+))) (define-public exomizer (package -- cgit v1.2.3