zfs_unstable: 2.3.0-rc3 -> 2.3.0-rc4 (#365045)
[NixPkgs.git] / pkgs / games / speed-dreams / default.nix
blob520439b2321b0a9384e7e158c3dd7e6b4830560f
2   fetchurl,
3   lib,
4   stdenv,
5   libGLU,
6   libGL,
7   libglut,
8   libX11,
9   plib,
10   openal,
11   freealut,
12   libXrandr,
13   xorgproto,
14   libXext,
15   libSM,
16   libICE,
17   libXi,
18   libXt,
19   libXrender,
20   libXxf86vm,
21   openscenegraph,
22   expat,
23   libpng,
24   zlib,
25   bash,
26   SDL2,
27   SDL2_mixer,
28   enet,
29   libjpeg,
30   cmake,
31   pkg-config,
32   libvorbis,
33   runtimeShell,
34   curl,
35   copyDesktopItems,
36   makeDesktopItem,
39 let
40   version = "2.3.0-r8786";
41   shortVersion = builtins.substring 0 5 version;
43 stdenv.mkDerivation rec {
44   inherit version;
45   pname = "speed-dreams";
47   src = fetchurl {
48     url = "mirror://sourceforge/speed-dreams/${shortVersion}/speed-dreams-src-base-${version}.tar.xz";
49     sha256 = "sha256-DUyMs9Hr1PYgmNVwBY/e6snVeGl9GX0AnZ7S+TFABKQ=";
50   };
52   cars-and-tracks = fetchurl {
53     url = "mirror://sourceforge/speed-dreams/${shortVersion}/speed-dreams-src-hq-cars-and-tracks-${version}.tar.xz";
54     sha256 = "sha256-WT+W6uuw4BRSbF1Cw123q3v9qSCvBQ7TcQ/Y0RV/7Js=";
55   };
57   more-cars-and-tracks = fetchurl {
58     url = "mirror://sourceforge/speed-dreams/${shortVersion}/speed-dreams-src-more-hq-cars-and-tracks-${version}.tar.xz";
59     sha256 = "sha256-psApv+Z1HDFvh5bzt125mo/ZvO5rjee/KhOf45iKnKk=";
60   };
62   wip-cars-and-tracks = fetchurl {
63     url = "mirror://sourceforge/speed-dreams/${shortVersion}/speed-dreams-src-wip-cars-and-tracks-${version}.tar.xz";
64     sha256 = "sha256-OEAbqFfO2PzHP7+eAtPNn3Ql6fYNTKzzQW8lHe9KDXM=";
65   };
67   sourceRoot = ".";
69   postUnpack = ''
70     echo Unpacking data
71     tar -xf ${cars-and-tracks}
72     tar -xf ${more-cars-and-tracks}
73     tar -xf ${wip-cars-and-tracks}
74   '';
76   preBuild = ''
77     make -C src/libs/portability
78     make -C src/libs/portability portability.o
79     ar -rv "$(echo lib*/games/speed-dreams*/lib)"/libportability_static.a src/libs/portability/CMakeFiles/portability.dir/portability.cpp.o
80     export NIX_LDFLAGS="$NIX_LDFLAGS -L$(echo $PWD/lib*/games/speed-dreams*/lib) -lexpat"
81     echo "libportability_static.a built"
82   '';
84   postInstall = ''
85     mkdir "$out/bin"
86     for i in "$out"/games/*; do
87       echo '#!${runtimeShell}' >> "$out/bin/$(basename "$i")"
88       echo "$i"' "$@"' >> "$out/bin/$(basename "$i")"
89       chmod a+x "$out/bin/$(basename "$i")"
90     done
92     mkdir -p $out/share/pixmaps/
93     ln -s "$out/share/games/speed-dreams-2/data/icons/icon.png" "$out/share/pixmaps/speed-dreams-2.png"
94   '';
96   desktopItems = [
97     (makeDesktopItem {
98       name = "Speed Dreams 2";
99       exec = "speed-dreams-2";
100       icon = "speed-dreams-2.png";
101       desktopName = "speed-dreams-2";
102       comment = "The Open Racing Car Simulator Fork";
103       categories = [
104         "Application"
105         "Game"
106       ];
107     })
108   ];
110   # RPATH of binary /nix/store/.../lib64/games/speed-dreams-2/drivers/shadow_sc/shadow_sc.so contains a forbidden reference to /build/
111   cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=ON" ];
113   nativeBuildInputs = [
114     pkg-config
115     cmake
116     copyDesktopItems
117   ];
119   buildInputs = [
120     libpng
121     libGLU
122     libGL
123     libglut
124     libX11
125     plib
126     openal
127     freealut
128     libXrandr
129     xorgproto
130     libXext
131     libSM
132     libICE
133     libXi
134     libXt
135     libXrender
136     libXxf86vm
137     zlib
138     bash
139     expat
140     SDL2
141     SDL2_mixer
142     enet
143     libjpeg
144     openscenegraph
145     libvorbis
146     curl
147   ];
149   meta = {
150     description = "Car racing game - TORCS fork with more experimental approach";
151     homepage = "https://speed-dreams.sourceforge.net/";
152     license = lib.licenses.gpl2Plus;
153     maintainers = with lib.maintainers; [ raskin ];
154     platforms = lib.platforms.linux;
155     hydraPlatforms = [ ];
156   };