about summary refs log tree commit diff
path: root/pkgs/games/humblebundle/spaz.nix
blob: 24d32e53db3836cc3556aa6d25223e08e27dae30 (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
{ stdenv, fetchHumbleBundle, unzip, pkgsi686Linux }:

stdenv.mkDerivation rec {
  name = "spaz-${version}";
  version = "09182012";

  src = fetchHumbleBundle {
    name = "spaz-linux-humblebundle-${version}-bin";
    md5 = "9b2f28009949f2dff9f3a737e46fabfd";
  };

  buildInputs = [ pkgsi686Linux.makeWrapper ];

  unpackCmd = ''
    ${unzip}/bin/unzip -qq "$src" 'data/*' || true
  '';

  dontStrip = true;

  buildPhase = let
    libs = pkgsi686Linux.stdenv.lib.makeLibraryPath [
      pkgsi686Linux.stdenv.cc.cc pkgsi686Linux.SDL
    ];
  in ''
    patchelf --set-interpreter "${pkgsi686Linux.glibc}"/lib/ld-linux.so.* \
             --set-rpath "${libs}" SPAZ
  '';

  installPhase = let
    libs = pkgsi686Linux.stdenv.lib.makeLibraryPath [
      pkgsi686Linux.libGL pkgsi686Linux.openal pkgsi686Linux.alsaPlugins
    ];
  in ''
    install -vD SPAZ "$out/libexec/spaz/spaz"
    cp -rt "$out/libexec/spaz" audio.so common game mods
    makeWrapper "$out/libexec/spaz/spaz" "$out/bin/spaz" \
      --set LD_LIBRARY_PATH "${libs}"
  '';
}