about summary refs log tree commit diff
path: root/pkgs/games/torcs/default.nix
blob: 476495bf88384776a55065c22a2182eff142e2b6 (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
{ fetchpatch, fetchurl, lib, stdenv, libGLU, libglut, libX11, plib, openal, freealut, libXrandr, xorgproto,
libXext, libSM, libICE, libXi, libXt, libXrender, libXxf86vm, libvorbis,
libpng, zlib, makeWrapper }:

stdenv.mkDerivation rec {
  pname = "torcs";
  version = "1.3.7";

  src = fetchurl {
    url = "mirror://sourceforge/torcs/torcs-${version}.tar.bz2";
    sha256 = "0kdq0sc7dsfzlr0ggbxggcbkivc6yp30nqwjwcaxg9295s3b06wa";
  };

  patches = [
    (fetchpatch {
      url = "https://salsa.debian.org/games-team/torcs/raw/fb0711c171b38c4648dc7c048249ec20f79eb8e2/debian/patches/gcc6-isnan.patch";
      sha256 = "16scmq30vwb8429ah9d4ws0v1w6ai59lvn7hcgnvfzyap42ry876";
    })
    (fetchpatch {
      url = "https://salsa.debian.org/games-team/torcs/raw/fb0711c171b38c4648dc7c048249ec20f79eb8e2/debian/patches/format-argument.patch";
      sha256 = "04advcx88yh23ww767iysydzhp370x7cqp2wf9hk2y1qvw7mxsja";
    })
    (fetchpatch {
      url = "https://salsa.debian.org/games-team/torcs/raw/fb0711c171b38c4648dc7c048249ec20f79eb8e2/debian/patches/glibc-default-source.patch";
      sha256 = "0k4hgpddnhv68mdc9ics7ah8q54j60g394d7zmcmzg6l3bjd9pyp";
    })
    (fetchpatch {
      url = "https://salsa.debian.org/games-team/torcs/raw/32bbe77c68b4de07b28c34497f3c0ad666ee618d/debian/patches/gcc7.patch";
      sha256 = "09iilnvdv8h7b4nb1372arszkbz9hbzsck4rimzz1xjdh9ydniw9";
    })
  ];

  postInstall = ''
    install -D -m644 Ticon.png $out/share/pixmaps/torcs.png
    install -D -m644 torcs.desktop $out/share/applications/torcs.desktop
  '';

  postPatch = ''
    sed -i -e s,/bin/bash,`type -P bash`, src/linux/torcs.in
  '';

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ libGLU libglut libX11 plib openal freealut libXrandr xorgproto
    libXext libSM libICE libXi libXt libXrender libXxf86vm libpng zlib libvorbis ];

  installTargets = "install datainstall";

  meta = {
    description = "Car racing game";
    homepage = "https://torcs.sourceforge.net/";
    license = lib.licenses.gpl2Plus;
    maintainers = [ ];
    platforms = lib.platforms.linux;
    hydraPlatforms = [];
  };
}