librepcb: 1.1.0 -> 1.2.0
[NixPkgs.git] / pkgs / by-name / li / lime3ds / package.nix
blob148ddc8ab65dd48213108ed4c7de063fa00293df
2   alsa-lib,
3   boost,
4   catch2_3,
5   cmake,
6   cryptopp,
7   cpp-jwt,
8   doxygen,
9   enet,
10   fetchzip,
11   fmt,
12   ffmpeg_6-headless,
13   gamemode,
14   httplib,
15   inih,
16   lib,
17   libGL,
18   libjack2,
19   libpulseaudio,
20   libunwind,
21   libusb1,
22   nlohmann_json,
23   openal,
24   openssl,
25   pipewire,
26   pkg-config,
27   portaudio,
28   sndio,
29   spirv-tools,
30   soundtouch,
31   stdenv,
32   vulkan-headers,
33   vulkan-loader,
34   xorg,
35   zstd,
36   enableSdl2Frontend ? true,
37   SDL2,
38   enableQt ? true,
39   kdePackages,
40   enableQtTranslations ? enableQt,
41   enableCubeb ? true,
42   cubeb,
43   useDiscordRichPresence ? false,
44   rapidjson,
46 let
47   inherit (lib)
48     optional
49     optionals
50     cmakeBool
51     optionalString
52     getLib
53     makeLibraryPath
54     ;
56 stdenv.mkDerivation (finalAttrs: {
57   pname = "lime3ds";
58   version = "2119";
60   src = fetchzip {
61     url = "https://github.com/Lime3DS/Lime3DS/releases/download/${finalAttrs.version}/lime3ds-unified-source-${finalAttrs.version}.tar.xz";
62     hash = "sha256-cBPSzkvvivWGTD2E7fjeY3uJ1nSlALbOgIalGdk6xLU=";
63   };
65   nativeBuildInputs = [
66     cmake
67     doxygen
68     pkg-config
69   ] ++ lib.optionals enableQt [ kdePackages.wrapQtAppsHook ];
71   buildInputs =
72     [
73       alsa-lib
74       boost
75       catch2_3
76       cryptopp
77       cpp-jwt
78       enet
79       fmt
80       ffmpeg_6-headless
81       httplib
82       inih
83       libGL
84       libjack2
85       libpulseaudio
86       libunwind
87       libusb1
88       nlohmann_json
89       openal
90       openssl
91       pipewire
92       portaudio
93       soundtouch
94       sndio
95       spirv-tools
96       vulkan-headers
97       xorg.libX11
98       xorg.libXext
99       zstd
100     ]
101     ++ optionals enableQt (
102       with kdePackages;
103       [
104         qtbase
105         qtmultimedia
106         qttools
107         qtwayland
108       ]
109     )
110     ++ optionals enableSdl2Frontend [ SDL2 ]
111     ++ optionals enableQtTranslations [ kdePackages.qttools ]
112     ++ optionals enableCubeb [ cubeb ]
113     ++ optional useDiscordRichPresence rapidjson;
115   postPatch = ''
116     # Fix file not found when looking in var/empty instead of opt
117     mkdir externals/dynarmic/src/dynarmic/ir/var
118     ln -s ../opt externals/dynarmic/src/dynarmic/ir/var/empty
120     # We already know the submodules are present
121     substituteInPlace CMakeLists.txt \
122       --replace-fail "check_submodules_present()" ""
124     # Add gamemode
125     substituteInPlace externals/gamemode/include/gamemode_client.h \
126       --replace-fail "libgamemode.so.0" "${getLib gamemode}/lib/libgamemode.so.0"
127   '';
129   postInstall =
130     let
131       libs = makeLibraryPath [ vulkan-loader ];
132     in
133     optionalString enableSdl2Frontend ''
134       for binfile in lime3ds lime3ds-room
135       do
136         wrapProgram "$out/bin/$binfile" \
137           --prefix LD_LIBRARY_PATH : ${libs}
138     ''
139     + optionalString enableQt ''
140         qtWrapperArgs+=(
141           --prefix LD_LIBRARY_PATH : ${libs}
142         )
143       done
144     '';
146   cmakeFlags =
147     [
148       (cmakeBool "LIME3DS_USE_PRECOMPILED_HEADERS" false)
149       (cmakeBool "USE_SYSTEM_LIBS" true)
150       (cmakeBool "DISABLE_SYSTEM_DYNARMIC" true)
151       (cmakeBool "DISABLE_SYSTEM_GLSLANG" true)
152       (cmakeBool "DISABLE_SYSTEM_LODEPNG" true)
153       (cmakeBool "DISABLE_SYSTEM_VMA" true)
154       (cmakeBool "DISABLE_SYSTEM_XBYAK" true)
155       (cmakeBool "ENABLE_QT" enableQt)
156       (cmakeBool "ENABLE_SDL2_FRONTEND" enableSdl2Frontend)
157       (cmakeBool "ENABLE_CUBEB" enableCubeb)
158       (cmakeBool "USE_DISCORD_PRESENCE" useDiscordRichPresence)
159     ]
160     ++ optionals enableQt [
161       (cmakeBool "ENABLE_QT_TRANSLATION" enableQtTranslations)
162     ];
164   meta = {
165     description = "A Nintendo 3DS emulator based on Citra";
166     homepage = "https://github.com/Lime3DS/Lime3DS";
167     license = lib.licenses.gpl2Only;
168     maintainers = with lib.maintainers; [ arthsmn ];
169     mainProgram = "lime3ds";
170     platforms = lib.platforms.linux;
171   };