mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
Merge pull request #325562 from atorres1985-contrib/pcsx2
pcsx2: rework
This commit is contained in:
commit
7b3c572cf6
7 changed files with 241 additions and 220 deletions
47
pkgs/by-name/pc/pcsx2-bin/package.nix
Normal file
47
pkgs/by-name/pc/pcsx2-bin/package.nix
Normal file
|
@ -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 ];
|
||||||
|
};
|
||||||
|
})
|
|
@ -1,32 +0,0 @@
|
||||||
{
|
|
||||||
stdenvNoCC,
|
|
||||||
fetchurl,
|
|
||||||
pname,
|
|
||||||
version,
|
|
||||||
meta,
|
|
||||||
makeWrapper,
|
|
||||||
}:
|
|
||||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
||||||
inherit pname version meta;
|
|
||||||
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://github.com/PCSX2/pcsx2/releases/download/v${version}/pcsx2-v${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
|
|
||||||
'';
|
|
||||||
})
|
|
|
@ -1,130 +0,0 @@
|
||||||
{
|
|
||||||
cmake,
|
|
||||||
fetchFromGitHub,
|
|
||||||
lib,
|
|
||||||
llvmPackages_17,
|
|
||||||
callPackage,
|
|
||||||
cubeb,
|
|
||||||
curl,
|
|
||||||
extra-cmake-modules,
|
|
||||||
ffmpeg,
|
|
||||||
libaio,
|
|
||||||
libbacktrace,
|
|
||||||
libpcap,
|
|
||||||
libwebp,
|
|
||||||
libXrandr,
|
|
||||||
lz4,
|
|
||||||
makeWrapper,
|
|
||||||
pkg-config,
|
|
||||||
qt6,
|
|
||||||
SDL2,
|
|
||||||
soundtouch,
|
|
||||||
strip-nondeterminism,
|
|
||||||
vulkan-headers,
|
|
||||||
vulkan-loader,
|
|
||||||
wayland,
|
|
||||||
zip,
|
|
||||||
zstd,
|
|
||||||
|
|
||||||
pname,
|
|
||||||
version,
|
|
||||||
meta,
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
shaderc-patched = callPackage ./shaderc-patched.nix { };
|
|
||||||
# The pre-zipped files in releases don't have a versioned link, we need to zip them ourselves
|
|
||||||
pcsx2_patches = fetchFromGitHub {
|
|
||||||
owner = "PCSX2";
|
|
||||||
repo = "pcsx2_patches";
|
|
||||||
rev = "9e71956797332471010e563a4b75a5934bef9d4e";
|
|
||||||
hash = "sha256-jpaRpvJox78zRGyrVIGYVoSEo/ICBlBfw3dTMz9QGuU=";
|
|
||||||
};
|
|
||||||
inherit (qt6)
|
|
||||||
qtbase
|
|
||||||
qtsvg
|
|
||||||
qttools
|
|
||||||
qtwayland
|
|
||||||
wrapQtAppsHook
|
|
||||||
;
|
|
||||||
in
|
|
||||||
llvmPackages_17.stdenv.mkDerivation (finalAttrs: {
|
|
||||||
inherit pname version meta;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "PCSX2";
|
|
||||||
repo = "pcsx2";
|
|
||||||
rev = "v${finalAttrs.version}";
|
|
||||||
# NOTE: Don't forget to change the hash in shaderc-patched.nix as well.
|
|
||||||
hash = "sha256-cDugEbbz40uLPW64bcDGxfo1Y3ahYnEVaalfMp/J95s=";
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = [ ./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
|
|
||||||
extra-cmake-modules
|
|
||||||
pkg-config
|
|
||||||
strip-nondeterminism
|
|
||||||
wrapQtAppsHook
|
|
||||||
zip
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
curl
|
|
||||||
ffmpeg
|
|
||||||
libaio
|
|
||||||
libbacktrace
|
|
||||||
libpcap
|
|
||||||
libwebp
|
|
||||||
libXrandr
|
|
||||||
lz4
|
|
||||||
qtbase
|
|
||||||
qtsvg
|
|
||||||
qttools
|
|
||||||
qtwayland
|
|
||||||
SDL2
|
|
||||||
shaderc-patched
|
|
||||||
soundtouch
|
|
||||||
vulkan-headers
|
|
||||||
wayland
|
|
||||||
zstd
|
|
||||||
] ++ cubeb.passthru.backendLibs;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
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 ${pcsx2_patches}/patches/*
|
|
||||||
strip-nondeterminism $out/bin/resources/patches.zip
|
|
||||||
'';
|
|
||||||
|
|
||||||
qtWrapperArgs =
|
|
||||||
let
|
|
||||||
libs = lib.makeLibraryPath (
|
|
||||||
[
|
|
||||||
vulkan-loader
|
|
||||||
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'
|
|
||||||
'';
|
|
||||||
})
|
|
|
@ -1,39 +1,146 @@
|
||||||
{
|
{
|
||||||
stdenv,
|
|
||||||
lib,
|
lib,
|
||||||
|
SDL2,
|
||||||
callPackage,
|
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
|
let
|
||||||
pname = "pcsx2";
|
sources = callPackage ./sources.nix { };
|
||||||
version = "1.7.5919";
|
inherit (qt6)
|
||||||
meta = with lib; {
|
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 = ''
|
||||||
|
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 = {
|
||||||
|
homepage = "https://pcsx2.net";
|
||||||
description = "Playstation 2 emulator";
|
description = "Playstation 2 emulator";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
PCSX2 is an open-source PlayStation 2 (AKA PS2) emulator. Its purpose
|
PCSX2 is an open-source PlayStation 2 (AKA PS2) emulator. Its purpose is
|
||||||
is to emulate the PS2 hardware, using a combination of MIPS CPU
|
to emulate the PS2 hardware, using a combination of MIPS CPU Interpreters,
|
||||||
Interpreters, Recompilers and a Virtual Machine which manages hardware
|
Recompilers and a Virtual Machine which manages hardware states and PS2
|
||||||
states and PS2 system memory. This allows you to play PS2 games on your
|
system memory. This allows you to play PS2 games on your PC, with many
|
||||||
PC, with many additional features and benefits.
|
additional features and benefits.
|
||||||
'';
|
'';
|
||||||
hydraPlatforms = platforms.linux;
|
changelog = "https://github.com/PCSX2/pcsx2/releases/tag/v${finalAttrs.version}";
|
||||||
homepage = "https://pcsx2.net";
|
downloadPage = "https://github.com/PCSX2/pcsx2";
|
||||||
license = with licenses; [
|
license = with lib.licenses; [
|
||||||
gpl3Plus
|
gpl3Plus
|
||||||
lgpl3Plus
|
lgpl3Plus
|
||||||
];
|
];
|
||||||
maintainers = with maintainers; [
|
mainProgram = "pcsx2-qt";
|
||||||
|
maintainers = with lib.maintainers; [
|
||||||
|
AndersonTorres
|
||||||
hrdinka
|
hrdinka
|
||||||
govanify
|
govanify
|
||||||
matteopacini
|
matteopacini
|
||||||
];
|
];
|
||||||
mainProgram = "pcsx2-qt";
|
platforms = lib.systems.inspect.patternLogicalAnd
|
||||||
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
lib.systems.inspect.patterns.isLinux
|
||||||
sourceProvenance =
|
lib.systems.inspect.patterns.isx86_64;
|
||||||
lib.optional stdenv.isDarwin sourceTypes.binaryNativeCode
|
|
||||||
++ lib.optional stdenv.isLinux sourceTypes.fromSource;
|
|
||||||
};
|
};
|
||||||
in
|
})
|
||||||
if stdenv.isDarwin then
|
|
||||||
callPackage ./darwin.nix { inherit pname version meta; }
|
|
||||||
else
|
|
||||||
callPackage ./linux.nix { inherit pname version meta; }
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
fetchFromGitHub,
|
|
||||||
fetchpatch,
|
|
||||||
pcsx2,
|
|
||||||
shaderc,
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
version = "2024.1";
|
|
||||||
in
|
|
||||||
shaderc.overrideAttrs (old: {
|
|
||||||
inherit version;
|
|
||||||
pname = "shaderc-patched-for-pcsx2";
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "google";
|
|
||||||
repo = "shaderc";
|
|
||||||
rev = "v${version}";
|
|
||||||
hash = "sha256-2L/8n6KLVZWXt6FrYraVlZV5YqbPHD7rzXPCkD0d4kg=";
|
|
||||||
};
|
|
||||||
patches = (old.patches or [ ]) ++ [
|
|
||||||
(fetchpatch {
|
|
||||||
url = "file://${pcsx2.src}/.github/workflows/scripts/common/shaderc-changes.patch";
|
|
||||||
hash = "sha256-/qX2yD0RBuPh4Cf7n6OjVA2IyurpaCgvCEsIX/hXFdQ=";
|
|
||||||
excludes = [
|
|
||||||
"libshaderc/CMakeLists.txt"
|
|
||||||
"third_party/CMakeLists.txt"
|
|
||||||
];
|
|
||||||
})
|
|
||||||
];
|
|
||||||
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
|
|
||||||
(lib.cmakeBool "SHADERC_SKIP_EXAMPLES" true)
|
|
||||||
(lib.cmakeBool "SHADERC_SKIP_TESTS" true)
|
|
||||||
];
|
|
||||||
})
|
|
64
pkgs/by-name/pc/pcsx2/sources.nix
Normal file
64
pkgs/by-name/pc/pcsx2/sources.nix
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
fetchFromGitHub,
|
||||||
|
fetchpatch,
|
||||||
|
pcsx2,
|
||||||
|
shaderc,
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
pcsx2 = let
|
||||||
|
self = {
|
||||||
|
pname = "pcsx2";
|
||||||
|
version = "1.7.5919";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "PCSX2";
|
||||||
|
repo = "pcsx2";
|
||||||
|
rev = "v${self.version}";
|
||||||
|
hash = "sha256-cDugEbbz40uLPW64bcDGxfo1Y3ahYnEVaalfMp/J95s=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
self;
|
||||||
|
|
||||||
|
# The pre-zipped files in releases don't have a versioned link, we need to zip
|
||||||
|
# them ourselves
|
||||||
|
pcsx2_patches = {
|
||||||
|
pname = "pcsx2_patches";
|
||||||
|
version = "0-unstable-2024-06-23";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "PCSX2";
|
||||||
|
repo = "pcsx2_patches";
|
||||||
|
rev = "9e71956797332471010e563a4b75a5934bef9d4e";
|
||||||
|
hash = "sha256-jpaRpvJox78zRGyrVIGYVoSEo/ICBlBfw3dTMz9QGuU=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
shaderc-patched = let
|
||||||
|
pname = "shaderc-patched-for-pcsx2";
|
||||||
|
version = "2024.1";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "google";
|
||||||
|
repo = "shaderc";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-2L/8n6KLVZWXt6FrYraVlZV5YqbPHD7rzXPCkD0d4kg=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
shaderc.overrideAttrs (old: {
|
||||||
|
inherit pname version src;
|
||||||
|
patches = (old.patches or [ ]) ++ [
|
||||||
|
(fetchpatch {
|
||||||
|
url = "file://${pcsx2.src}/.github/workflows/scripts/common/shaderc-changes.patch";
|
||||||
|
hash = "sha256-/qX2yD0RBuPh4Cf7n6OjVA2IyurpaCgvCEsIX/hXFdQ=";
|
||||||
|
excludes = [
|
||||||
|
"libshaderc/CMakeLists.txt"
|
||||||
|
"third_party/CMakeLists.txt"
|
||||||
|
];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
cmakeFlags = (old.cmakeFlags or [ ]) ++ [
|
||||||
|
(lib.cmakeBool "SHADERC_SKIP_EXAMPLES" true)
|
||||||
|
(lib.cmakeBool "SHADERC_SKIP_TESTS" true)
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue