Merge pull request #173433 from kira64xyz/citra
citra: rename to citra-nightly, init citra-canarymain
commit
51ba3f1ac9
@ -1,93 +1,45 @@ |
|||||||
{ lib |
{ branch |
||||||
, stdenv |
, libsForQt5 |
||||||
, fetchFromGitHub |
, fetchFromGitHub |
||||||
, cmake |
, fetchurl |
||||||
, wrapQtAppsHook |
|
||||||
, boost17x |
|
||||||
, pkg-config |
|
||||||
, libusb1 |
|
||||||
, zstd |
|
||||||
, libressl |
|
||||||
, enableSdl2 ? true, SDL2 |
|
||||||
, enableQt ? true, qtbase, qtmultimedia |
|
||||||
, enableQtTranslation ? enableQt, qttools |
|
||||||
, enableWebService ? true |
|
||||||
, enableCubeb ? true, libpulseaudio |
|
||||||
, enableFfmpegAudioDecoder ? true |
|
||||||
, enableFfmpegVideoDumper ? true |
|
||||||
, ffmpeg |
|
||||||
, useDiscordRichPresence ? true, rapidjson |
|
||||||
, enableFdk ? false, fdk_aac |
|
||||||
}: |
}: |
||||||
assert lib.assertMsg (!enableFfmpegAudioDecoder || !enableFdk) "Can't enable both enableFfmpegAudioDecoder and enableFdk"; |
|
||||||
|
|
||||||
stdenv.mkDerivation { |
let |
||||||
pname = "citra"; |
# Fetched from https://api.citra-emu.org/gamedb, last updated 2022-05-02 |
||||||
version = "2021-11-01"; |
# Please make sure to update this when updating citra! |
||||||
|
compat-list = fetchurl { |
||||||
src = fetchFromGitHub { |
name = "citra-compat-list"; |
||||||
owner = "citra-emu"; |
url = "https://web.archive.org/web/20220502114622/https://api.citra-emu.org/gamedb/"; |
||||||
repo = "citra"; |
sha256 = "sha256-blIlaYaUQjw7Azgg+Dd7ZPEQf+ddZMO++Yxinwe+VG0="; |
||||||
rev = "5a7d80172dd115ad9bc6e8e85cee6ed9511c48d0"; |
}; |
||||||
sha256 = "sha256-vy2JMizBsnRK9NBEZ1dxT7fP/HFhOZSsC+5P+Dzi27s="; |
in { |
||||||
fetchSubmodules = true; |
nightly = libsForQt5.callPackage ./generic.nix rec { |
||||||
|
pname = "citra-nightly"; |
||||||
|
version = "1765"; |
||||||
|
|
||||||
|
src = fetchFromGitHub { |
||||||
|
owner = "citra-emu"; |
||||||
|
repo = "citra-nightly"; |
||||||
|
rev = "nightly-${version}"; |
||||||
|
sha256 = "0d3dfh63cmsy5idbypdz3ibydmb4a35sfv7qmxxlcpc390pp9cvq"; |
||||||
|
fetchSubmodules = true; |
||||||
|
}; |
||||||
|
|
||||||
|
inherit branch compat-list; |
||||||
}; |
}; |
||||||
|
|
||||||
nativeBuildInputs = [ |
canary = libsForQt5.callPackage ./generic.nix rec { |
||||||
cmake |
pname = "citra-canary"; |
||||||
pkg-config |
version = "2146"; |
||||||
] |
|
||||||
++ lib.optionals enableQt [ wrapQtAppsHook ]; |
|
||||||
|
|
||||||
buildInputs = [ |
|
||||||
boost17x |
|
||||||
libusb1 |
|
||||||
] |
|
||||||
++ lib.optionals enableSdl2 [ SDL2 ] |
|
||||||
++ lib.optionals enableQt [ qtbase qtmultimedia ] |
|
||||||
++ lib.optionals enableQtTranslation [ qttools ] |
|
||||||
++ lib.optionals enableCubeb [ libpulseaudio ] |
|
||||||
++ lib.optionals (enableFfmpegAudioDecoder || enableFfmpegVideoDumper) [ ffmpeg ] |
|
||||||
++ lib.optionals useDiscordRichPresence [ rapidjson ] |
|
||||||
++ lib.optionals enableFdk [ fdk_aac ]; |
|
||||||
|
|
||||||
cmakeFlags = [ |
|
||||||
"-DUSE_SYSTEM_BOOST=ON" |
|
||||||
] |
|
||||||
++ lib.optionals (!enableSdl2) [ "-DENABLE_SDL2=OFF" ] |
|
||||||
++ lib.optionals (!enableQt) [ "-DENABLE_QT=OFF" ] |
|
||||||
++ lib.optionals enableQtTranslation [ "-DENABLE_QT_TRANSLATION=ON" ] |
|
||||||
++ lib.optionals (!enableWebService) [ "-DENABLE_WEB_SERVICE=OFF" ] |
|
||||||
++ lib.optionals (!enableCubeb) [ "-DENABLE_CUBEB=OFF" ] |
|
||||||
++ lib.optionals enableFfmpegAudioDecoder [ "-DENABLE_FFMPEG_AUDIO_DECODER=ON"] |
|
||||||
++ lib.optionals enableFfmpegVideoDumper [ "-DENABLE_FFMPEG_VIDEO_DUMPER=ON" ] |
|
||||||
++ lib.optionals useDiscordRichPresence [ "-DUSE_DISCORD_PRESENCE=ON" ] |
|
||||||
++ lib.optionals enableFdk [ "-DENABLE_FDK=ON" ]; |
|
||||||
|
|
||||||
postPatch = '' |
|
||||||
# We already know the submodules are present |
|
||||||
substituteInPlace CMakeLists.txt \ |
|
||||||
--replace "check_submodules_present()" "" |
|
||||||
|
|
||||||
# Devendoring |
|
||||||
rm -rf externals/zstd externals/libressl |
|
||||||
cp -r ${zstd.src} externals/zstd |
|
||||||
tar xf ${libressl.src} -C externals/ |
|
||||||
mv externals/${libressl.name} externals/libressl |
|
||||||
chmod -R a+w externals/zstd |
|
||||||
''; |
|
||||||
|
|
||||||
# Fixes https://github.com/NixOS/nixpkgs/issues/171173 |
src = fetchFromGitHub { |
||||||
postInstall = lib.optionalString (enableCubeb && enableSdl2) '' |
owner = "citra-emu"; |
||||||
wrapProgram "$out/bin/citra" \ |
repo = "citra-canary"; |
||||||
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libpulseaudio ]} |
rev = "canary-${version}"; |
||||||
''; |
sha256 = "1wnym0nklngimf5gaaa2703nz4g5iy572wlgp88h67rrh9b4f04r"; |
||||||
|
fetchSubmodules = true; |
||||||
|
}; |
||||||
|
|
||||||
meta = with lib; { |
inherit branch compat-list; |
||||||
homepage = "https://citra-emu.org"; |
|
||||||
description = "An open-source emulator for the Nintendo 3DS"; |
|
||||||
license = licenses.gpl2; |
|
||||||
maintainers = with maintainers; [ abbradar ]; |
|
||||||
platforms = platforms.linux; |
|
||||||
}; |
}; |
||||||
} |
}.${branch} |
||||||
|
@ -0,0 +1,107 @@ |
|||||||
|
{ pname |
||||||
|
, version |
||||||
|
, src |
||||||
|
, branch |
||||||
|
, compat-list |
||||||
|
|
||||||
|
, lib |
||||||
|
, stdenv |
||||||
|
, fetchFromGitHub |
||||||
|
, cmake |
||||||
|
, boost17x |
||||||
|
, pkg-config |
||||||
|
, libusb1 |
||||||
|
, zstd |
||||||
|
, libressl |
||||||
|
, enableSdl2 ? true, SDL2 |
||||||
|
, enableQt ? true, qtbase, qtmultimedia, wrapQtAppsHook |
||||||
|
, enableQtTranslation ? enableQt, qttools |
||||||
|
, enableWebService ? true |
||||||
|
, enableCubeb ? true, libpulseaudio |
||||||
|
, enableFfmpegAudioDecoder ? true |
||||||
|
, enableFfmpegVideoDumper ? true |
||||||
|
, ffmpeg |
||||||
|
, useDiscordRichPresence ? true, rapidjson |
||||||
|
, enableFdk ? false, fdk_aac |
||||||
|
}: |
||||||
|
assert lib.assertMsg (!enableFfmpegAudioDecoder || !enableFdk) "Can't enable both enableFfmpegAudioDecoder and enableFdk"; |
||||||
|
|
||||||
|
stdenv.mkDerivation rec { |
||||||
|
inherit pname version src; |
||||||
|
|
||||||
|
nativeBuildInputs = [ |
||||||
|
cmake |
||||||
|
pkg-config |
||||||
|
] ++ lib.optionals enableQt [ wrapQtAppsHook ]; |
||||||
|
|
||||||
|
buildInputs = [ |
||||||
|
boost17x |
||||||
|
libusb1 |
||||||
|
] ++ lib.optionals enableQt [ qtbase qtmultimedia ] |
||||||
|
++ lib.optional enableSdl2 SDL2 |
||||||
|
++ lib.optional enableQtTranslation qttools |
||||||
|
++ lib.optional enableCubeb libpulseaudio |
||||||
|
++ lib.optional (enableFfmpegAudioDecoder || enableFfmpegVideoDumper) ffmpeg |
||||||
|
++ lib.optional useDiscordRichPresence rapidjson |
||||||
|
++ lib.optional enableFdk fdk_aac; |
||||||
|
|
||||||
|
cmakeFlags = [ |
||||||
|
"-DUSE_SYSTEM_BOOST=ON" |
||||||
|
"-DCITRA_USE_BUNDLED_FFMPEG=OFF" |
||||||
|
"-DCITRA_USE_BUNDLED_QT=OFF" |
||||||
|
"-DCITRA_USE_BUNDLED_SDL2=OFF" |
||||||
|
|
||||||
|
# We dont want to bother upstream with potentially outdated compat reports |
||||||
|
"-DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON" |
||||||
|
"-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF" # We provide this deterministically |
||||||
|
] ++ lib.optional (!enableSdl2) "-DENABLE_SDL2=OFF" |
||||||
|
++ lib.optional (!enableQt) "-DENABLE_QT=OFF" |
||||||
|
++ lib.optional enableQtTranslation "-DENABLE_QT_TRANSLATION=ON" |
||||||
|
++ lib.optional (!enableWebService) "-DENABLE_WEB_SERVICE=OFF" |
||||||
|
++ lib.optional (!enableCubeb) "-DENABLE_CUBEB=OFF" |
||||||
|
++ lib.optional enableFfmpegAudioDecoder "-DENABLE_FFMPEG_AUDIO_DECODER=ON" |
||||||
|
++ lib.optional enableFfmpegVideoDumper "-DENABLE_FFMPEG_VIDEO_DUMPER=ON" |
||||||
|
++ lib.optional useDiscordRichPresence "-DUSE_DISCORD_PRESENCE=ON" |
||||||
|
++ lib.optional enableFdk "-DENABLE_FDK=ON"; |
||||||
|
|
||||||
|
postPatch = '' |
||||||
|
# Prep compatibilitylist |
||||||
|
ln -s ${compat-list} ./dist/compatibility_list/compatibility_list.json |
||||||
|
|
||||||
|
# We already know the submodules are present |
||||||
|
substituteInPlace CMakeLists.txt \ |
||||||
|
--replace "check_submodules_present()" "" |
||||||
|
|
||||||
|
# Devendoring |
||||||
|
rm -rf externals/zstd externals/libressl |
||||||
|
cp -r ${zstd.src} externals/zstd |
||||||
|
tar xf ${libressl.src} -C externals/ |
||||||
|
mv externals/${libressl.name} externals/libressl |
||||||
|
chmod -R a+w externals/zstd |
||||||
|
''; |
||||||
|
|
||||||
|
# Fixes https://github.com/NixOS/nixpkgs/issues/171173 |
||||||
|
postInstall = lib.optionalString (enableCubeb && enableSdl2) '' |
||||||
|
wrapProgram "$out/bin/citra" \ |
||||||
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libpulseaudio ]} |
||||||
|
''; |
||||||
|
|
||||||
|
meta = with lib; { |
||||||
|
homepage = "https://citra-emu.org"; |
||||||
|
description = "The ${branch} branch of an open-source emulator for the Ninteno 3DS"; |
||||||
|
longDescription = '' |
||||||
|
A Nintendo 3DS Emulator written in C++ |
||||||
|
Using the nightly branch is recommended for general usage. |
||||||
|
Using the canary branch is recommended if you would like to try out |
||||||
|
experimental features, with a cost of stability. |
||||||
|
''; |
||||||
|
mainProgram = if enableQt then "citra-qt" else "citra"; |
||||||
|
platforms = platforms.linux; |
||||||
|
license = licenses.gpl2Plus; |
||||||
|
maintainers = with maintainers; [ |
||||||
|
abbradar |
||||||
|
ashley |
||||||
|
ivar |
||||||
|
]; |
||||||
|
}; |
||||||
|
} |
@ -0,0 +1,84 @@ |
|||||||
|
#! /usr/bin/env nix-shell |
||||||
|
#! nix-shell -i bash -p nix nix-prefetch-git coreutils curl jq gnused |
||||||
|
|
||||||
|
set -euo pipefail |
||||||
|
|
||||||
|
# Will be replaced with the actual branch when running this from passthru.updateScript |
||||||
|
BRANCH="@branch@" |
||||||
|
|
||||||
|
if [[ ! "$(basename $PWD)" = "citra" ]]; then |
||||||
|
echo "error: Script must be ran from citra'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 |
||||||
|
} |
||||||
|
|
||||||
|
updateNightly() { |
||||||
|
OLD_NIGHTLY_VERSION="$(getLocalVersion "citra-nightly")" |
||||||
|
OLD_NIGHTLY_HASH="$(getLocalHash "citra-nightly")" |
||||||
|
|
||||||
|
NEW_NIGHTLY_VERSION="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \ |
||||||
|
"https://api.github.com/repos/citra-emu/citra-nightly/releases?per_page=1" | jq -r '.[0].name' | cut -d"-" -f2 | cut -d" " -f2)" |
||||||
|
|
||||||
|
if [[ "${OLD_NIGHTLY_VERSION}" = "${NEW_NIGHTLY_VERSION}" ]]; then |
||||||
|
echo "citra-nightly is already up to date!" |
||||||
|
|
||||||
|
[ "$KEEP_GOING" ] && return || exit |
||||||
|
else |
||||||
|
echo "citra-nightly: ${OLD_NIGHTLY_VERSION} -> ${NEW_NIGHTLY_VERSION}" |
||||||
|
fi |
||||||
|
|
||||||
|
echo " Fetching source code..." |
||||||
|
|
||||||
|
NEW_NIGHTLY_HASH="$(nix-prefetch-git --quiet --fetch-submodules --rev "nightly-${NEW_NIGHTLY_VERSION}" "https://github.com/citra-emu/citra-nightly" | jq -r '.sha256')" |
||||||
|
|
||||||
|
echo " Succesfully fetched. hash: ${NEW_NIGHTLY_HASH}" |
||||||
|
|
||||||
|
sed -i "s/${OLD_NIGHTLY_VERSION}/${NEW_NIGHTLY_VERSION}/" ./default.nix |
||||||
|
sed -i "s/${OLD_NIGHTLY_HASH}/${NEW_NIGHTLY_HASH}/" ./default.nix |
||||||
|
} |
||||||
|
|
||||||
|
updateCanary() { |
||||||
|
OLD_CANARY_VERSION="$(getLocalVersion "citra-canary")" |
||||||
|
OLD_CANARY_HASH="$(getLocalHash "citra-canary")" |
||||||
|
|
||||||
|
NEW_CANARY_VERSION="$(curl -s ${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} \ |
||||||
|
"https://api.github.com/repos/citra-emu/citra-canary/releases?per_page=1" | jq -r '.[0].name' | cut -d"-" -f2 | cut -d" " -f1)" |
||||||
|
|
||||||
|
if [[ "${OLD_CANARY_VERSION}" = "${NEW_CANARY_VERSION}" ]]; then |
||||||
|
echo "citra-canary is already up to date!" |
||||||
|
|
||||||
|
[ "$KEEP_GOING" ] && return || exit |
||||||
|
else |
||||||
|
echo "citra-canary: ${OLD_CANARY_VERSION} -> ${NEW_CANARY_VERSION}" |
||||||
|
fi |
||||||
|
|
||||||
|
echo " Fetching source code..." |
||||||
|
|
||||||
|
NEW_CANARY_HASH="$(nix-prefetch-git --quiet --fetch-submodules --rev "canary-${NEW_CANARY_VERSION}" "https://github.com/citra-emu/citra-canary" | jq -r '.sha256')" |
||||||
|
|
||||||
|
echo " Succesfully fetched. hash: ${NEW_CANARY_HASH}" |
||||||
|
|
||||||
|
sed -i "s/${OLD_CANARY_VERSION}/${NEW_CANARY_VERSION}/" ./default.nix |
||||||
|
sed -i "s/${OLD_CANARY_HASH}/${NEW_CANARY_HASH}/" ./default.nix |
||||||
|
} |
||||||
|
|
||||||
|
if [[ "$BRANCH" = "nightly" ]]; then |
||||||
|
updateNightly |
||||||
|
elif [[ "$BRANCH" = "early-access" ]]; then |
||||||
|
updateCanary |
||||||
|
else |
||||||
|
KEEP_GOING=1 |
||||||
|
updateNightly |
||||||
|
updateCanary |
||||||
|
fi |
Loading…
Reference in new issue