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.

142 lines
3.8 KiB
Nix
Raw Normal View History

{ lib
, stdenv
2019-12-19 11:24:02 +00:00
, fetchFromGitHub
, SDL2
, cmake
, copyDesktopItems
, ffmpeg_4
2019-12-19 11:24:02 +00:00
, glew
, libffi
, libsForQt5
2019-12-19 11:24:02 +00:00
, libzip
, makeDesktopItem
, makeWrapper
2021-01-17 02:30:45 +00:00
, pkg-config
2019-12-19 11:24:02 +00:00
, python3
, snappy
, vulkan-loader
, wayland
2019-12-19 11:24:02 +00:00
, zlib
2023-01-30 10:01:48 +00:00
, enableQt ? false
, enableVulkan ? true
, forceWayland ? false
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
ffmpeg_4
2023-01-30 10:01:48 +00:00
(glew.override { enableEGL = forceWayland; })
libzip
snappy
zlib
] ++ lib.optionals enableQt [
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" true)
(lib.cmakeBool "USE_SYSTEM_LIBZIP" true)
(lib.cmakeBool "USE_SYSTEM_SNAPPY" true)
(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
})
];
2023-01-30 10:01:48 +00:00
installPhase = let
vulkanPath = lib.makeLibraryPath [ vulkan-loader ];
in
''
runHook preInstall
2023-01-30 10:01:48 +00:00
mkdir -p $out/share/{applications,ppsspp,icons}
''
+ (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} \
''
+ ''
mv assets $out/share/ppsspp
mv ../icons/hicolor $out/share/icons
2023-01-30 10:01:48 +00:00
runHook postInstall
'';
2023-02-01 07:10:12 +00:00
meta = {
2023-01-30 10:01:48 +00:00
homepage = "https://www.ppsspp.org/";
description = "A 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;
};
})