1 { lib, stdenv, fetchurl, makeDesktopItem, makeWrapper, premake4, unzip
2 , openal, libpng, libvorbis, libGLU, SDL2, SDL2_image, SDL2_ttf }:
4 stdenv.mkDerivation rec {
9 url = "https://te4.org/dl/t-engine/t-engine4-src-${version}.tar.bz2";
10 sha256 = "sha256-mJ3qAIA/jNyt4CT0ZH1IC7GsDUN8JUKSwHVJwnKkaAw=";
13 desktop = makeDesktopItem {
16 exec = "@out@/bin/${pname}";
18 comment = "An open-source, single-player, role-playing roguelike game set in the world of Eyal.";
20 categories = [ "Game" "RolePlaying" ];
25 # http://forums.te4.org/viewtopic.php?f=42&t=49478&view=next#p234354
26 sed -i 's|#include <GL/glext.h>||' src/tgl.h
29 nativeBuildInputs = [ makeWrapper unzip premake4 ];
31 # tome4 vendors quite a few libraries so someone might want to look
32 # into avoiding that...
34 libGLU openal libpng libvorbis SDL2 SDL2_ttf SDL2_image
37 # disable parallel building as it caused sporadic build failures
38 enableParallelBuilding = false;
40 env.NIX_CFLAGS_COMPILE = "-I${SDL2.dev}/include/SDL2 -I${SDL2_image}/include/SDL2 -I${SDL2_ttf}/include/SDL2";
42 makeFlags = [ "config=release" ];
44 # The wrapper needs to cd into the correct directory as tome4's detection of
45 # the game asset root directory is faulty.
50 dir=$out/share/${pname}
52 install -Dm755 t-engine $dir/t-engine
53 cp -r bootstrap game $dir
54 makeWrapper $dir/t-engine $out/bin/${pname} \
57 install -Dm755 ${desktop}/share/applications/${pname}.desktop $out/share/applications/${pname}.desktop
58 substituteInPlace $out/share/applications/${pname}.desktop \
61 unzip -oj -qq game/engines/te4-${version}.teae data/gfx/te4-icon.png
62 install -Dm644 te4-icon.png $out/share/icons/hicolor/64x64/${pname}.png
64 install -Dm644 -t $out/share/doc/${pname} CONTRIBUTING COPYING COPYING-MEDIA CREDITS
70 description = "Tales of Maj'eyal (rogue-like game)";
71 homepage = "https://te4.org/";
72 license = licenses.gpl3;
73 maintainers = with maintainers; [ peterhoeg ];
74 platforms = [ "i686-linux" "x86_64-linux" ];