about summary refs log tree commit diff
path: root/pkgs/games/widelands/default.nix
blob: 324f388e716e96e4c0352037393a7546b00109f1 (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
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, pkg-config # needed to find minizip
, SDL2
, SDL2_image
, SDL2_mixer
, SDL2_net
, SDL2_ttf
, cmake
, curl
, doxygen
, gettext
, glew
, graphviz
, icu
, installShellFiles
, libpng
, lua
, python3
, zlib
, minizip
, asio
, libSM
, libICE
, libXext
}:

stdenv.mkDerivation rec {
  pname = "widelands";
  version = "1.2";

  src = fetchFromGitHub {
    owner = "widelands";
    repo = "widelands";
    rev = "v${version}";
    sha256 = "sha256-V7eappIMEQMNbf9EGQhv71Fwz0wH679ifi/qAHWwMNU=";
  };

  postPatch = ''
    substituteInPlace xdg/org.widelands.Widelands.desktop \
      --replace 'Exec=widelands' "Exec=$out/bin/widelands"
  '';

  cmakeFlags = [
    "-Wno-dev" # dev warnings are only needed for upstream development
    "-DCMAKE_BUILD_TYPE=Release"
    "-DWL_INSTALL_BASEDIR=${placeholder "out"}/share/widelands" # for COPYING, Changelog, etc.
    "-DWL_INSTALL_DATADIR=${placeholder "out"}/share/widelands" # for game data
    "-DWL_INSTALL_BINDIR=${placeholder "out"}/bin"
  ];

  nativeBuildInputs = [ cmake doxygen gettext graphviz installShellFiles pkg-config ];

  enableParallelBuilding = true;

  buildInputs = [
    SDL2
    SDL2_image
    SDL2_mixer
    SDL2_net
    SDL2_ttf
    curl
    glew
    icu
    libpng
    lua
    python3
    zlib
    minizip
    asio
    libSM  # XXX: these should be propagated by SDL2?
    libICE
    libXext
  ];

  postInstall = ''
    install -Dm444 -t $out/share/applications ../xdg/org.widelands.Widelands.desktop

    for s in 16 32 48 64 128; do
      install -Dm444 ../data/images/logos/wl-ico-''${s}.png $out/share/icons/hicolor/''${s}x''${s}/org.widelands.Widelands.png
    done

    installManPage ../xdg/widelands.6
  '';

  meta = with lib; {
    description = "RTS with multiple-goods economy";
    homepage = "https://widelands.org/";
    longDescription = ''
      Widelands is a real time strategy game based on "The Settlers" and "The
      Settlers II". It has a single player campaign mode, as well as a networked
      multiplayer mode.
    '';
    changelog = "https://github.com/widelands/widelands/releases/tag/v${version}";
    mainProgram = "widelands";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ raskin jcumming ];
    platforms = platforms.linux;
    hydraPlatforms = [ ];
  };
}