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 12 , makeWrapper 13 13 , pkg-config 14 14 , python3 15 - , qtbase ? null 16 - , qtmultimedia ? null 15 + , qtbase 16 + , qtmultimedia 17 17 , snappy 18 18 , vulkan-loader 19 19 , wayland 20 - , wrapQtAppsHook ? null 20 + , wrapQtAppsHook 21 21 , zlib 22 + , enableQt ? false 22 23 , enableVulkan ? true 23 24 , forceWayland ? false 24 25 }: 25 26 26 27 let 27 - enableQt = (qtbase != null); 28 - frontend = if enableQt then "Qt" else "SDL and headless"; 29 - vulkanPath = lib.makeLibraryPath [ vulkan-loader ]; 30 - 31 28 # experimental, see https://github.com/hrydgard/ppsspp/issues/13845 32 29 vulkanWayland = enableVulkan && forceWayland; 33 30 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"; 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"; 42 39 43 - src = fetchFromGitHub { 44 - owner = "hrydgard"; 45 - repo = "ppsspp"; 46 - rev = "v${finalAttrs.version}"; 47 - fetchSubmodules = true; 48 - sha256 = "sha256-7xzhN8JIQD4LZg8sQ8rLNYZrW0nCNBfZFgzoKdoWbKc="; 49 - }; 40 + src = fetchFromGitHub { 41 + owner = "hrydgard"; 42 + repo = "ppsspp"; 43 + rev = "v${self.version}"; 44 + fetchSubmodules = true; 45 + sha256 = "sha256-7xzhN8JIQD4LZg8sQ8rLNYZrW0nCNBfZFgzoKdoWbKc="; 46 + }; 50 47 51 - postPatch = '' 52 - substituteInPlace git-version.cmake --replace unknown ${finalAttrs.src.rev} 53 - substituteInPlace UI/NativeApp.cpp --replace /usr/share $out/share 54 - ''; 48 + postPatch = '' 49 + substituteInPlace git-version.cmake --replace unknown ${self.src.rev} 50 + substituteInPlace UI/NativeApp.cpp --replace /usr/share $out/share 51 + ''; 55 52 56 - nativeBuildInputs = [ 57 - cmake 58 - copyDesktopItems 59 - makeWrapper 60 - pkg-config 61 - python3 62 - wrapQtAppsHook 63 - ]; 53 + nativeBuildInputs = [ 54 + cmake 55 + copyDesktopItems 56 + makeWrapper 57 + pkg-config 58 + python3 59 + ] ++ lib.optional enableQt wrapQtAppsHook; 64 60 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 ]; 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 ]; 76 73 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 - ]; 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 + ]; 86 83 87 - desktopItems = [(makeDesktopItem { 84 + desktopItems = [ 85 + (makeDesktopItem { 88 86 desktopName = "PPSSPP"; 89 87 name = "ppsspp"; 90 88 exec = "ppsspp"; 91 89 icon = "ppsspp"; 92 90 comment = "Play PSP games on your computer"; 93 91 categories = [ "Game" "Emulator" ]; 94 - })]; 92 + }) 93 + ]; 95 94 96 - installPhase = '' 95 + installPhase = let 96 + vulkanPath = lib.makeLibraryPath [ vulkan-loader ]; 97 + in 98 + '' 97 99 runHook preInstall 100 + 98 101 mkdir -p $out/share/{applications,ppsspp} 99 102 '' + (if enableQt then '' 100 103 install -Dm555 PPSSPPQt $out/bin/ppsspp ··· 108 111 --prefix LD_LIBRARY_PATH : ${vulkanPath} \ 109 112 '' + "\n" + '' 110 113 mv assets $out/share/ppsspp 114 + 111 115 runHook postInstall 112 116 ''; 113 117 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 - }) 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 2182 2183 2183 ppsspp-qt = ppsspp.override { 2184 2184 inherit (libsForQt5) qtbase qtmultimedia wrapQtAppsHook; 2185 + enableQt = true; 2185 2186 enableVulkan = false; # https://github.com/hrydgard/ppsspp/issues/11628 2186 2187 }; 2187 2188