2022-08-21 13:32:41 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
2021-05-03 20:48:10 +00:00
|
|
|
, SDL2
|
|
|
|
, cmake
|
2022-08-21 13:32:41 +00:00
|
|
|
, copyDesktopItems
|
2021-05-03 20:48:10 +00:00
|
|
|
, ffmpeg
|
2020-04-24 23:36:52 +00:00
|
|
|
, glew
|
2022-08-21 13:32:41 +00:00
|
|
|
, libffi
|
2023-02-16 17:41:37 +00:00
|
|
|
, libsForQt5
|
2020-04-24 23:36:52 +00:00
|
|
|
, libzip
|
2022-08-21 13:32:41 +00:00
|
|
|
, makeDesktopItem
|
|
|
|
, makeWrapper
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, python3
|
|
|
|
, snappy
|
2022-08-21 13:32:41 +00:00
|
|
|
, vulkan-loader
|
|
|
|
, wayland
|
2020-04-24 23:36:52 +00:00
|
|
|
, zlib
|
2023-02-02 18:25:31 +00:00
|
|
|
, enableQt ? false
|
2022-08-21 13:32:41 +00:00
|
|
|
, enableVulkan ? true
|
|
|
|
, forceWayland ? false
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
let
|
|
|
|
# experimental, see https://github.com/hrydgard/ppsspp/issues/13845
|
|
|
|
vulkanWayland = enableVulkan && forceWayland;
|
2023-02-16 17:41:37 +00:00
|
|
|
inherit (libsForQt5) qtbase qtmultimedia wrapQtAppsHook;
|
2022-08-21 13:32:41 +00:00
|
|
|
in
|
2023-02-02 18:25:31 +00:00
|
|
|
# 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";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hrydgard";
|
|
|
|
repo = "ppsspp";
|
|
|
|
rev = "v${self.version}";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
sha256 = "sha256-7xzhN8JIQD4LZg8sQ8rLNYZrW0nCNBfZFgzoKdoWbKc=";
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace git-version.cmake --replace unknown ${self.src.rev}
|
|
|
|
substituteInPlace UI/NativeApp.cpp --replace /usr/share $out/share
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
copyDesktopItems
|
|
|
|
makeWrapper
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
] ++ lib.optional enableQt wrapQtAppsHook;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
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 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
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"}"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
2022-08-21 13:32:41 +00:00
|
|
|
desktopName = "PPSSPP";
|
|
|
|
name = "ppsspp";
|
|
|
|
exec = "ppsspp";
|
|
|
|
icon = "ppsspp";
|
|
|
|
comment = "Play PSP games on your computer";
|
|
|
|
categories = [ "Game" "Emulator" ];
|
2023-02-02 18:25:31 +00:00
|
|
|
})
|
|
|
|
];
|
2022-08-21 13:32:41 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
installPhase = let
|
|
|
|
vulkanPath = lib.makeLibraryPath [ vulkan-loader ];
|
|
|
|
in
|
|
|
|
''
|
2022-08-21 13:32:41 +00:00
|
|
|
runHook preInstall
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
mkdir -p $out/share/{applications,ppsspp}
|
|
|
|
'' + (if enableQt then ''
|
|
|
|
install -Dm555 PPSSPPQt $out/bin/ppsspp
|
|
|
|
wrapProgram $out/bin/ppsspp \
|
|
|
|
'' else ''
|
|
|
|
install -Dm555 PPSSPPHeadless $out/bin/ppsspp-headless
|
|
|
|
install -Dm555 PPSSPPSDL $out/share/ppsspp/
|
|
|
|
makeWrapper $out/share/ppsspp/PPSSPPSDL $out/bin/ppsspp \
|
|
|
|
--set SDL_VIDEODRIVER ${if forceWayland then "wayland" else "x11"} \
|
|
|
|
'') + lib.optionalString enableVulkan ''
|
|
|
|
--prefix LD_LIBRARY_PATH : ${vulkanPath} \
|
|
|
|
'' + "\n" + ''
|
|
|
|
mv assets $out/share/ppsspp
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta = {
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
})
|