Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcsx2: rework #325562

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions pkgs/by-name/pc/pcsx2-bin/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
lib,
stdenvNoCC,
fetchurl,
makeWrapper,
# To grab metadata
pcsx2,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
pname = "pcsx2";
version = "1.7.5919";

src = fetchurl {
url = "https://github.com/PCSX2/pcsx2/releases/download/v${finalAttrs.version}/pcsx2-v${finalAttrs.version}-macos-Qt.tar.xz";
hash = "sha256-NYgHsYXoIhI2pxqqiMgz5sKBAezEFf4AfEfu5S3diMg=";
};

nativeBuildInputs = [ makeWrapper ];

dontPatch = true;
dontConfigure = true;
dontBuild = true;

sourceRoot = ".";

installPhase = ''
runHook preInstall
mkdir -p $out/{bin,Applications}
cp -r "PCSX2-v${finalAttrs.version}.app" $out/Applications/PCSX2.app
makeWrapper $out/Applications/PCSX2.app/Contents/MacOS/PCSX2 $out/bin/pcsx2-qt
runHook postInstall
'';

meta = {
inherit (pcsx2.meta) homepage longDescription license changelog downloadPage;
description = "Playstation 2 emulator; precompiled binary for MacOS, repacked from official website";
maintainers = with lib.maintainers; [
matteopacini
];
mainProgram = "pcsx2-qt";
platforms = lib.systems.inspect.patternLogicalAnd
lib.systems.inspect.patterns.isDarwin
lib.systems.inspect.patterns.isx86_64;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
})
32 changes: 0 additions & 32 deletions pkgs/by-name/pc/pcsx2/darwin.nix

This file was deleted.

130 changes: 0 additions & 130 deletions pkgs/by-name/pc/pcsx2/linux.nix

This file was deleted.

153 changes: 130 additions & 23 deletions pkgs/by-name/pc/pcsx2/package.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,146 @@
{
stdenv,
lib,
SDL2,
callPackage,
cmake,
cubeb,
curl,
extra-cmake-modules,
fetchFromGitHub,
ffmpeg,
libXrandr,
libaio,
libbacktrace,
libpcap,
libwebp,
llvmPackages_17,
lz4,
makeWrapper,
pkg-config,
qt6,
soundtouch,
strip-nondeterminism,
vulkan-headers,
vulkan-loader,
wayland,
zip,
zstd,
}:

let
pname = "pcsx2";
version = "1.7.5919";
meta = with lib; {
sources = callPackage ./sources.nix { };
inherit (qt6)
qtbase
qtsvg
qttools
qtwayland
wrapQtAppsHook
;
in
llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
inherit (sources.pcsx2) pname version src;

patches = [
# Remove PCSX2_GIT_REV
./0000-define-rev.patch
];

cmakeFlags = [
(lib.cmakeBool "DISABLE_ADVANCE_SIMD" true)
(lib.cmakeBool "USE_LINKED_FFMPEG" true)
(lib.cmakeFeature "PCSX2_GIT_REV" finalAttrs.src.rev)
];

nativeBuildInputs = [
cmake
pkg-config
strip-nondeterminism
wrapQtAppsHook
zip
];

buildInputs = [
curl
extra-cmake-modules
ffmpeg
libaio
libbacktrace
libpcap
libwebp
libXrandr
lz4
qtbase
qtsvg
qttools
qtwayland
SDL2
sources.shaderc-patched
soundtouch
vulkan-headers
wayland
zstd
] ++ cubeb.passthru.backendLibs;

strictDeps = true;

installPhase = ''
AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved
runHook preInstall
mkdir -p $out/bin
cp -a bin/pcsx2-qt bin/resources $out/bin/

install -Dm644 $src/pcsx2-qt/resources/icons/AppIcon64.png $out/share/pixmaps/PCSX2.png
install -Dm644 $src/.github/workflows/scripts/linux/pcsx2-qt.desktop $out/share/applications/PCSX2.desktop

zip -jq $out/bin/resources/patches.zip ${sources.pcsx2_patches.src}/patches/*
strip-nondeterminism $out/bin/resources/patches.zip
runHook postInstall
'';

qtWrapperArgs =
let
libs = lib.makeLibraryPath (
[
vulkan-loader
sources.shaderc-patched
]
++ cubeb.passthru.backendLibs
);
in
[ "--prefix LD_LIBRARY_PATH : ${libs}" ];

# https://github.com/PCSX2/pcsx2/pull/10200
# Can't avoid the double wrapping, the binary wrapper from qtWrapperArgs doesn't support --run
postFixup = ''
source "${makeWrapper}/nix-support/setup-hook"
wrapProgram $out/bin/pcsx2-qt \
--run 'if [[ -z $I_WANT_A_BROKEN_WAYLAND_UI ]]; then export QT_QPA_PLATFORM=xcb; fi'
'';

meta = {
AndersonTorres marked this conversation as resolved.
Show resolved Hide resolved
homepage = "https://pcsx2.net";
description = "Playstation 2 emulator";
longDescription = ''
PCSX2 is an open-source PlayStation 2 (AKA PS2) emulator. Its purpose
is to emulate the PS2 hardware, using a combination of MIPS CPU
Interpreters, Recompilers and a Virtual Machine which manages hardware
states and PS2 system memory. This allows you to play PS2 games on your
PC, with many additional features and benefits.
PCSX2 is an open-source PlayStation 2 (AKA PS2) emulator. Its purpose is
to emulate the PS2 hardware, using a combination of MIPS CPU Interpreters,
Recompilers and a Virtual Machine which manages hardware states and PS2
system memory. This allows you to play PS2 games on your PC, with many
additional features and benefits.
'';
hydraPlatforms = platforms.linux;
homepage = "https://pcsx2.net";
license = with licenses; [
changelog = "https://github.com/PCSX2/pcsx2/releases/tag/v${finalAttrs.version}";
downloadPage = "https://github.com/PCSX2/pcsx2";
license = with lib.licenses; [
gpl3Plus
lgpl3Plus
];
maintainers = with maintainers; [
mainProgram = "pcsx2-qt";
maintainers = with lib.maintainers; [
AndersonTorres
hrdinka
govanify
matteopacini
];
mainProgram = "pcsx2-qt";
platforms = [ "x86_64-linux" "x86_64-darwin" ];
sourceProvenance =
lib.optional stdenv.isDarwin sourceTypes.binaryNativeCode
++ lib.optional stdenv.isLinux sourceTypes.fromSource;
platforms = lib.systems.inspect.patternLogicalAnd
lib.systems.inspect.patterns.isLinux
lib.systems.inspect.patterns.isx86_64;
};
in
if stdenv.isDarwin then
callPackage ./darwin.nix { inherit pname version meta; }
else
callPackage ./linux.nix { inherit pname version meta; }
})
Loading