aboutsummaryrefslogtreecommitdiff
path: root/pkgs/games/tome4
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2018-03-05 12:49:52 +0100
committerVladimír Čunát <vcunat@gmail.com>2018-03-05 14:53:27 +0100
commit565bd805e6aea9258ead5449b46c5e56ae0568fb (patch)
tree81a23c558823fc865d180bb8b6318d24ec38729d /pkgs/games/tome4
parent25a78f7234ced8840610178a695078b5b08d9e6b (diff)
parent97693915e1d31478528ee72e8d1fea5aa384577b (diff)
Merge branch 'master'
Diffstat (limited to 'pkgs/games/tome4')
-rw-r--r--pkgs/games/tome4/default.nix79
1 files changed, 61 insertions, 18 deletions
diff --git a/pkgs/games/tome4/default.nix b/pkgs/games/tome4/default.nix
index 390ab1eefd18..83f34f5b04af 100644
--- a/pkgs/games/tome4/default.nix
+++ b/pkgs/games/tome4/default.nix
@@ -1,43 +1,86 @@
-{stdenv, fetchurl, openal, libpng, libvorbis, libGLU, premake4, SDL2, SDL2_image, SDL2_ttf }:
+{ stdenv, fetchurl, makeDesktopItem, makeWrapper, premake4, unzip
+, openal, libpng, libvorbis, libGLU, SDL2, SDL2_image, SDL2_ttf }:
+
+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";
-stdenv.mkDerivation rec {
- version = "1.4.9";
- name = "tome4-${version}";
src = fetchurl {
url = "https://te4.org/dl/t-engine/t-engine4-src-${version}.tar.bz2";
- sha256 = "0c82m0g1ps64zghgdrp78m6bvfngcb75whhknqiailld7kz1g9xl";
+ sha256 = "0v2qgdfpvdzd1bcbp9v8pfahj1bgczsq2d4xfhh5wg11jgjcwz03";
};
- nativeBuildInputs = [ premake4 ];
+
+ nativeBuildInputs = [ premake4 makeWrapper unzip ];
+
+ # 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
];
+
+ enableParallelBuilding = true;
+
NIX_CFLAGS_COMPILE = [
"-I${SDL2_image}/include/SDL2"
"-I${SDL2_ttf}/include/SDL2"
];
- preConfigure = ''
+
+ postPatch = ''
substituteInPlace premake4.lua \
--replace "/opt/SDL-2.0/include/SDL2" "${SDL2.dev}/include/SDL2" \
--replace "/usr/include/GL" "/run/opengl-driver/include"
+ '';
+
+ preConfigure = ''
premake4 gmake
'';
+
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 = ''
- install -Dm755 t-engine $out/opt/tome4/t-engine
- cat > tome4 <<EOF
-#!/bin/sh
-cd $out/opt/tome4
-./t-engine &
-EOF
- install -Dm755 tome4 $out/bin/tome4
- cp -r bootstrap $out/opt/tome4
- cp -r game $out/opt/tome4
+ 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
'';
+
meta = with stdenv.lib; {
- homepage = https://te4.org/;
description = "Tales of Maj'eyal (rogue-like game)";
- maintainers = [ maintainers.chattered ];
+ homepage = https://te4.org/;
license = licenses.gpl3;
+ maintainers = with maintainers; [ chattered peterhoeg ];
platforms = platforms.linux;
};
}