bat: 0.24.0 -> 0.25.0 (#371913)
[NixPkgs.git] / pkgs / applications / emulators / dolphin-emu / primehack.nix
blob66200efda7202b112942b57c5be949f79d4c0b4a
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   pkg-config,
6   cmake,
7   wrapQtAppsHook,
8   qtbase,
9   qtsvg,
10   bluez,
11   ffmpeg,
12   libao,
13   libGLU,
14   libGL,
15   pcre,
16   gettext,
17   libXrandr,
18   libusb1,
19   libpthreadstubs,
20   libXext,
21   libXxf86vm,
22   libXinerama,
23   libSM,
24   libXdmcp,
25   readline,
26   openal,
27   udev,
28   libevdev,
29   portaudio,
30   curl,
31   alsa-lib,
32   miniupnpc,
33   enet,
34   mbedtls_2,
35   soundtouch,
36   sfml,
37   fmt,
38   xz,
39   vulkan-loader,
40   libpulseaudio,
42   # - Inputs used for Darwin
43   CoreBluetooth,
44   ForceFeedback,
45   IOKit,
46   OpenGL,
47   libpng,
48   hidapi,
51 stdenv.mkDerivation rec {
52   pname = "dolphin-emu-primehack";
53   version = "1.0.7a";
55   src = fetchFromGitHub {
56     owner = "shiiion";
57     repo = "dolphin";
58     rev = version;
59     hash = "sha256-vuTSXQHnR4HxAGGiPg5tUzfiXROU3+E9kyjH+T6zVmc=";
60     fetchSubmodules = true;
61   };
63   nativeBuildInputs = [
64     pkg-config
65     cmake
66   ] ++ lib.optional stdenv.hostPlatform.isLinux wrapQtAppsHook;
68   buildInputs =
69     [
70       curl
71       ffmpeg
72       libao
73       libGLU
74       libGL
75       pcre
76       gettext
77       libpthreadstubs
78       libpulseaudio
79       libXrandr
80       libXext
81       libXxf86vm
82       libXinerama
83       libSM
84       readline
85       openal
86       libXdmcp
87       portaudio
88       libusb1
89       libpng
90       hidapi
91       miniupnpc
92       enet
93       mbedtls_2
94       soundtouch
95       sfml
96       fmt
97       xz
98       qtbase
99       qtsvg
100     ]
101     ++ lib.optionals stdenv.hostPlatform.isLinux [
102       bluez
103       udev
104       libevdev
105       alsa-lib
106       vulkan-loader
107     ]
108     ++ lib.optionals stdenv.hostPlatform.isDarwin [
109       CoreBluetooth
110       OpenGL
111       ForceFeedback
112       IOKit
113     ];
115   cmakeFlags =
116     [
117       "-DUSE_SHARED_ENET=ON"
118       "-DENABLE_LTO=ON"
119     ]
120     ++ lib.optionals stdenv.hostPlatform.isDarwin [
121       "-DOSX_USE_DEFAULT_SEARCH_PATH=True"
122     ];
124   qtWrapperArgs = lib.optionals stdenv.hostPlatform.isLinux [
125     "--prefix LD_LIBRARY_PATH : ${vulkan-loader}/lib"
126     # https://bugs.dolphin-emu.org/issues/11807
127     # The .desktop file should already set this, but Dolphin may be launched in other ways
128     "--set QT_QPA_PLATFORM xcb"
129   ];
131   # - Allow Dolphin to use nix-provided libraries instead of building them
132   postPatch =
133     ''
134       substituteInPlace CMakeLists.txt --replace 'DISTRIBUTOR "None"' 'DISTRIBUTOR "NixOS"'
135     ''
136     + lib.optionalString stdenv.hostPlatform.isDarwin ''
137       substituteInPlace CMakeLists.txt --replace 'if(NOT APPLE)' 'if(true)'
138       substituteInPlace CMakeLists.txt --replace 'if(LIBUSB_FOUND AND NOT APPLE)' 'if(LIBUSB_FOUND)'
139     '';
141   postInstall =
142     ''
143       mv $out/bin/dolphin-emu $out/bin/dolphin-emu-primehack
144       mv $out/bin/dolphin-emu-nogui $out/bin/dolphin-emu-primehack-nogui
145       mv $out/share/applications/dolphin-emu.desktop $out/share/applications/dolphin-emu-primehack.desktop
146       mv $out/share/icons/hicolor/256x256/apps/dolphin-emu.png $out/share/icons/hicolor/256x256/apps/dolphin-emu-primehack.png
147       substituteInPlace $out/share/applications/dolphin-emu-primehack.desktop --replace 'dolphin-emu' 'dolphin-emu-primehack'
148       substituteInPlace $out/share/applications/dolphin-emu-primehack.desktop --replace 'Dolphin Emulator' 'PrimeHack'
149     ''
150     + lib.optionalString stdenv.hostPlatform.isLinux ''
151       install -D $src/Data/51-usb-device.rules $out/etc/udev/rules.d/51-usb-device.rules
152     '';
154   meta = with lib; {
155     homepage = "https://github.com/shiiion/dolphin";
156     description = "Gamecube/Wii/Triforce emulator for x86_64 and ARMv8";
157     license = licenses.gpl2Plus;
158     maintainers = with maintainers; [ Madouura ];
159     broken = stdenv.hostPlatform.isDarwin;
160     platforms = platforms.unix;
161   };