about summary refs log tree commit diff
path: root/pkgs/misc/emulators/retroarch/default.nix
blob: 171453b89d5b099a93473007f240e1306c29f4ee (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, fetchFromGitHub, makeDesktopItem, coreutils, which, pkgconfig
, ffmpeg, mesa, freetype, libxml2, python34
, enableNvidiaCgToolkit ? false, nvidia_cg_toolkit ? null
, alsaLib ? null, libv4l ? null
, udev ? null, libX11 ? null, libXext ? null, libXxf86vm ? null
, libXdmcp ? null, SDL ? null, libpulseaudio ? null
}:

with stdenv.lib;

let
  desktopItem = makeDesktopItem {
    name = "retroarch";
    exec = "retroarch";
    icon = "retroarch";
    comment = "Multi-Engine Platform";
    desktopName = "RetroArch";
    genericName = "Libretro Frontend";
    categories = "Game;Emulator;";
    #keywords = "multi;engine;emulator;xmb;";
  };
in

stdenv.mkDerivation rec {
  name = "retroarch-bare-${version}";
  version = "1.6.0";

  src = fetchFromGitHub {
    owner = "libretro";
    repo = "RetroArch";
    sha256 = "1ym2kws58fbavkc3giz5xqaqiqqdbf7wrz7y7iw53p1bnkc3l8yi";
    rev = "v${version}";
  };

  buildInputs = [ pkgconfig ffmpeg mesa freetype libxml2 coreutils python34 which SDL ]
                ++ optional enableNvidiaCgToolkit nvidia_cg_toolkit
                ++ optionals stdenv.isLinux [ udev alsaLib libX11 libXext libXxf86vm libXdmcp libv4l libpulseaudio ];

  configureScript = "sh configure";

  patchPhase = ''
    export GLOBAL_CONFIG_DIR=$out/etc
    sed -e 's#/bin/true#${coreutils}/bin/true#' -i qb/qb.libs.sh
  '';

  postInstall = ''
    mkdir -p $out/share/icons/hicolor/scalable/apps
    cp -p -T ./media/retroarch.svg $out/share/icons/hicolor/scalable/apps/retroarch.svg

    mkdir -p "$out/share/applications"
    cp ${desktopItem}/share/applications/* $out/share/applications
  '';

  enableParallelBuilding = true;

  meta = {
    homepage = http://libretro.org/;
    description = "Multi-platform emulator frontend for libretro cores";
    license = licenses.gpl3;
    platforms = platforms.all;
    maintainers = with maintainers; [ MP2E edwtjo matthewbauer ];
  };
}