about summary refs log tree commit diff
path: root/pkgs/games/openlierox/default.nix
blob: f1fa65c403de1a9f1aed1871c454dc12424fd21b (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
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  pkg-config,
  curl,
  gd,
  libX11,
  libxml2,
  libzip,
  SDL,
  SDL_image,
  SDL_mixer,
  zlib,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "openlierox";
  version = "0.58_rc5";

  src = fetchFromGitHub {
    owner = "albertz";
    repo = "openlierox";
    rev = finalAttrs.version;
    hash = "sha256-4ofjroEHlfrQitc7M+YTNWut0LGgntgQoOeBWU8nscY=";
  };

  postPatch = ''
    sed 1i'#include <cstdint>' -i src/common/s*x.cpp
    sed 1i'#include <libxml/parser.h>' -i include/XMLutils.h
    substituteInPlace src/common/StringUtils.cpp \
        --replace-fail "xmlErrorPtr" "const xmlError*"
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    pkg-config
    SDL
  ];

  buildInputs = [
    curl
    gd
    libX11
    libxml2
    libzip
    SDL
    SDL_image
    SDL_mixer
    zlib
  ];

  cmakeFlags = [ "-DSYSTEM_DATA_DIR=${placeholder "out"}/share" ];

  env.NIX_CFLAGS_COMPILE = "-I${lib.getDev libxml2}/include/libxml2";

  installPhase = ''
    runHook preInstall

    install -Dm755 bin/* -t $out/bin

    mkdir -p $out/share/OpenLieroX
    cp -r ../share/gamedir/* $out/share/OpenLieroX

    runHook postInstall
  '';

  meta = {
    description = "Real-time game with Worms-like shooting";
    homepage = "http://openlierox.net";
    license = lib.licenses.lgpl2Plus;
    mainProgram = "openlierox";
    maintainers = with lib.maintainers; [ tomasajt ];
    platforms = lib.platforms.linux;
  };
})