Merge pull request #165472 from IvarWithoutBones/bump/yuzu

This commit is contained in:
Sandro 2022-04-22 01:46:18 +02:00 committed by GitHub
commit 78c3a8eba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 285 additions and 100 deletions

View File

@ -1,86 +0,0 @@
{ pname, version, src, branchName
, stdenv, lib, wrapQtAppsHook
, cmake, pkg-config
, libpulseaudio, libjack2, alsa-lib, sndio
, vulkan-loader, vulkan-headers
, qtbase, qtwebengine, qttools
, nlohmann_json, rapidjson
, zlib, zstd, libzip, lz4
, glslang
, boost173
, catch2
, fmt_8
, SDL2
, udev
, libusb1
, ffmpeg
}:
stdenv.mkDerivation rec {
inherit pname version src;
nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook ];
buildInputs = [
libpulseaudio libjack2 alsa-lib sndio
vulkan-loader vulkan-headers
qtbase qtwebengine qttools
nlohmann_json rapidjson
zlib zstd libzip lz4
glslang
boost173
catch2
fmt_8
SDL2
udev
libusb1
ffmpeg
];
cmakeFlags = [
"-DYUZU_USE_BUNDLED_QT=OFF"
"-DYUZU_USE_BUNDLED_SDL2=OFF"
"-DYUZU_USE_BUNDLED_FFMPEG=OFF"
"-DENABLE_QT_TRANSLATION=ON"
"-DYUZU_USE_QT_WEB_ENGINE=ON"
"-DUSE_DISCORD_PRESENCE=ON"
];
# This changes `ir/opt` to `ir/var/empty` in `externals/dynarmic/src/dynarmic/CMakeLists.txt`
# making the build fail, as that path does not exist
dontFixCmake = true;
preConfigure = ''
# Trick the configure system. This prevents a check for submodule directories.
rm -f .gitmodules
# see https://github.com/NixOS/nixpkgs/issues/114044, setting this through cmakeFlags does not work.
cmakeFlagsArray+=(
"-DTITLE_BAR_FORMAT_IDLE=yuzu ${branchName} ${version}"
"-DTITLE_BAR_FORMAT_RUNNING=yuzu ${branchName} ${version} | {3}"
)
'';
# Fix vulkan detection
postFixup = ''
wrapProgram $out/bin/yuzu --prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib
wrapProgram $out/bin/yuzu-cmd --prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib
'';
meta = with lib; {
homepage = "https://yuzu-emu.org";
description = "The ${branchName} branch of an experimental Nintendo Switch emulator written in C++";
longDescription = ''
An experimental Nintendo Switch emulator written in C++.
Using the mainline branch is recommanded for general usage.
Using the early-access branch is recommanded if you would like to try out experimental features, with a cost of stability.
'';
license = with licenses; [
gpl2Plus
# Icons
cc-by-nd-30 cc0
];
maintainers = with maintainers; [ ivar joshuafern sbruder ];
platforms = platforms.linux;
broken = stdenv.isAarch64; # Currently aarch64 is not supported.
};
}

File diff suppressed because one or more lines are too long

View File

@ -1,28 +1,40 @@
{ branch ? "mainline", libsForQt5, fetchFromGitHub }:
{ branch ? "mainline"
, libsForQt5
, fetchFromGitHub
}:
let
inherit libsForQt5 fetchFromGitHub;
# Fetched from https://api.yuzu-emu.org/gamedb, last updated 2022-03-23.
# Please make sure to update this when updating yuzu!
compat-list = ./compatibility-list.json;
in {
mainline = libsForQt5.callPackage ./base.nix rec {
mainline = libsForQt5.callPackage ./generic.nix rec {
pname = "yuzu-mainline";
version = "953";
branchName = branch;
version = "992";
src = fetchFromGitHub {
owner = "yuzu-emu";
repo = "yuzu-mainline";
rev = "mainline-0-${version}";
sha256 = "0p07gybyhr6flzmhz92qlrwcq7l37c2wmcxw8sbrvhj2pgaaw9ic";
sha256 = "1x3fwwdw86jvygbzy9k99j6avfsd867ywm2x25izw10jznpsaixs";
fetchSubmodules = true;
};
inherit branch compat-list;
};
early-access = libsForQt5.callPackage ./base.nix rec {
early-access = libsForQt5.callPackage ./generic.nix rec {
pname = "yuzu-ea";
version = "2557";
branchName = branch;
version = "2690";
src = fetchFromGitHub {
owner = "pineappleEA";
repo = "pineapple-src";
rev = "EA-${version}";
sha256 = "013xxgyn8y5fv0xbrm0zfl9xmi0gx4hpflrbjskg1hcvb2bjqyvj";
sha256 = "0zm06clbdh9cccq9932q9v976q7sjknynkdvvp04h1wcskmrxi3c";
fetchSubmodules = true;
};
inherit branch compat-list;
};
}.${branch}

View File

@ -0,0 +1,157 @@
{ pname
, version
, src
, branch
, compat-list
, lib
, stdenv
, runCommandLocal
, substituteAll
, wrapQtAppsHook
, alsa-lib
, boost
, catch2
, cmake
, doxygen
, ffmpeg
, fmt_8
, glslang
, libjack2
, libopus
, libpulseaudio
, libusb1
, libva
, libzip
, lz4
, nlohmann_json
, perl
, pkg-config
, python3
, qtbase
, qttools
, qtwebengine
, rapidjson
, SDL2
, sndio
, speexdsp
, udev
, vulkan-headers
, vulkan-loader
, zlib
, zstd
}:
stdenv.mkDerivation rec {
inherit pname version src;
nativeBuildInputs = [
cmake
doxygen
perl
pkg-config
python3
wrapQtAppsHook
];
buildInputs = [
alsa-lib
boost
catch2
ffmpeg
fmt_8
glslang
libjack2
libopus
libpulseaudio
libusb1
libva
libzip
lz4
nlohmann_json
qtbase
qttools
qtwebengine
rapidjson
SDL2
sndio
speexdsp
udev
zlib
zstd
];
doCheck = true;
# This changes `ir/opt` to `ir/var/empty` in `externals/dynarmic/src/dynarmic/CMakeLists.txt`
# making the build fail, as that path does not exist
dontFixCmake = true;
cmakeFlags = [
"-DYUZU_USE_BUNDLED_QT=OFF"
"-DYUZU_USE_BUNDLED_FFMPEG=OFF"
"-DYUZU_USE_BUNDLED_OPUS=OFF"
"-DYUZU_USE_EXTERNAL_SDL2=OFF"
"-DENABLE_QT_TRANSLATION=ON"
"-DYUZU_USE_QT_WEB_ENGINE=ON"
"-DUSE_DISCORD_PRESENCE=ON"
# We dont want to bother upstream with potentially outdated compat reports
"-DYUZU_ENABLE_COMPATIBILITY_REPORTING=OFF"
"-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF" # We provide this deterministically
];
preConfigure = ''
# This prevents a check for submodule directories.
rm -f .gitmodules
# see https://github.com/NixOS/nixpkgs/issues/114044, setting this through cmakeFlags does not work.
cmakeFlagsArray+=(
"-DTITLE_BAR_FORMAT_IDLE=yuzu ${branch} ${version}"
"-DTITLE_BAR_FORMAT_RUNNING=yuzu ${branch} ${version} | {3}"
)
'';
# This must be done after cmake finishes as it overwrites the file
postConfigure = ''
ln -sf ${compat-list} ./dist/compatibility_list/compatibility_list.json
'';
# Fix vulkan detection
postFixup = ''
for bin in $out/bin/yuzu $out/bin/yuzu-cmd; do
wrapProgram $bin --prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib
done
'';
passthru.updateScript = runCommandLocal "yuzu-${branch}-updateScript" {
script = substituteAll {
src = ./update.sh;
inherit branch;
};
} "install -Dm755 $script $out";
meta = with lib; {
homepage = "https://yuzu-emu.org";
changelog = "https://yuzu-emu.org/entry";
description = "The ${branch} branch of an experimental Nintendo Switch emulator written in C++";
longDescription = ''
An experimental Nintendo Switch emulator written in C++.
Using the mainline branch is recommanded for general usage.
Using the early-access branch is recommanded if you would like to try out experimental features, with a cost of stability.
'';
mainProgram = "yuzu";
platforms = [ "x86_64-linux" ];
license = with licenses; [
gpl3Plus
# Icons
cc-by-nd-30 cc0
];
maintainers = with maintainers; [
ivar
joshuafern
sbruder
];
};
}

View File

@ -0,0 +1,102 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix nix-prefetch-git coreutils curl jq gnused
set -e
# Will be replaced with the actual branch when running this from passthru.updateScript
BRANCH="@branch@"
if [[ ! "$(basename $PWD)" = "yuzu" ]]; then
echo "error: Script must be ran from yuzu's directory!"
exit 1
fi
getLocalVersion() {
pushd ../../../.. >/dev/null
nix eval --raw -f default.nix "$1".version
popd >/dev/null
}
getLocalHash() {
pushd ../../../.. >/dev/null
nix eval --raw -f default.nix "$1".src.drvAttrs.outputHash
popd >/dev/null
}
updateCompatList() {
NEW_COMPAT_LIST="$(curl -s "https://api.yuzu-emu.org/gamedb")"
if [[ "$(cat ./compatibility-list.json)" = "${NEW_COMPAT_LIST}" ]]; then
echo "Compatibility list is already up to date!"
else
local TODAY="$(date +"%Y-%m-%d")"
echo "Compatibility list: updated to $TODAY"
echo "${NEW_COMPAT_LIST}" > ./compatibility-list.json
sed -i -e "s/last updated .*/last updated $TODAY./" ./default.nix
fi
}
updateMainline() {
OLD_MAINLINE_VERSION="$(getLocalVersion "yuzu-mainline")"
OLD_MAINLINE_HASH="$(getLocalHash "yuzu-mainline")"
NEW_MAINLINE_VERSION="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
"https://api.github.com/repos/yuzu-emu/yuzu-mainline/releases?per_page=1" | jq -r '.[0].name' | cut -d" " -f2)"
if [[ "${OLD_MAINLINE_VERSION}" = "${NEW_MAINLINE_VERSION}" ]]; then
echo "yuzu-mainline is already up to date!"
[ "$KEEP_GOING" ] && return || exit
else
echo "yuzu-mainline: ${OLD_MAINLINE_VERSION} -> ${NEW_MAINLINE_VERSION}"
fi
echo " Fetching source code..."
NEW_MAINLINE_HASH="$(nix-prefetch-git --quiet --fetch-submodules --rev "mainline-0-${NEW_MAINLINE_VERSION}" "https://github.com/yuzu-emu/yuzu-mainline" | jq -r '.sha256')"
echo " Succesfully fetched. hash: ${NEW_MAINLINE_HASH}"
sed -i "s/${OLD_MAINLINE_VERSION}/${NEW_MAINLINE_VERSION}/" ./default.nix
sed -i "s/${OLD_MAINLINE_HASH}/${NEW_MAINLINE_HASH}/" ./default.nix
}
updateEarlyAccess() {
OLD_EA_VERSION="$(getLocalVersion "yuzu-ea")"
OLD_EA_HASH="$(getLocalHash "yuzu-ea")"
NEW_EA_VERSION="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \
"https://api.github.com/repos/pineappleEA/pineapple-src/releases?per_page=1" | jq -r '.[0].name' | cut -d"-" -f2 | cut -d" " -f1)"
if [[ "${OLD_EA_VERSION}" = "${NEW_EA_VERSION}" ]]; then
echo "yuzu-ea is already up to date!"
[ "$KEEP_GOING" ] && return || exit
else
echo "yuzu-ea: ${OLD_EA_VERSION} -> ${NEW_EA_VERSION}"
fi
echo " Fetching source code..."
NEW_EA_HASH="$(nix-prefetch-git --quiet --fetch-submodules --rev "EA-${NEW_EA_VERSION}" "https://github.com/pineappleEA/pineapple-src" | jq -r '.sha256')"
echo " Succesfully fetched. hash: ${NEW_EA_HASH}"
sed -i "s/${OLD_EA_VERSION}/${NEW_EA_VERSION}/" ./default.nix
sed -i "s/${OLD_EA_HASH}/${NEW_EA_HASH}/" ./default.nix
}
if [[ "$BRANCH" = "mainline" ]]; then
updateMainline
updateCompatList
elif [[ "$BRANCH" = "early-access" ]]; then
updateEarlyAccess
updateCompatList
else
KEEP_GOING=1
updateMainline
updateEarlyAccess
updateCompatList
fi

View File

@ -1436,13 +1436,12 @@ with pkgs;
### APPLICATIONS/EMULATORS/YUZU
yuzu-mainline = import ../applications/emulators/yuzu {
yuzu-mainline = callPackage ../applications/emulators/yuzu {
branch = "mainline";
inherit libsForQt5 fetchFromGitHub;
};
yuzu-ea = import ../applications/emulators/yuzu {
yuzu-ea = callPackage ../applications/emulators/yuzu {
branch = "early-access";
inherit libsForQt5 fetchFromGitHub;
};
### APPLICATIONS/EMULATORS/COMMANDERX16