2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeDesktopItem, makeWrapper, premake4, unzip
|
2020-04-24 23:36:52 +00:00
|
|
|
, openal, libpng, libvorbis, libGLU, SDL2, SDL2_image, SDL2_ttf }:
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "tome4";
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "1.7.4";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://te4.org/dl/t-engine/t-engine4-src-${version}.tar.bz2";
|
2021-09-18 10:52:07 +00:00
|
|
|
sha256 = "sha256-w1NPM/SMnPAnAl6z9E6Xsj3mEqZtXzFe1IMPmlKr8qQ=";
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
desktop = makeDesktopItem {
|
|
|
|
desktopName = pname;
|
|
|
|
name = pname;
|
|
|
|
exec = "@out@/bin/${pname}";
|
|
|
|
icon = pname;
|
|
|
|
comment = "An open-source, single-player, role-playing roguelike game set in the world of Eyal.";
|
|
|
|
type = "Application";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Game" "RolePlaying" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
genericName = pname;
|
|
|
|
};
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
# http://forums.te4.org/viewtopic.php?f=42&t=49478&view=next#p234354
|
|
|
|
sed -i 's|#include <GL/glext.h>||' src/tgl.h
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper unzip premake4 ];
|
|
|
|
|
|
|
|
# tome4 vendors quite a few libraries so someone might want to look
|
|
|
|
# into avoiding that...
|
|
|
|
buildInputs = [
|
|
|
|
libGLU openal libpng libvorbis SDL2 SDL2_ttf SDL2_image
|
|
|
|
];
|
|
|
|
|
|
|
|
# disable parallel building as it caused sporadic build failures
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-I${SDL2.dev}/include/SDL2 -I${SDL2_image}/include/SDL2 -I${SDL2_ttf}/include/SDL2";
|
|
|
|
|
|
|
|
makeFlags = [ "config=release" ];
|
|
|
|
|
|
|
|
# The wrapper needs to cd into the correct directory as tome4's detection of
|
|
|
|
# the game asset root directory is faulty.
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
dir=$out/share/${pname}
|
|
|
|
|
|
|
|
install -Dm755 t-engine $dir/t-engine
|
|
|
|
cp -r bootstrap game $dir
|
|
|
|
makeWrapper $dir/t-engine $out/bin/${pname} \
|
2022-04-27 09:35:20 +00:00
|
|
|
--chdir "$dir"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
install -Dm755 ${desktop}/share/applications/${pname}.desktop $out/share/applications/${pname}.desktop
|
|
|
|
substituteInPlace $out/share/applications/${pname}.desktop \
|
|
|
|
--subst-var out
|
|
|
|
|
|
|
|
unzip -oj -qq game/engines/te4-${version}.teae data/gfx/te4-icon.png
|
|
|
|
install -Dm644 te4-icon.png $out/share/icons/hicolor/64x64/${pname}.png
|
|
|
|
|
|
|
|
install -Dm644 -t $out/share/doc/${pname} CONTRIBUTING COPYING COPYING-MEDIA CREDITS
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tales of Maj'eyal (rogue-like game)";
|
|
|
|
homepage = "https://te4.org/";
|
|
|
|
license = licenses.gpl3;
|
|
|
|
maintainers = with maintainers; [ chattered peterhoeg ];
|
|
|
|
platforms = with platforms; [ "i686-linux" "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|