gnu: ppsspp: Unbundle more sources.
* gnu/packages/emulators (ppsspp)[source]: Update unbundling snippet. [inputs]: Add cityhash, libzip, vulkan-headers, vulkan-loader, xxhash. [arguments]<#:configure-flags>: Add -DUSE_SYSTEM_LIBZIP=ON. Update comments accordingly. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr>
parent
7ff99f4a17
commit
bb3ddda25d
gnu/packages
|
@ -48,6 +48,7 @@
|
||||||
#:use-module (gnu packages compression)
|
#:use-module (gnu packages compression)
|
||||||
#:use-module (gnu packages cross-base)
|
#:use-module (gnu packages cross-base)
|
||||||
#:use-module (gnu packages curl)
|
#:use-module (gnu packages curl)
|
||||||
|
#:use-module (gnu packages digest)
|
||||||
#:use-module (gnu packages elf)
|
#:use-module (gnu packages elf)
|
||||||
#:use-module (gnu packages fonts)
|
#:use-module (gnu packages fonts)
|
||||||
#:use-module (gnu packages fontutils)
|
#:use-module (gnu packages fontutils)
|
||||||
|
@ -1858,25 +1859,69 @@ framework based on QEMU.")
|
||||||
(modules '((guix build utils)))
|
(modules '((guix build utils)))
|
||||||
(snippet
|
(snippet
|
||||||
`(begin
|
`(begin
|
||||||
;; Unbundle sources.
|
;; The following is quite a heavy-handed way of unbundling PPSSPP.
|
||||||
(substitute* (list "Common/Vulkan/VulkanContext.cpp"
|
;; There are still a number of external sources, that we don't
|
||||||
"ext/native/thin3d/vulkan_utils.cpp"
|
;; remove here. Some may be packaged, others are not.
|
||||||
"GPU/Common/ShaderCommon.cpp"
|
;; First, we patch existing sources to include the right headers.
|
||||||
"GPU/Common/ShaderTranslation.cpp"
|
(substitute* (append (list "ext/native/thin3d/vulkan_utils.cpp"
|
||||||
"SDL/SDLMain.cpp")
|
"ext/native/thin3d/thin3d_vulkan.cpp")
|
||||||
|
(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/") "")
|
(("ext/glslang/") "")
|
||||||
(("ext/SPIRV-Cross/") "spirv_cross/"))
|
(("ext/SPIRV-Cross/") "spirv_cross/")
|
||||||
;; Patch CMakeLists.
|
(("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"
|
(substitute* "CMakeLists.txt"
|
||||||
|
;; Drop unnecessary includes and targets.
|
||||||
(("include_directories\\(ext/glslang\\)") "")
|
(("include_directories\\(ext/glslang\\)") "")
|
||||||
|
(("include_directories\\(ext/xxhash\\)") "")
|
||||||
|
(("include_directories\\(ext/cityhash\\)") "")
|
||||||
|
(("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/native/ext/cityhash/.*\\.(cpp|h)") "")
|
||||||
|
;; Link all of spirv-cross.
|
||||||
(("spirv-cross-glsl" all)
|
(("spirv-cross-glsl" all)
|
||||||
(string-append all
|
(string-append all
|
||||||
" spirv-cross-core spirv-cross-cpp"
|
" spirv-cross-core spirv-cross-cpp"
|
||||||
" spirv-cross-reflect spirv-cross-util")))
|
" spirv-cross-reflect spirv-cross-util")))
|
||||||
(substitute* "ext/CMakeLists.txt"
|
(substitute* "ext/CMakeLists.txt"
|
||||||
|
(("add_subdirectory\\(glew\\)") "")
|
||||||
(("add_subdirectory\\(glslang\\)") "")
|
(("add_subdirectory\\(glslang\\)") "")
|
||||||
|
(("add_subdirectory\\(snappy\\)") "")
|
||||||
(("add_subdirectory\\(SPIRV-Cross-build\\)") ""))
|
(("add_subdirectory\\(SPIRV-Cross-build\\)") ""))
|
||||||
(delete-file-recursively "ext/cmake")
|
;; Finally, we can delete the bundled sources.
|
||||||
|
(for-each delete-file-recursively
|
||||||
|
'("ext/cmake"
|
||||||
|
"ext/glew"
|
||||||
|
"ext/glslang" "ext/glslang-build"
|
||||||
|
"ext/native/ext/cityhash"
|
||||||
|
"ext/native/ext/libpng17"
|
||||||
|
"ext/native/ext/libzip"
|
||||||
|
"ext/snappy"
|
||||||
|
"ext/SPIRV-Cross" "ext/SPIRV-Cross-build"
|
||||||
|
"ext/vulkan"
|
||||||
|
"ext/xxhash.c"
|
||||||
|
"ext/xxhash.h"
|
||||||
|
"ext/zlib"))
|
||||||
|
;; Since we are not including git as an input, PPSSPP is confused
|
||||||
|
;; about its version. Let's fix that here.
|
||||||
(substitute* "git-version.cmake"
|
(substitute* "git-version.cmake"
|
||||||
(("unknown") ,version))))))
|
(("unknown") ,version))))))
|
||||||
(build-system cmake-build-system)
|
(build-system cmake-build-system)
|
||||||
|
@ -1884,16 +1929,21 @@ framework based on QEMU.")
|
||||||
`(("pkg-config" ,pkg-config)
|
`(("pkg-config" ,pkg-config)
|
||||||
("python" ,python)))
|
("python" ,python)))
|
||||||
(inputs
|
(inputs
|
||||||
`(("ffmpeg" ,ffmpeg)
|
`(("cityhash" ,cityhash)
|
||||||
|
("ffmpeg" ,ffmpeg)
|
||||||
("glew" ,glew)
|
("glew" ,glew)
|
||||||
("glslang" ,glslang)
|
("glslang" ,glslang)
|
||||||
("libpng" ,libpng)
|
("libpng" ,libpng)
|
||||||
|
("libzip" ,libzip)
|
||||||
("mesa" ,mesa)
|
("mesa" ,mesa)
|
||||||
("sdl2" ,sdl2)
|
("sdl2" ,sdl2)
|
||||||
("snappy" ,snappy)
|
("snappy" ,snappy)
|
||||||
("spirv-cross" ,spirv-cross)
|
("spirv-cross" ,spirv-cross)
|
||||||
|
("vulkan-headers" ,vulkan-headers)
|
||||||
|
("vulkan-loader" ,vulkan-loader)
|
||||||
|
("xxhash" ,xxhash)
|
||||||
("zlib" ,zlib)
|
("zlib" ,zlib)
|
||||||
;; TODO: unbundle builds.
|
;; TODO: unbundle armips.
|
||||||
("armips-source" ,(package-source armips))
|
("armips-source" ,(package-source armips))
|
||||||
("lang"
|
("lang"
|
||||||
,(origin
|
,(origin
|
||||||
|
@ -1915,15 +1965,14 @@ framework based on QEMU.")
|
||||||
`(#:out-of-source? #f
|
`(#:out-of-source? #f
|
||||||
#:configure-flags (list "-DUSE_DISCORD=OFF"
|
#:configure-flags (list "-DUSE_DISCORD=OFF"
|
||||||
"-DUSE_SYSTEM_FFMPEG=ON"
|
"-DUSE_SYSTEM_FFMPEG=ON"
|
||||||
;; For testing.
|
"-DUSE_SYSTEM_LIBZIP=ON"
|
||||||
|
;; for testing
|
||||||
"-DUNITTEST=ON" "-DHEADLESS=ON")
|
"-DUNITTEST=ON" "-DHEADLESS=ON")
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'add-external-sources
|
(add-after 'unpack 'add-external-sources
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
;; TODO: unbundle builds. Not only should we not copy these
|
;; TODO: unbundle armips.
|
||||||
;; sources in, we should also remove as much from "ext/" as we
|
|
||||||
;; can.
|
|
||||||
(copy-recursively (assoc-ref inputs "armips-source")
|
(copy-recursively (assoc-ref inputs "armips-source")
|
||||||
"ext/armips")
|
"ext/armips")
|
||||||
;; Some tests are externalised, so we add them here.
|
;; Some tests are externalised, so we add them here.
|
||||||
|
|
Reference in New Issue