about summary refs log tree commit diff
path: root/pkgs/games/ecwolf/default.nix
blob: 8bbbc53a0dcdb8b144a0b1c657b4a0b0699bafac (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
{ stdenv
, lib
, fetchFromBitbucket
, cmake
, pkg-config
, makeWrapper
, zlib
, bzip2
, libjpeg
, SDL2
, SDL2_net
, SDL2_mixer
, gtk3
}:

stdenv.mkDerivation rec {
  pname = "ecwolf";
  version = "1.4.1";

  src = fetchFromBitbucket {
    owner = pname;
    repo = pname;
    rev = version;
    sha256 = "V2pSP8i20zB50WtUMujzij+ISSupdQQ/oCYYrOaTU1g=";
  };

  nativeBuildInputs = [ cmake pkg-config ]
    ++ lib.optionals stdenv.isDarwin [ makeWrapper ];
  buildInputs = [ zlib bzip2 libjpeg SDL2 SDL2_net SDL2_mixer gtk3 ];

  NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework AppKit";

  # ECWolf installs its binary to the games/ directory, but Nix only adds bin/
  # directories to the PATH.
  postInstall = lib.optionalString stdenv.isLinux ''
    mv "$out/games" "$out/bin"
  '' + lib.optionalString stdenv.isDarwin ''
    mkdir -p $out/{Applications,bin}
    cp -R ecwolf.app $out/Applications
    makeWrapper $out/{Applications/ecwolf.app/Contents/MacOS,bin}/ecwolf
  '';

  meta = with lib; {
    description = "Enhanched SDL-based port of Wolfenstein 3D for various platforms";
    mainProgram = "ecwolf";
    homepage = "https://maniacsvault.net/ecwolf/";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ jayman2000 sander ];
    platforms = platforms.all;
  };
}