1{ lib, stdenv, fetchurl, libGLU, libGL, SDL, SDL_mixer, SDL_image, SDL_ttf }:
2
3stdenv.mkDerivation rec {
4 # pf5234 (a developer?) at freenode #egoboo told me that I better use 2.7.3 until
5 # they fix more, because it even has at least one bugs less than 2.7.4.
6 # 2.8.0 does not start properly on linux
7 # They just starting making that 2.8.0 work on linux.
8 pname = "egoboo";
9 version = "2.7.3";
10
11 src = fetchurl {
12 url = "mirror://sourceforge/egoboo/egoboo-${version}.tar.gz";
13 sha256 = "18cjgp9kakrsa90jcb4cl8hhh9k57mi5d1sy5ijjpd3p7zl647hd";
14 };
15
16 buildPhase = ''
17 cd source
18 make -C enet all
19 # The target 'all' has trouble
20 make -C game -f Makefile.unix egoboo
21 '';
22
23 # The user will need to have all the files in '.' to run egoboo, with
24 # writeable controls.txt and setup.txt
25 installPhase = ''
26 mkdir -p $out/share/egoboo-${version}
27 cp -v game/egoboo $out/share/egoboo-${version}
28 cd ..
29 cp -v -Rd controls.txt setup.txt players modules basicdat $out/share/egoboo-${version}
30 '';
31
32 buildInputs = [ libGLU libGL SDL SDL_mixer SDL_image SDL_ttf ];
33
34 /*
35 This big commented thing may be needed for versions 2.8.0 or beyond
36 I keep it here for future updates.
37
38 # Some files have to go to $HOME, but we put them in the 'shared'.
39 patchPhase = ''
40 sed -i -e 's,''${HOME}/.''${PROJ_NAME},''${PREFIX}/share/games/''${PROJ_NAME},g' Makefile
41 '';
42
43 preBuild = ''
44 makeFlags=PREFIX=$out
45 '';
46 */
47
48 # Workaround build failure on -fno-common toolchains like upstream
49 # gcc-10. Otherwise build fails as:
50 # ld: mad.o:(.bss+0x233800): multiple definition of `tile_dict'; camera.o:(.bss+0x140): first defined here
51 env.NIX_CFLAGS_COMPILE = "-fcommon";
52
53 NIX_LDFLAGS = "-lm";
54
55 meta = {
56 description = "3D dungeon crawling adventure";
57
58 homepage = "https://egoboo.sourceforge.net/";
59 license = lib.licenses.gpl2Plus;
60
61 # I take it out of hydra as it does not work as well as I'd like
62 # maintainers = [ ];
63 # platforms = lib.platforms.all;
64 };
65}