2018-02-25 03:15:13 +01:00
|
|
|
{ stdenv, fetchurl, makeDesktopItem, makeWrapper, premake4, unzip
|
2018-03-05 12:49:52 +01:00
|
|
|
, openal, libpng, libvorbis, libGLU, SDL2, SDL2_image, SDL2_ttf }:
|
2018-02-25 03:15:13 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
pname = "tome4";
|
|
|
|
|
|
|
|
desktop = makeDesktopItem {
|
|
|
|
desktopName = pname;
|
|
|
|
name = pname;
|
|
|
|
exec = "@out@/bin/${pname}";
|
|
|
|
icon = "${pname}";
|
|
|
|
terminal = "False";
|
|
|
|
comment = "An open-source, single-player, role-playing roguelike game set in the world of Eyal.";
|
|
|
|
type = "Application";
|
|
|
|
categories = "Game;RolePlaying;";
|
|
|
|
genericName = pname;
|
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
version = "1.5.5";
|
2015-06-14 18:44:38 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-01-05 20:42:46 +01:00
|
|
|
url = "https://te4.org/dl/t-engine/t-engine4-src-${version}.tar.bz2";
|
2018-02-25 03:15:13 +01:00
|
|
|
sha256 = "0v2qgdfpvdzd1bcbp9v8pfahj1bgczsq2d4xfhh5wg11jgjcwz03";
|
2015-06-14 18:44:38 +02:00
|
|
|
};
|
2018-02-25 03:15:13 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ premake4 makeWrapper unzip ];
|
|
|
|
|
|
|
|
# tome4 vendors quite a few libraries so someone might want to look into avoiding that...
|
2017-03-04 16:24:46 +01:00
|
|
|
buildInputs = [
|
2018-02-24 13:59:47 +01:00
|
|
|
libGLU openal libpng libvorbis SDL2 SDL2_ttf SDL2_image
|
2017-03-04 16:24:46 +01:00
|
|
|
];
|
2018-02-25 03:15:13 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-03-04 16:24:46 +01:00
|
|
|
NIX_CFLAGS_COMPILE = [
|
|
|
|
"-I${SDL2_image}/include/SDL2"
|
|
|
|
"-I${SDL2_ttf}/include/SDL2"
|
|
|
|
];
|
2018-02-25 03:15:13 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
2017-03-04 16:24:46 +01:00
|
|
|
substituteInPlace premake4.lua \
|
|
|
|
--replace "/opt/SDL-2.0/include/SDL2" "${SDL2.dev}/include/SDL2" \
|
|
|
|
--replace "/usr/include/GL" "/run/opengl-driver/include"
|
2018-02-25 03:15:13 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = ''
|
2015-06-14 18:44:38 +02:00
|
|
|
premake4 gmake
|
|
|
|
'';
|
2018-02-25 03:15:13 +01:00
|
|
|
|
2015-06-14 18:44:38 +02:00
|
|
|
makeFlags = [ "config=release" ];
|
2018-02-25 03:15:13 +01: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 18:44:38 +02:00
|
|
|
installPhase = ''
|
2018-02-25 03:15:13 +01: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} \
|
|
|
|
--run "cd $dir"
|
|
|
|
|
|
|
|
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 18:44:38 +02:00
|
|
|
'';
|
2018-02-25 03:15:13 +01:00
|
|
|
|
2017-03-04 16:24:46 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-06-14 18:44:38 +02:00
|
|
|
description = "Tales of Maj'eyal (rogue-like game)";
|
2018-02-25 03:15:13 +01:00
|
|
|
homepage = https://te4.org/;
|
2017-03-04 16:24:46 +01:00
|
|
|
license = licenses.gpl3;
|
2018-02-25 03:15:13 +01:00
|
|
|
maintainers = with maintainers; [ chattered peterhoeg ];
|
2017-03-04 16:24:46 +01:00
|
|
|
platforms = platforms.linux;
|
2015-06-14 18:44:38 +02:00
|
|
|
};
|
|
|
|
}
|