1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 asciidoctor,
6 cmake,
7 doxygen,
8 pkg-config,
9 alsa-lib,
10 flac,
11 fluidsynth,
12 fmt,
13 freetype,
14 glib,
15 harfbuzz,
16 lhasa,
17 libdecor,
18 liblcf,
19 libpng,
20 libsndfile,
21 libsysprof-capture,
22 libvorbis,
23 libXcursor,
24 libXext,
25 libXi,
26 libXinerama,
27 libxmp,
28 libXrandr,
29 libXScrnSaver,
30 libXxf86vm,
31 mpg123,
32 nlohmann_json,
33 opusfile,
34 pcre2,
35 pixman,
36 sdl3,
37 speexdsp,
38 wildmidi,
39 zlib,
40}:
41
42stdenv.mkDerivation rec {
43 pname = "easyrpg-player";
44 # liblcf needs to be updated before this.
45 version = "0.8.1.1";
46
47 src = fetchFromGitHub {
48 owner = "EasyRPG";
49 repo = "Player";
50 rev = version;
51 hash = "sha256-fYSpFhqETkQhRK1/Uws0fWWdCr35+1J4vCPX9ZiQ3ZA=";
52 };
53
54 strictDeps = true;
55
56 nativeBuildInputs = [
57 asciidoctor
58 cmake
59 doxygen
60 pkg-config
61 ];
62
63 buildInputs = [
64 flac # needed by libsndfile
65 fluidsynth
66 fmt
67 freetype
68 glib
69 harfbuzz
70 lhasa
71 liblcf
72 libpng
73 libsndfile
74 libsysprof-capture # needed by glib
75 libvorbis
76 libxmp
77 mpg123
78 nlohmann_json
79 opusfile
80 pcre2 # needed by glib
81 pixman
82 sdl3
83 speexdsp
84 wildmidi
85 zlib
86 ]
87 ++ lib.optionals stdenv.hostPlatform.isLinux [
88 alsa-lib
89 libXcursor
90 libXext
91 libXi
92 libXinerama
93 libXrandr
94 libXScrnSaver
95 libXxf86vm
96 libdecor
97 ];
98
99 cmakeFlags = [
100 "-DPLAYER_ENABLE_TESTS=${lib.boolToString doCheck}"
101 # TODO: remove the below once SDL3 becomes default next major release
102 "-DPLAYER_TARGET_PLATFORM=SDL3"
103 ];
104
105 makeFlags = [
106 "all"
107 "man"
108 ];
109
110 buildFlags = lib.optionals doCheck [
111 "test_runner_player"
112 ];
113
114 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
115 mkdir $out/bin
116 mv Package $out/Applications
117 ln -s $out/{Applications/EasyRPG\ Player.app/Contents/MacOS,bin}/EasyRPG\ Player
118 '';
119
120 enableParallelChecking = true;
121 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
122
123 meta = with lib; {
124 description = "RPG Maker 2000/2003 and EasyRPG games interpreter";
125 homepage = "https://easyrpg.org/";
126 license = licenses.gpl3Plus;
127 maintainers = [ ];
128 platforms = platforms.all;
129 mainProgram = lib.optionalString stdenv.hostPlatform.isDarwin "EasyRPG Player";
130 };
131}