1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-01-22 14:45:27 +00:00
nixpkgs/pkgs/by-name/pp/ppsspp/package.nix

127 lines
3.2 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 15:33:00 +01: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 21:03:06 +01: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";
2023-10-13 04:52:18 +01:00
version = "1.16.6";
2014-05-27 04:22:24 +01:00
2023-01-30 10:01:48 +00:00
src = fetchFromGitHub {
owner = "hrydgard";
repo = "ppsspp";
2023-04-16 21:03:06 +01:00
rev = "v${finalAttrs.version}";
2023-01-30 10:01:48 +00:00
fetchSubmodules = true;
2023-10-13 04:52:18 +01:00
hash = "sha256-FCdYvYKcV+0TpQUSWiooNlTXKYtqbfnAWwjk7M8iF1Q=";
2023-01-30 10:01:48 +00:00
};
2014-05-27 04:22:24 +01:00
2023-01-30 10:01:48 +00:00
postPatch = ''
2023-04-16 21:03:06 +01: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.optional 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.optional enableVulkan vulkan-loader
++ lib.optionals vulkanWayland [ wayland libffi ];
2023-01-30 10:01:48 +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"}"
];
2014-05-27 04:22:24 +01: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} \
'' + "\n" + ''
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") + ")";
2023-01-30 10:01:48 +00:00
license = lib.licenses.gpl2Plus;
maintainers = [ lib.maintainers.AndersonTorres ];
platforms = lib.platforms.linux;
};
})