1{ lib
2, stdenv
3, fetchpatch
4, fetchurl
5, unzip
6, gdc
7, SDL
8, SDL_mixer
9, bulletml
10}:
11
12let
13debianPatch = patchname: hash: fetchpatch {
14 name = "${patchname}.patch";
15 url = "https://sources.debian.org/data/main/t/torus-trooper/0.22.dfsg1-12/debian/patches/${patchname}.patch";
16 sha256 = hash;
17};
18
19in stdenv.mkDerivation rec {
20 pname = "torus-trooper";
21 version = "0.22";
22
23 src = fetchurl {
24 url = "http://abagames.sakura.ne.jp/windows/tt${lib.replaceStrings ["."] ["_"] version}.zip";
25 sha256 = "1yhki1fdp3fi4y2iq12vca69f6k38dqjaw9z4lwcxky5kbgb7jvg";
26 };
27
28 patches = [
29 (debianPatch
30 "imports"
31 "0mifw0mj66zljpq6iqnh0rhkgs2sky8rz0p32k98vxfnsb39ibsf")
32 (debianPatch
33 "fixes"
34 "05f93zq2v14lymq748c9g646ckbh9mqpr5rrahb63s90x8hlcqil")
35 (debianPatch
36 "directories"
37 "0y5xvf26v9fk0rx6ncrxx4czckhjbi891hp3pixlmv568pg9cihd")
38 (debianPatch
39 "windowed"
40 "1d8ghj4shvpb0s8l16kscz4l7rz1fxmfdpddy1ikz3678pw1sc8p")
41 (debianPatch
42 "dotfile"
43 "17yirmnjhbd1clzhmdd2mfdhbxkyinaahd6v3yz5kzbcylvjz2r2")
44 (debianPatch
45 "window-resizing"
46 "1n64gbhabl6vis7s294wxlj2k8s3ypxljpdg71icwz1m9jjx59df")
47 (debianPatch
48 "save-score-444372"
49 "1skny6s3hjxkh8w4fq86vp51j7z40fvn80b8myl4i1zzlwag3x17")
50 (debianPatch
51 "level-select-444948"
52 "008248s55188plggg2kg01nimjgc7w0sqd3c22sl6lzd1fjsflv8")
53 (debianPatch
54 "avoid-segfault-when-sdl-fails"
55 "1yp758gi4i15gqk6wiqp815rqcmlyqx62ir1sw20hn6zb3j97bmc")
56 (debianPatch
57 "dlang_v2"
58 "1lxsbckhvl8a8j43pw2dyl5nlavvdbgxb5zlb2450a0vml55nswd")
59 (debianPatch
60 "lowest-level-position-602808"
61 "19r48wirc9zssjmv57drn2fd0f56dcgyqqaz3j49cvv6yd74qf20")
62 (debianPatch
63 "libbulletml0v5-segfault"
64 "0pad2daz60hswkhkdpssxaqc9p9ca0sw1nraqzr453x0zdwwq0hn")
65 (debianPatch
66 "std.math.fabs"
67 "18xnnqlj20bxv2h9fa8dn4rmxwi3k6y3g50kwvh8i8p3b4hgag3r")
68 (debianPatch
69 "gdc-8"
70 "10z702y75c48hjcnvv8m7f3ka52cj3r3jqafdbby85nb0p2lbssx")
71 ];
72
73 postPatch = ''
74 for f in src/abagames/tt/barrage.d src/abagames/util/sdl/sound.d src/abagames/util/sdl/texture.d; do
75 substituteInPlace $f \
76 --replace "/usr/" "$out/"
77 done
78 '';
79
80 nativeBuildInputs = [
81 unzip
82 gdc
83 ];
84
85 buildInputs = [
86 SDL
87 SDL_mixer
88 bulletml
89 ];
90
91 installPhase = ''
92 install -Dm755 torus-trooper $out/bin/torus-trooper
93 mkdir -p $out/share/games/torus-trooper
94 cp -r barrage sounds images $out/share/games/torus-trooper/
95 '';
96
97 meta = with lib; {
98 homepage = "http://www.asahi-net.or.jp/~cs8k-cyu/windows/tt_e.html";
99 description = "Fast-paced abstract scrolling shooter game";
100 license = licenses.bsd2;
101 maintainers = with maintainers; [ fgaz ];
102 platforms = platforms.all;
103 };
104}