Merge pull request #213533 from atorres1985-contrib/small-fixups

ppsspp: refactor

authored by

Nick Cao and committed by
GitHub
57cbd074 e7c66e1d

+71 -65
+70 -65
pkgs/applications/emulators/ppsspp/default.nix
··· 12 , makeWrapper 13 , pkg-config 14 , python3 15 - , qtbase ? null 16 - , qtmultimedia ? null 17 , snappy 18 , vulkan-loader 19 , wayland 20 - , wrapQtAppsHook ? null 21 , zlib 22 , enableVulkan ? true 23 , forceWayland ? false 24 }: 25 26 let 27 - enableQt = (qtbase != null); 28 - frontend = if enableQt then "Qt" else "SDL and headless"; 29 - vulkanPath = lib.makeLibraryPath [ vulkan-loader ]; 30 - 31 # experimental, see https://github.com/hrydgard/ppsspp/issues/13845 32 vulkanWayland = enableVulkan && forceWayland; 33 in 34 - # Only SDL front end needs to specify whether to use Wayland 35 - assert forceWayland -> !enableQt; 36 - stdenv.mkDerivation (finalAttrs: { 37 - pname = "ppsspp" 38 - + lib.optionalString enableQt "-qt" 39 - + lib.optionalString (!enableQt) "-sdl" 40 - + lib.optionalString forceWayland "-wayland"; 41 - version = "1.14.4"; 42 43 - src = fetchFromGitHub { 44 - owner = "hrydgard"; 45 - repo = "ppsspp"; 46 - rev = "v${finalAttrs.version}"; 47 - fetchSubmodules = true; 48 - sha256 = "sha256-7xzhN8JIQD4LZg8sQ8rLNYZrW0nCNBfZFgzoKdoWbKc="; 49 - }; 50 51 - postPatch = '' 52 - substituteInPlace git-version.cmake --replace unknown ${finalAttrs.src.rev} 53 - substituteInPlace UI/NativeApp.cpp --replace /usr/share $out/share 54 - ''; 55 56 - nativeBuildInputs = [ 57 - cmake 58 - copyDesktopItems 59 - makeWrapper 60 - pkg-config 61 - python3 62 - wrapQtAppsHook 63 - ]; 64 65 - buildInputs = [ 66 - SDL2 67 - ffmpeg 68 - (glew.override { enableEGL = forceWayland; }) 69 - libzip 70 - qtbase 71 - qtmultimedia 72 - snappy 73 - zlib 74 - ] ++ lib.optional enableVulkan vulkan-loader 75 - ++ lib.optionals vulkanWayland [ wayland libffi ]; 76 77 - cmakeFlags = [ 78 - "-DHEADLESS=${if enableQt then "OFF" else "ON"}" 79 - "-DOpenGL_GL_PREFERENCE=GLVND" 80 - "-DUSE_SYSTEM_FFMPEG=ON" 81 - "-DUSE_SYSTEM_LIBZIP=ON" 82 - "-DUSE_SYSTEM_SNAPPY=ON" 83 - "-DUSE_WAYLAND_WSI=${if vulkanWayland then "ON" else "OFF"}" 84 - "-DUSING_QT_UI=${if enableQt then "ON" else "OFF"}" 85 - ]; 86 87 - desktopItems = [(makeDesktopItem { 88 desktopName = "PPSSPP"; 89 name = "ppsspp"; 90 exec = "ppsspp"; 91 icon = "ppsspp"; 92 comment = "Play PSP games on your computer"; 93 categories = [ "Game" "Emulator" ]; 94 - })]; 95 96 - installPhase = '' 97 runHook preInstall 98 mkdir -p $out/share/{applications,ppsspp} 99 '' + (if enableQt then '' 100 install -Dm555 PPSSPPQt $out/bin/ppsspp ··· 108 --prefix LD_LIBRARY_PATH : ${vulkanPath} \ 109 '' + "\n" + '' 110 mv assets $out/share/ppsspp 111 runHook postInstall 112 ''; 113 114 - meta = with lib; { 115 - homepage = "https://www.ppsspp.org/"; 116 - description = "A HLE Playstation Portable emulator, written in C++ (${frontend})"; 117 - license = licenses.gpl2Plus; 118 - maintainers = with maintainers; [ AndersonTorres ]; 119 - platforms = platforms.linux; 120 - }; 121 - })
··· 12 , makeWrapper 13 , pkg-config 14 , python3 15 + , qtbase 16 + , qtmultimedia 17 , snappy 18 , vulkan-loader 19 , wayland 20 + , wrapQtAppsHook 21 , zlib 22 + , enableQt ? false 23 , enableVulkan ? true 24 , forceWayland ? false 25 }: 26 27 let 28 # experimental, see https://github.com/hrydgard/ppsspp/issues/13845 29 vulkanWayland = enableVulkan && forceWayland; 30 in 31 + # Only SDL frontend needs to specify whether to use Wayland 32 + assert forceWayland -> !enableQt; 33 + stdenv.mkDerivation (self: { 34 + pname = "ppsspp" 35 + + lib.optionalString enableQt "-qt" 36 + + lib.optionalString (!enableQt) "-sdl" 37 + + lib.optionalString forceWayland "-wayland"; 38 + version = "1.14.4"; 39 40 + src = fetchFromGitHub { 41 + owner = "hrydgard"; 42 + repo = "ppsspp"; 43 + rev = "v${self.version}"; 44 + fetchSubmodules = true; 45 + sha256 = "sha256-7xzhN8JIQD4LZg8sQ8rLNYZrW0nCNBfZFgzoKdoWbKc="; 46 + }; 47 48 + postPatch = '' 49 + substituteInPlace git-version.cmake --replace unknown ${self.src.rev} 50 + substituteInPlace UI/NativeApp.cpp --replace /usr/share $out/share 51 + ''; 52 53 + nativeBuildInputs = [ 54 + cmake 55 + copyDesktopItems 56 + makeWrapper 57 + pkg-config 58 + python3 59 + ] ++ lib.optional enableQt wrapQtAppsHook; 60 61 + buildInputs = [ 62 + SDL2 63 + ffmpeg 64 + (glew.override { enableEGL = forceWayland; }) 65 + libzip 66 + snappy 67 + zlib 68 + ] ++ lib.optionals enableQt [ 69 + qtbase 70 + qtmultimedia 71 + ] ++ lib.optional enableVulkan vulkan-loader 72 + ++ lib.optionals vulkanWayland [ wayland libffi ]; 73 74 + cmakeFlags = [ 75 + "-DHEADLESS=${if enableQt then "OFF" else "ON"}" 76 + "-DOpenGL_GL_PREFERENCE=GLVND" 77 + "-DUSE_SYSTEM_FFMPEG=ON" 78 + "-DUSE_SYSTEM_LIBZIP=ON" 79 + "-DUSE_SYSTEM_SNAPPY=ON" 80 + "-DUSE_WAYLAND_WSI=${if vulkanWayland then "ON" else "OFF"}" 81 + "-DUSING_QT_UI=${if enableQt then "ON" else "OFF"}" 82 + ]; 83 84 + desktopItems = [ 85 + (makeDesktopItem { 86 desktopName = "PPSSPP"; 87 name = "ppsspp"; 88 exec = "ppsspp"; 89 icon = "ppsspp"; 90 comment = "Play PSP games on your computer"; 91 categories = [ "Game" "Emulator" ]; 92 + }) 93 + ]; 94 95 + installPhase = let 96 + vulkanPath = lib.makeLibraryPath [ vulkan-loader ]; 97 + in 98 + '' 99 runHook preInstall 100 + 101 mkdir -p $out/share/{applications,ppsspp} 102 '' + (if enableQt then '' 103 install -Dm555 PPSSPPQt $out/bin/ppsspp ··· 111 --prefix LD_LIBRARY_PATH : ${vulkanPath} \ 112 '' + "\n" + '' 113 mv assets $out/share/ppsspp 114 + 115 runHook postInstall 116 ''; 117 118 + meta = with lib; { 119 + homepage = "https://www.ppsspp.org/"; 120 + description = "A HLE Playstation Portable emulator, written in C++ (" 121 + ++ (if enableQt then "Qt" else "SDL + headless") ++ ")"; 122 + license = lib.licenses.gpl2Plus; 123 + maintainers = [ lib.maintainers.AndersonTorres ]; 124 + platforms = lib.platforms.linux; 125 + }; 126 + })
+1
pkgs/top-level/all-packages.nix
··· 2182 2183 ppsspp-qt = ppsspp.override { 2184 inherit (libsForQt5) qtbase qtmultimedia wrapQtAppsHook; 2185 enableVulkan = false; # https://github.com/hrydgard/ppsspp/issues/11628 2186 }; 2187
··· 2182 2183 ppsspp-qt = ppsspp.override { 2184 inherit (libsForQt5) qtbase qtmultimedia wrapQtAppsHook; 2185 + enableQt = true; 2186 enableVulkan = false; # https://github.com/hrydgard/ppsspp/issues/11628 2187 }; 2188