summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Prikler <leo.prikler@student.tugraz.at>2020-06-30 19:34:38 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2020-07-01 12:10:30 +0200
commitbb3ddda25ddfd8892d4b09ef99d6fa4f1bfd8eeb (patch)
tree01aadf0b2c3cac7234a5f2dbfd233256f41ca2ba
parentgnu: spirv-cross: Improve description. (diff)
downloadguix-bb3ddda25ddfd8892d4b09ef99d6fa4f1bfd8eeb.tar.gz
guix-bb3ddda25ddfd8892d4b09ef99d6fa4f1bfd8eeb.tar.bz2
guix-bb3ddda25ddfd8892d4b09ef99d6fa4f1bfd8eeb.tar.xz
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>
-rw-r--r--gnu/packages/emulators.scm79
1 files changed, 64 insertions, 15 deletions
diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index c0353c6..35f236d 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -48,6 +48,7 @@
48 #:use-module (gnu packages compression) 48 #:use-module (gnu packages compression)
49 #:use-module (gnu packages cross-base) 49 #:use-module (gnu packages cross-base)
50 #:use-module (gnu packages curl) 50 #:use-module (gnu packages curl)
51 #:use-module (gnu packages digest)
51 #:use-module (gnu packages elf) 52 #:use-module (gnu packages elf)
52 #:use-module (gnu packages fonts) 53 #:use-module (gnu packages fonts)
53 #:use-module (gnu packages fontutils) 54 #:use-module (gnu packages fontutils)
@@ -1858,25 +1859,69 @@ framework based on QEMU.")
1858 (modules '((guix build utils))) 1859 (modules '((guix build utils)))
1859 (snippet 1860 (snippet
1860 `(begin 1861 `(begin
1861 ;; Unbundle sources. 1862 ;; The following is quite a heavy-handed way of unbundling PPSSPP.
1862 (substitute* (list "Common/Vulkan/VulkanContext.cpp" 1863 ;; There are still a number of external sources, that we don't
1863 "ext/native/thin3d/vulkan_utils.cpp" 1864 ;; remove here. Some may be packaged, others are not.
1864 "GPU/Common/ShaderCommon.cpp" 1865 ;; First, we patch existing sources to include the right headers.
1865 "GPU/Common/ShaderTranslation.cpp" 1866 (substitute* (append (list "ext/native/thin3d/vulkan_utils.cpp"
1866 "SDL/SDLMain.cpp") 1867 "ext/native/thin3d/thin3d_vulkan.cpp")
1868 (find-files "Common" ".*\\.(h|cpp)")
1869 (find-files "Core" ".*\\.(h|cpp)")
1870 (find-files "GPU" ".*\\.(h|cpp)")
1871 (find-files "SDL" ".*\\.(h|cpp)")
1872 (find-files "UI" ".*\\.(h|cpp)"))
1873 ;; These headers are all hard-coded in the original source.
1874 (("ext/cityhash/") "")
1867 (("ext/glslang/") "") 1875 (("ext/glslang/") "")
1868 (("ext/SPIRV-Cross/") "spirv_cross/")) 1876 (("ext/SPIRV-Cross/") "spirv_cross/")
1869 ;; Patch CMakeLists. 1877 (("ext/vulkan/") "vulkan/")
1878 (("ext/xxhash.h") "xxhash.h")
1879 ;; These definitions do not actually exist in the Vulkan headers,
1880 ;; but PPSSPP defines them in ext/vulkan.
1881 (("VK_FORMAT_BEGIN_RANGE") "VK_FORMAT_UNDEFINED")
1882 (("VK_FORMAT_END_RANGE") "VK_FORMAT_ASTC_12x12_SRGB_BLOCK"))
1883 ;; Next, we patch CMakeLists.
1870 (substitute* "CMakeLists.txt" 1884 (substitute* "CMakeLists.txt"
1885 ;; Drop unnecessary includes and targets.
1871 (("include_directories\\(ext/glslang\\)") "") 1886 (("include_directories\\(ext/glslang\\)") "")
1887 (("include_directories\\(ext/xxhash\\)") "")
1888 (("include_directories\\(ext/cityhash\\)") "")
1889 (("set_target_properties\\(cityhash .*\\)") "")
1890 ;; Fix linking to GLEW.
1891 (("TARGET Ext::GLEW") "true")
1892 (("target_link_libraries\\(native Ext::GLEW\\)")
1893 "find_package(GLEW)\ntarget_link_libraries(native GLEW::GLEW)")
1894 (("Ext::Snappy") "snappy")
1895 ;; Don't search for cityhash/xxhash, we already have them.
1896 (("add_library\\((city|xx)hash STATIC") "if()\nendif(")
1897 (("ext/xxhash\\.[ch]") "")
1898 (("ext/native/ext/cityhash/.*\\.(cpp|h)") "")
1899 ;; Link all of spirv-cross.
1872 (("spirv-cross-glsl" all) 1900 (("spirv-cross-glsl" all)
1873 (string-append all 1901 (string-append all
1874 " spirv-cross-core spirv-cross-cpp" 1902 " spirv-cross-core spirv-cross-cpp"
1875 " spirv-cross-reflect spirv-cross-util"))) 1903 " spirv-cross-reflect spirv-cross-util")))
1876 (substitute* "ext/CMakeLists.txt" 1904 (substitute* "ext/CMakeLists.txt"
1905 (("add_subdirectory\\(glew\\)") "")
1877 (("add_subdirectory\\(glslang\\)") "") 1906 (("add_subdirectory\\(glslang\\)") "")
1907 (("add_subdirectory\\(snappy\\)") "")
1878 (("add_subdirectory\\(SPIRV-Cross-build\\)") "")) 1908 (("add_subdirectory\\(SPIRV-Cross-build\\)") ""))
1879 (delete-file-recursively "ext/cmake") 1909 ;; Finally, we can delete the bundled sources.
1910 (for-each delete-file-recursively
1911 '("ext/cmake"
1912 "ext/glew"
1913 "ext/glslang" "ext/glslang-build"
1914 "ext/native/ext/cityhash"
1915 "ext/native/ext/libpng17"
1916 "ext/native/ext/libzip"
1917 "ext/snappy"
1918 "ext/SPIRV-Cross" "ext/SPIRV-Cross-build"
1919 "ext/vulkan"
1920 "ext/xxhash.c"
1921 "ext/xxhash.h"
1922 "ext/zlib"))
1923 ;; Since we are not including git as an input, PPSSPP is confused
1924 ;; about its version. Let's fix that here.
1880 (substitute* "git-version.cmake" 1925 (substitute* "git-version.cmake"
1881 (("unknown") ,version)))))) 1926 (("unknown") ,version))))))
1882 (build-system cmake-build-system) 1927 (build-system cmake-build-system)
@@ -1884,16 +1929,21 @@ framework based on QEMU.")
1884 `(("pkg-config" ,pkg-config) 1929 `(("pkg-config" ,pkg-config)
1885 ("python" ,python))) 1930 ("python" ,python)))
1886 (inputs 1931 (inputs
1887 `(("ffmpeg" ,ffmpeg) 1932 `(("cityhash" ,cityhash)
1933 ("ffmpeg" ,ffmpeg)
1888 ("glew" ,glew) 1934 ("glew" ,glew)
1889 ("glslang" ,glslang) 1935 ("glslang" ,glslang)
1890 ("libpng" ,libpng) 1936 ("libpng" ,libpng)
1937 ("libzip" ,libzip)
1891 ("mesa" ,mesa) 1938 ("mesa" ,mesa)
1892 ("sdl2" ,sdl2) 1939 ("sdl2" ,sdl2)
1893 ("snappy" ,snappy) 1940 ("snappy" ,snappy)
1894 ("spirv-cross" ,spirv-cross) 1941 ("spirv-cross" ,spirv-cross)
1942 ("vulkan-headers" ,vulkan-headers)
1943 ("vulkan-loader" ,vulkan-loader)
1944 ("xxhash" ,xxhash)
1895 ("zlib" ,zlib) 1945 ("zlib" ,zlib)
1896 ;; TODO: unbundle builds. 1946 ;; TODO: unbundle armips.
1897 ("armips-source" ,(package-source armips)) 1947 ("armips-source" ,(package-source armips))
1898 ("lang" 1948 ("lang"
1899 ,(origin 1949 ,(origin
@@ -1915,15 +1965,14 @@ framework based on QEMU.")
1915 `(#:out-of-source? #f 1965 `(#:out-of-source? #f
1916 #:configure-flags (list "-DUSE_DISCORD=OFF" 1966 #:configure-flags (list "-DUSE_DISCORD=OFF"
1917 "-DUSE_SYSTEM_FFMPEG=ON" 1967 "-DUSE_SYSTEM_FFMPEG=ON"
1918 ;; For testing. 1968 "-DUSE_SYSTEM_LIBZIP=ON"
1969 ;; for testing
1919 "-DUNITTEST=ON" "-DHEADLESS=ON") 1970 "-DUNITTEST=ON" "-DHEADLESS=ON")
1920 #:phases 1971 #:phases
1921 (modify-phases %standard-phases 1972 (modify-phases %standard-phases
1922 (add-after 'unpack 'add-external-sources 1973 (add-after 'unpack 'add-external-sources
1923 (lambda* (#:key inputs #:allow-other-keys) 1974 (lambda* (#:key inputs #:allow-other-keys)
1924 ;; TODO: unbundle builds. Not only should we not copy these 1975 ;; TODO: unbundle armips.
1925 ;; sources in, we should also remove as much from "ext/" as we
1926 ;; can.
1927 (copy-recursively (assoc-ref inputs "armips-source") 1976 (copy-recursively (assoc-ref inputs "armips-source")
1928 "ext/armips") 1977 "ext/armips")
1929 ;; Some tests are externalised, so we add them here. 1978 ;; Some tests are externalised, so we add them here.