summary refs log tree commit diff
path: root/pkgs/games/easyrpg-player/default.nix
blob: ea68c3a110e2148a1eadbf4b25a7ab3c528efce4 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, doxygen
, pkg-config
, freetype
, fmt
, glib
, harfbuzz
, liblcf
, libpng
, libsndfile
, libvorbis
, libxmp
, libXcursor
, libXext
, libXi
, libXinerama
, libXrandr
, libXScrnSaver
, libXxf86vm
, mpg123
, opusfile
, pcre
, pixman
, SDL2
, speexdsp
, wildmidi
, zlib
, libdecor
, alsa-lib
, asciidoctor
, Foundation
, AudioUnit
, AudioToolbox
}:

stdenv.mkDerivation rec {
  pname = "easyrpg-player";
  version = "0.8";

  src = fetchFromGitHub {
    owner = "EasyRPG";
    repo = "Player";
    rev = version;
    hash = "sha256-t0sa9ONVVfsiTy+us06vU2bMa4QmmQeYxU395g0WS6w=";
  };

  patches = [
    # Fixed compatibility with fmt > 9
    # Remove when version > 0.8
    (fetchpatch {
      name = "0001-Fix-building-with-fmtlib-10.patch";
      url = "https://github.com/EasyRPG/Player/commit/ab6286f6d01bada649ea52d1f0881dde7db7e0cf.patch";
      hash = "sha256-GdSdVFEG1OJCdf2ZIzTP+hSrz+ddhTMBvOPjvYQHy54=";
    })
  ];

  strictDeps = true;

  nativeBuildInputs = [
    asciidoctor
    cmake
    doxygen
    pkg-config
  ];

  buildInputs = [
    fmt
    freetype
    glib
    harfbuzz
    liblcf
    libpng
    libsndfile
    libvorbis
    libxmp
    mpg123
    opusfile
    pcre
    pixman
    SDL2
    speexdsp
    zlib
  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
    alsa-lib
    libXcursor
    libXext
    libXi
    libXinerama
    libXrandr
    libXScrnSaver
    libXxf86vm
    libdecor
    wildmidi # until packaged on Darwin
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
    Foundation
    AudioUnit
    AudioToolbox
  ];

  cmakeFlags = [
    "-DPLAYER_ENABLE_TESTS=${lib.boolToString doCheck}"
  ];

  makeFlags = [
    "all"
    "man"
  ];

  buildFlags = lib.optionals doCheck [
    "test_runner_player"
  ];

  postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
    mkdir $out/bin
    mv Package $out/Applications
    ln -s $out/{Applications/EasyRPG\ Player.app/Contents/MacOS,bin}/EasyRPG\ Player
  '';

  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

  enableParallelChecking = true;

  meta = with lib; {
    description = "RPG Maker 2000/2003 and EasyRPG games interpreter";
    homepage = "https://easyrpg.org/";
    license = licenses.gpl3;
    maintainers = with maintainers; [ yana ];
    platforms = platforms.all;
    mainProgram = lib.optionalString stdenv.hostPlatform.isDarwin "EasyRPG Player";
  };
}