about summary refs log tree commit diff
path: root/pkgs/misc/emulators/dolphin-emu/default.nix
blob: cc49ef2aa1dc05bc8211369000d8f1145d52354f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ stdenv, lib, fetchpatch, pkgconfig, cmake, bluez, ffmpeg, libao, gtk2, glib
, libGLU, libGL , gettext, libpthreadstubs, libXrandr, libXext, readline
, openal , libXdmcp, portaudio, fetchFromGitHub, libusb, libevdev
, wxGTK30, soundtouch, miniupnpc, mbedtls, curl, lzo, sfml
, libpulseaudio ? null }:

stdenv.mkDerivation rec {
  pname = "dolphin-emu";
  version = "5.0";

  src = fetchFromGitHub {
    owner  = "dolphin-emu";
    repo   = "dolphin";
    rev    = version;
    sha256 = "07mlfnh0hwvk6xarcg315x7z2j0qbg9g7cm040df9c8psiahc3g6";
  };

  patches = [
    # Fix build with soundtouch 2.1.2
    (fetchpatch {
      url = "https://src.fedoraproject.org/rpms/dolphin-emu/raw/a1b91fdf94981e12c8889a02cba0ec2267d0f303/f/dolphin-emu-5.0-soundtouch-exception-fix.patch";
      name = "dolphin-emu-5.0-soundtouch-exception-fix.patch";
      sha256 = "0yd3l46nja5qiknnl30ryad98f3v8911jwnr67hn61dzx2kwbbaw";
    })
    # Fix build with gcc 8
    (fetchpatch {
      url = "https://salsa.debian.org/games-team/dolphin-emu/raw/9b7b4aeac1b60dcf28bdcafbed6bc498b2aeb0ad/debian/patches/03_gcc8.patch";
      name = "03_gcc8.patch";
      sha256 = "1da95gb8c95kd5cjhdvg19cv2z863lj3va5gx3bqc7g8r36glqxr";
    })
  ];

  postPatch = ''
    substituteInPlace Source/Core/VideoBackends/OGL/RasterFont.cpp \
      --replace " CHAR_WIDTH " " CHARWIDTH "
  '';

  cmakeFlags = [
    "-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
    "-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include"
    "-DGTK2_INCLUDE_DIRS=${gtk2.dev}/include/gtk-2.0"
    "-DENABLE_LTO=True"
  ];

  enableParallelBuilding = true;

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ cmake bluez ffmpeg libao libGLU libGL gtk2 glib
                  gettext libpthreadstubs libXrandr libXext readline openal
                  libevdev libXdmcp portaudio libusb libpulseaudio
                  libevdev libXdmcp portaudio libusb libpulseaudio
                  wxGTK30 soundtouch miniupnpc mbedtls curl lzo sfml ];

  meta = with lib; {
    homepage = https://dolphin-emu.org/;
    description = "Gamecube/Wii/Triforce emulator for x86_64 and ARMv8";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ MP2E ashkitten ];
    # x86_32 is an unsupported platform.
    # Enable generic build if you really want a JIT-less binary.
    platforms = [ "x86_64-linux" ];
  };
}