summary refs log tree commit diff
path: root/pkgs/games/doom-ports/gzdoom/default.nix
blob: 768a4936d821f1c132e416fa318931af95b39eaf (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
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, SDL2
, bzip2
, cmake
, fluidsynth
, game-music-emu
, gtk3
, imagemagick
, libGL
, libjpeg
, libsndfile
, libvpx
, libwebp
, mpg123
, ninja
, openal
, pkg-config
, vulkan-loader
, zlib
, zmusic
}:

stdenv.mkDerivation rec {
  pname = "gzdoom";
  version = "4.11.3";

  src = fetchFromGitHub {
    owner = "ZDoom";
    repo = "gzdoom";
    rev = "g${version}";
    fetchSubmodules = true;
    hash = "sha256-pY+5R3W/9pJGiBoDFkxxpuP0I2ZLb+Q/s5UYU20G748=";
  };

  outputs = [ "out" "doc" ];

  nativeBuildInputs = [
    cmake
    copyDesktopItems
    imagemagick
    makeWrapper
    ninja
    pkg-config
  ];

  buildInputs = [
    SDL2
    bzip2
    fluidsynth
    game-music-emu
    gtk3
    libGL
    libjpeg
    libsndfile
    libvpx
    libwebp
    mpg123
    openal
    vulkan-loader
    zlib
    zmusic
  ];

  postPatch = ''
    substituteInPlace tools/updaterevision/UpdateRevision.cmake \
      --replace "ret_var(Tag)" "ret_var(\"${src.rev}\")" \
      --replace "ret_var(Timestamp)" "ret_var(\"1970-00-00 00:00:00 +0000\")" \
      --replace "ret_var(Hash)" "ret_var(\"${src.rev}\")"
  '';

  cmakeFlags = [
    "-DDYN_GTK=OFF"
    "-DDYN_OPENAL=OFF"
  ];

  desktopItems = [
    (makeDesktopItem {
      name = "gzdoom";
      exec = "gzdoom";
      desktopName = "GZDoom";
      comment = meta.description;
      icon = "gzdoom";
      categories = [ "Game" ];
    })
  ];

  postInstall = ''
    mv $out/bin/gzdoom $out/share/games/doom/gzdoom
    makeWrapper $out/share/games/doom/gzdoom $out/bin/gzdoom

    for size in 16 24 32 48 64 128; do
      mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
      convert -background none -resize "$size"x"$size" $src/src/win32/icon1.ico -flatten \
        $out/share/icons/hicolor/"$size"x"$size"/apps/gzdoom.png
    done;
  '';

  meta = with lib; {
    homepage = "https://github.com/ZDoom/gzdoom";
    description = "Modder-friendly OpenGL and Vulkan source port based on the DOOM engine";
    longDescription = ''
      GZDoom is a feature centric port for all DOOM engine games, based on
      ZDoom, adding an OpenGL renderer and powerful scripting capabilities.
    '';
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
    maintainers = with maintainers; [ azahi lassulus ];
  };
}