diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-01-30 07:01:48 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-01-30 22:22:28 -0300 |
commit | 7c4e72f205729ded6ad2a8a7242685b5e92dbb89 (patch) | |
tree | dab8e46a6c315f1a0039a86eeaee4c5ce5dffbeb /pkgs/applications/emulators/ppsspp | |
parent | 0125b49eeb938a98a59b72e5a2d40999858a6727 (diff) |
ppsspp: refactor
Diffstat (limited to 'pkgs/applications/emulators/ppsspp')
-rw-r--r-- | pkgs/applications/emulators/ppsspp/default.nix | 135 |
1 files changed, 70 insertions, 65 deletions
diff --git a/pkgs/applications/emulators/ppsspp/default.nix b/pkgs/applications/emulators/ppsspp/default.nix index b300dc08268a..e730131ed6ff 100644 --- a/pkgs/applications/emulators/ppsspp/default.nix +++ b/pkgs/applications/emulators/ppsspp/default.nix @@ -12,89 +12,92 @@ , makeWrapper , pkg-config , python3 -, qtbase ? null -, qtmultimedia ? null +, qtbase +, qtmultimedia , snappy , vulkan-loader , wayland -, wrapQtAppsHook ? null +, wrapQtAppsHook , zlib +, enableQt ? false , enableVulkan ? true , forceWayland ? false }: let - enableQt = (qtbase != null); - frontend = if enableQt then "Qt" else "SDL and headless"; - vulkanPath = lib.makeLibraryPath [ vulkan-loader ]; - # experimental, see https://github.com/hrydgard/ppsspp/issues/13845 vulkanWayland = enableVulkan && forceWayland; in - # Only SDL front end needs to specify whether to use Wayland - assert forceWayland -> !enableQt; - stdenv.mkDerivation (finalAttrs: { - pname = "ppsspp" - + lib.optionalString enableQt "-qt" - + lib.optionalString (!enableQt) "-sdl" - + lib.optionalString forceWayland "-wayland"; - version = "1.14.4"; +# Only SDL frontend needs to specify whether to use Wayland +assert forceWayland -> !enableQt; +stdenv.mkDerivation (self: { + pname = "ppsspp" + + lib.optionalString enableQt "-qt" + + lib.optionalString (!enableQt) "-sdl" + + lib.optionalString forceWayland "-wayland"; + version = "1.14.4"; - src = fetchFromGitHub { - owner = "hrydgard"; - repo = "ppsspp"; - rev = "v${finalAttrs.version}"; - fetchSubmodules = true; - sha256 = "sha256-7xzhN8JIQD4LZg8sQ8rLNYZrW0nCNBfZFgzoKdoWbKc="; - }; + src = fetchFromGitHub { + owner = "hrydgard"; + repo = "ppsspp"; + rev = "v${self.version}"; + fetchSubmodules = true; + sha256 = "sha256-7xzhN8JIQD4LZg8sQ8rLNYZrW0nCNBfZFgzoKdoWbKc="; + }; - postPatch = '' - substituteInPlace git-version.cmake --replace unknown ${finalAttrs.src.rev} - substituteInPlace UI/NativeApp.cpp --replace /usr/share $out/share - ''; + postPatch = '' + substituteInPlace git-version.cmake --replace unknown ${self.src.rev} + substituteInPlace UI/NativeApp.cpp --replace /usr/share $out/share + ''; - nativeBuildInputs = [ - cmake - copyDesktopItems - makeWrapper - pkg-config - python3 - wrapQtAppsHook - ]; + nativeBuildInputs = [ + cmake + copyDesktopItems + makeWrapper + pkg-config + python3 + ] ++ lib.optional enableQt wrapQtAppsHook; - buildInputs = [ - SDL2 - ffmpeg - (glew.override { enableEGL = forceWayland; }) - libzip - qtbase - qtmultimedia - snappy - zlib - ] ++ lib.optional enableVulkan vulkan-loader - ++ lib.optionals vulkanWayland [ wayland libffi ]; + buildInputs = [ + SDL2 + ffmpeg + (glew.override { enableEGL = forceWayland; }) + libzip + snappy + zlib + ] ++ lib.optionals enableQt [ + qtbase + qtmultimedia + ] ++ lib.optional enableVulkan vulkan-loader + ++ lib.optionals vulkanWayland [ wayland libffi ]; - cmakeFlags = [ - "-DHEADLESS=${if enableQt then "OFF" else "ON"}" - "-DOpenGL_GL_PREFERENCE=GLVND" - "-DUSE_SYSTEM_FFMPEG=ON" - "-DUSE_SYSTEM_LIBZIP=ON" - "-DUSE_SYSTEM_SNAPPY=ON" - "-DUSE_WAYLAND_WSI=${if vulkanWayland then "ON" else "OFF"}" - "-DUSING_QT_UI=${if enableQt then "ON" else "OFF"}" - ]; + cmakeFlags = [ + "-DHEADLESS=${if enableQt then "OFF" else "ON"}" + "-DOpenGL_GL_PREFERENCE=GLVND" + "-DUSE_SYSTEM_FFMPEG=ON" + "-DUSE_SYSTEM_LIBZIP=ON" + "-DUSE_SYSTEM_SNAPPY=ON" + "-DUSE_WAYLAND_WSI=${if vulkanWayland then "ON" else "OFF"}" + "-DUSING_QT_UI=${if enableQt then "ON" else "OFF"}" + ]; - desktopItems = [(makeDesktopItem { + desktopItems = [ + (makeDesktopItem { desktopName = "PPSSPP"; name = "ppsspp"; exec = "ppsspp"; icon = "ppsspp"; comment = "Play PSP games on your computer"; categories = [ "Game" "Emulator" ]; - })]; + }) + ]; - installPhase = '' + installPhase = let + vulkanPath = lib.makeLibraryPath [ vulkan-loader ]; + in + '' runHook preInstall + mkdir -p $out/share/{applications,ppsspp} '' + (if enableQt then '' install -Dm555 PPSSPPQt $out/bin/ppsspp @@ -108,14 +111,16 @@ in --prefix LD_LIBRARY_PATH : ${vulkanPath} \ '' + "\n" + '' mv assets $out/share/ppsspp + runHook postInstall ''; - meta = with lib; { - homepage = "https://www.ppsspp.org/"; - description = "A HLE Playstation Portable emulator, written in C++ (${frontend})"; - license = licenses.gpl2Plus; - maintainers = with maintainers; [ AndersonTorres ]; - platforms = platforms.linux; - }; - }) + meta = with lib; { + homepage = "https://www.ppsspp.org/"; + description = "A HLE Playstation Portable emulator, written in C++ (" + ++ (if enableQt then "Qt" else "SDL + headless") ++ ")"; + license = lib.licenses.gpl2Plus; + maintainers = [ lib.maintainers.AndersonTorres ]; + platforms = lib.platforms.linux; + }; +}) |