2021-10-24 00:29:12 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, wrapQtAppsHook
|
|
|
|
, boost17x
|
|
|
|
, pkg-config
|
|
|
|
, libusb1
|
|
|
|
, zstd
|
|
|
|
, libressl
|
2021-11-23 22:16:56 +01:00
|
|
|
, 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
|
2021-10-24 00:29:12 +02:00
|
|
|
}:
|
2021-11-23 22:16:56 +01:00
|
|
|
assert lib.assertMsg (!enableFfmpegAudioDecoder || !enableFdk) "Can't enable both enableFfmpegAudioDecoder and enableFdk";
|
2017-07-27 14:57:12 +02:00
|
|
|
|
2021-10-24 00:29:12 +02:00
|
|
|
stdenv.mkDerivation {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "citra";
|
2021-11-02 06:04:17 +01:00
|
|
|
version = "2021-11-01";
|
2017-07-27 14:57:12 +02:00
|
|
|
|
2021-10-24 00:29:12 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "citra-emu";
|
|
|
|
repo = "citra";
|
2021-11-02 06:04:17 +01:00
|
|
|
rev = "5a7d80172dd115ad9bc6e8e85cee6ed9511c48d0";
|
|
|
|
sha256 = "sha256-vy2JMizBsnRK9NBEZ1dxT7fP/HFhOZSsC+5P+Dzi27s=";
|
2021-10-24 00:29:12 +02:00
|
|
|
fetchSubmodules = true;
|
2017-07-27 14:57:12 +02:00
|
|
|
};
|
|
|
|
|
2021-11-23 22:16:56 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
]
|
|
|
|
++ lib.optionals enableQt [ wrapQtAppsHook ];
|
|
|
|
|
2021-10-24 00:29:12 +02:00
|
|
|
buildInputs = [
|
|
|
|
boost17x
|
|
|
|
libusb1
|
2021-11-23 22:16:56 +01:00
|
|
|
]
|
|
|
|
++ 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 ];
|
2021-10-24 00:29:12 +02:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DUSE_SYSTEM_BOOST=ON"
|
2021-11-23 22:16:56 +01:00
|
|
|
]
|
|
|
|
++ 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" ];
|
2021-10-24 00:29:12 +02:00
|
|
|
|
|
|
|
postPatch = ''
|
2021-11-23 22:16:56 +01:00
|
|
|
# We already know the submodules are present
|
2021-10-24 00:29:12 +02:00
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace "check_submodules_present()" ""
|
2017-07-27 14:57:12 +02:00
|
|
|
|
2021-11-23 22:16:56 +01:00
|
|
|
# Devendoring
|
2021-10-24 00:29:12 +02:00
|
|
|
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
|
2017-07-27 14:57:12 +02:00
|
|
|
'';
|
|
|
|
|
2021-10-24 00:29:12 +02:00
|
|
|
# Todo: cubeb audio backend (the default one) doesn't work on the SDL interface.
|
2021-11-23 22:16:56 +01:00
|
|
|
# This seems to be a problem with libpulseaudio, other applications have similar problems (e.g Duckstation).
|
2021-10-24 00:29:12 +02:00
|
|
|
# Note that the two interfaces have two separate configuration files.
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2018-06-16 03:31:53 +02:00
|
|
|
homepage = "https://citra-emu.org";
|
|
|
|
description = "An open-source emulator for the Nintendo 3DS";
|
2017-07-27 16:28:13 +02:00
|
|
|
license = licenses.gpl2;
|
2017-07-27 14:57:12 +02:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
2018-06-16 03:31:53 +02:00
|
|
|
platforms = platforms.linux;
|
2017-07-27 14:57:12 +02:00
|
|
|
};
|
|
|
|
}
|