nixpkgs/pkgs/by-name/pp/ppsspp/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

160 lines
4.2 KiB
Nix
Raw Normal View History

{
lib,
SDL2,
cmake,
copyDesktopItems,
fetchFromGitHub,
ffmpeg,
glew,
libffi,
libsForQt5,
libzip,
makeDesktopItem,
makeWrapper,
pkg-config,
python3,
snappy,
stdenv,
vulkan-loader,
wayland,
zlib,
enableQt ? false,
enableVulkan ? true,
forceWayland ? false,
useSystemFfmpeg? false,
useSystemSnappy? true,
2019-12-19 11:24:02 +00:00
}:
2017-09-27 14:33:00 +00:00
let
# experimental, see https://github.com/hrydgard/ppsspp/issues/13845
vulkanWayland = enableVulkan && forceWayland;
inherit (libsForQt5) qtbase qtmultimedia wrapQtAppsHook;
in
2023-01-30 10:01:48 +00:00
# Only SDL frontend needs to specify whether to use Wayland
assert forceWayland -> !enableQt;
2023-04-16 20:03:06 +00:00
stdenv.mkDerivation (finalAttrs: {
2023-01-30 10:01:48 +00:00
pname = "ppsspp"
+ lib.optionalString enableQt "-qt"
+ lib.optionalString (!enableQt) "-sdl"
+ lib.optionalString forceWayland "-wayland";
2024-02-05 07:12:45 +00:00
version = "1.17.1";
2014-05-27 03:22:24 +00:00
2023-01-30 10:01:48 +00:00
src = fetchFromGitHub {
owner = "hrydgard";
repo = "ppsspp";
2023-04-16 20:03:06 +00:00
rev = "v${finalAttrs.version}";
2023-01-30 10:01:48 +00:00
fetchSubmodules = true;
2024-02-05 07:12:45 +00:00
hash = "sha256-I84zJqEE1X/eo/ukeGA2iZe3lWKvilk+RNGUzl2wZXY=";
2023-01-30 10:01:48 +00:00
};
2014-05-27 03:22:24 +00:00
2023-01-30 10:01:48 +00:00
postPatch = ''
2023-04-16 20:03:06 +00:00
substituteInPlace git-version.cmake --replace unknown ${finalAttrs.src.rev}
2023-01-30 10:01:48 +00:00
substituteInPlace UI/NativeApp.cpp --replace /usr/share $out/share
'';
2019-12-19 11:24:02 +00:00
2023-01-30 10:01:48 +00:00
nativeBuildInputs = [
cmake
copyDesktopItems
makeWrapper
pkg-config
python3
]
++ lib.optionals enableQt [ wrapQtAppsHook ];
2016-12-17 04:58:57 +00:00
2023-01-30 10:01:48 +00:00
buildInputs = [
SDL2
glew
2023-01-30 10:01:48 +00:00
libzip
zlib
]
++ lib.optionals useSystemFfmpeg [
ffmpeg
]
++ lib.optionals useSystemSnappy [
snappy
]
++ lib.optionals enableQt [
2023-01-30 10:01:48 +00:00
qtbase
qtmultimedia
]
++ lib.optionals enableVulkan [ vulkan-loader ]
2023-01-30 10:01:48 +00:00
++ lib.optionals vulkanWayland [ wayland libffi ];
2023-01-30 10:01:48 +00:00
cmakeFlags = [
(lib.cmakeBool "HEADLESS" (!enableQt))
(lib.cmakeBool "USE_SYSTEM_FFMPEG" useSystemFfmpeg)
(lib.cmakeBool "USE_SYSTEM_LIBZIP" true)
(lib.cmakeBool "USE_SYSTEM_SNAPPY" useSystemSnappy)
(lib.cmakeBool "USE_WAYLAND_WSI" vulkanWayland)
(lib.cmakeBool "USING_QT_UI" enableQt)
(lib.cmakeFeature "OpenGL_GL_PREFERENCE" "GLVND")
2023-01-30 10:01:48 +00:00
];
2014-05-27 03:22:24 +00:00
2023-01-30 10:01:48 +00:00
desktopItems = [
(makeDesktopItem {
desktopName = "PPSSPP";
name = "ppsspp";
exec = "ppsspp";
icon = "ppsspp";
comment = "Play PSP games on your computer";
categories = [ "Game" "Emulator" ];
2023-01-30 10:01:48 +00:00
})
];
installPhase =
lib.concatStringsSep "\n" ([
''runHook preInstall''
]
++ [
''mkdir -p $out/share/{applications,ppsspp/bin,icons}''
]
++ (if enableQt then [
''install -Dm555 PPSSPPQt $out/share/ppsspp/bin/''
] else [
''install -Dm555 PPSSPPHeadless $out/share/ppsspp/bin/''
''makeWrapper $out/share/ppsspp/bin/PPSSPPHeadless $out/bin/ppsspp-headless''
''install -Dm555 PPSSPPSDL $out/share/ppsspp/bin/''
])
++ [
''mv assets $out/share/ppsspp''
''mv ../icons/hicolor $out/share/icons''
]
++ [
''runHook postInstall''
]);
2023-01-30 10:01:48 +00:00
postFixup =
let
wrapperArgs =
lib.concatStringsSep " "
(lib.optionals enableVulkan [
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ vulkan-loader ]}"
] ++ lib.optionals (!enableQt) [
"--set SDL_VIDEODRIVER ${if forceWayland then "wayland" else "x11"}"
]);
binToBeWrapped = if enableQt then "PPSSPPQt" else "PPSSPPSDL";
in
''makeWrapper $out/share/ppsspp/bin/${binToBeWrapped} $out/bin/ppsspp ${wrapperArgs}'';
2023-02-01 07:10:12 +00:00
meta = {
2023-01-30 10:01:48 +00:00
homepage = "https://www.ppsspp.org/";
description = "HLE Playstation Portable emulator, written in C++ ("
2023-02-01 07:10:12 +00:00
+ (if enableQt then "Qt" else "SDL + headless") + ")";
longDescription = ''
PPSSPP is a PSP emulator, which means that it can run games and other
software that was originally made for the Sony PSP.
The PSP had multiple types of software. The two most common are native PSP
games on UMD discs and downloadable games (that were stored in the
directory PSP/GAME on the "memory stick"). But there were also UMD Video
discs, and PS1 games that could run in a proprietary emulator. PPSSPP does
not run those.
'';
2023-01-30 10:01:48 +00:00
license = lib.licenses.gpl2Plus;
maintainers = [ lib.maintainers.AndersonTorres ];
mainProgram = "ppsspp";
2023-01-30 10:01:48 +00:00
platforms = lib.platforms.linux;
};
})