summary refs log tree commit diff
path: root/pkgs/games/zdoom/default.nix
blob: f6fde241129b13215fa97ce22f54f80a454f4a44 (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
{ stdenv, fetchurl, p7zip, cmake
, SDL2, openal, fluidsynth, soundfont-fluid, bzip2, zlib, libjpeg, game-music-emu
, libsndfile, mpg123 }:

stdenv.mkDerivation rec {
  pname = "zdoom";
  majorVersion = "2.8";
  version = "${majorVersion}.1";

  src = fetchurl {
    url = "https://zdoom.org/files/zdoom/${majorVersion}/zdoom-${version}-src.7z";
    sha256 = "0453fqrh9l00xwphfxni5qkf9y134n3s1mr1dvi5cbkxcva7j8bq";
  };

  nativeBuildInputs = [ p7zip cmake ];
  buildInputs = [
    SDL2 openal fluidsynth bzip2 zlib libjpeg game-music-emu libsndfile mpg123
  ];

  cmakeFlags = [
    "-DFORCE_INTERNAL_GME=OFF"
    "-DGME_INCLUDE_DIR=${game-music-emu}/include"
    "-DGME_LIBRARIES=${game-music-emu}/lib/libgme.so"
  ];

  sourceRoot = ".";

  enableParallelBuilding = true;

  NIX_CFLAGS_LINK = [ "-lopenal" "-lfluidsynth" ];

  preConfigure = ''
    sed -i \
      -e "s@/usr/share/sounds/sf2/@${soundfont-fluid}/share/soundfonts/@g" \
      -e "s@FluidR3_GM.sf2@FluidR3_GM2-2.sf2@g" \
      src/sound/music_fluidsynth_mididevice.cpp
  '';

  installPhase = ''
    install -Dm755 zdoom "$out/lib/zdoom/zdoom"
    for i in *.pk3; do
      install -Dm644 "$i" "$out/lib/zdoom/$i"
    done
    mkdir -p $out/bin
    ln -s $out/lib/zdoom/zdoom $out/bin/zdoom
  '';

  meta = with stdenv.lib; {
    homepage = http://zdoom.org/;
    description = "Enhanced port of the official DOOM source code";
    # Doom source license, MAME license
    license = licenses.unfreeRedistributable;
    platforms = platforms.linux;
    maintainers = with maintainers; [ lassulus ];
  };
}