From a60774c00b9936bebb977698493214790d1b2bdb Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Sun, 25 Feb 2018 10:15:13 +0800 Subject: [PATCH] tome4: 1.4.9 -> 1.5.5 --- pkgs/games/tome4/default.nix | 79 ++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 18 deletions(-) diff --git a/pkgs/games/tome4/default.nix b/pkgs/games/tome4/default.nix index f07fd88fbaf3..1e529fb15817 100644 --- a/pkgs/games/tome4/default.nix +++ b/pkgs/games/tome4/default.nix @@ -1,43 +1,86 @@ -{stdenv, fetchurl, openal, libpng, libvorbis, mesa_glu, premake4, SDL2, SDL2_image, SDL2_ttf }: +{ stdenv, fetchurl, makeDesktopItem, makeWrapper, premake4, unzip +, openal, libpng, libvorbis, mesa_glu, 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 = [ mesa_glu 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 <