2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeDesktopItem, makeWrapper, premake4, unzip
|
2018-03-05 11:49:52 +00:00
|
|
|
, openal, libpng, libvorbis, libGLU, SDL2, SDL2_image, SDL2_ttf }:
|
2018-02-25 02:15:13 +00:00
|
|
|
|
2021-06-22 21:44:58 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2018-02-25 02:15:13 +00:00
|
|
|
pname = "tome4";
|
2023-07-12 16:53:04 +00:00
|
|
|
version = "1.7.6";
|
2021-06-22 21:44:58 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://te4.org/dl/t-engine/t-engine4-src-${version}.tar.bz2";
|
2023-07-12 16:53:04 +00:00
|
|
|
sha256 = "sha256-mJ3qAIA/jNyt4CT0ZH1IC7GsDUN8JUKSwHVJwnKkaAw=";
|
2021-06-22 21:44:58 +00:00
|
|
|
};
|
2018-02-25 02:15:13 +00:00
|
|
|
|
|
|
|
desktop = makeDesktopItem {
|
|
|
|
desktopName = pname;
|
|
|
|
name = pname;
|
|
|
|
exec = "@out@/bin/${pname}";
|
2019-09-08 23:38:31 +00:00
|
|
|
icon = pname;
|
2018-02-25 02:15:13 +00:00
|
|
|
comment = "An open-source, single-player, role-playing roguelike game set in the world of Eyal.";
|
|
|
|
type = "Application";
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Game" "RolePlaying" ];
|
2018-02-25 02:15:13 +00:00
|
|
|
genericName = pname;
|
|
|
|
};
|
|
|
|
|
2019-09-14 01:10:11 +00:00
|
|
|
prePatch = ''
|
|
|
|
# http://forums.te4.org/viewtopic.php?f=42&t=49478&view=next#p234354
|
|
|
|
sed -i 's|#include <GL/glext.h>||' src/tgl.h
|
|
|
|
'';
|
|
|
|
|
2018-11-27 22:43:32 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper unzip premake4 ];
|
2018-02-25 02:15:13 +00:00
|
|
|
|
2018-11-27 22:43:32 +00:00
|
|
|
# tome4 vendors quite a few libraries so someone might want to look
|
|
|
|
# into avoiding that...
|
2017-03-04 15:24:46 +00:00
|
|
|
buildInputs = [
|
2018-02-24 12:59:47 +00:00
|
|
|
libGLU openal libpng libvorbis SDL2 SDL2_ttf SDL2_image
|
2017-03-04 15:24:46 +00:00
|
|
|
];
|
2018-02-25 02:15:13 +00:00
|
|
|
|
2018-04-05 12:10:37 +00:00
|
|
|
# disable parallel building as it caused sporadic build failures
|
|
|
|
enableParallelBuilding = false;
|
2018-02-25 02:15:13 +00:00
|
|
|
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-I${SDL2.dev}/include/SDL2 -I${SDL2_image}/include/SDL2 -I${SDL2_ttf}/include/SDL2";
|
2018-02-25 02:15:13 +00:00
|
|
|
|
2015-06-14 16:44:38 +00:00
|
|
|
makeFlags = [ "config=release" ];
|
2018-02-25 02:15:13 +00:00
|
|
|
|
|
|
|
# The wrapper needs to cd into the correct directory as tome4's detection of
|
|
|
|
# the game asset root directory is faulty.
|
|
|
|
|
2015-06-14 16:44:38 +00:00
|
|
|
installPhase = ''
|
2018-02-25 02:15:13 +00:00
|
|
|
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-03-14 18:06:00 +00:00
|
|
|
--chdir "$dir"
|
2018-02-25 02:15:13 +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
|
2015-06-14 16:44:38 +00:00
|
|
|
'';
|
2018-02-25 02:15:13 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2015-06-14 16:44:38 +00:00
|
|
|
description = "Tales of Maj'eyal (rogue-like game)";
|
2020-03-10 00:03:53 +00:00
|
|
|
homepage = "https://te4.org/";
|
2017-03-04 15:24:46 +00:00
|
|
|
license = licenses.gpl3;
|
2022-06-22 23:54:27 +00:00
|
|
|
maintainers = with maintainers; [ peterhoeg ];
|
2022-08-01 16:33:27 +00:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
2015-06-14 16:44:38 +00:00
|
|
|
};
|
|
|
|
}
|