summary refs log tree commit diff
path: root/pkgs/games/gemrb/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/gemrb/default.nix')
-rw-r--r--pkgs/games/gemrb/default.nix79
1 files changed, 64 insertions, 15 deletions
diff --git a/pkgs/games/gemrb/default.nix b/pkgs/games/gemrb/default.nix
index 4f7d1cb3750..947957bc3af 100644
--- a/pkgs/games/gemrb/default.nix
+++ b/pkgs/games/gemrb/default.nix
@@ -1,30 +1,80 @@
-{ stdenv, fetchFromGitHub, cmake
-, freetype, SDL2, SDL2_mixer, openal, zlib, libpng, python, libvorbis
-, libiconv }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, SDL2
+, SDL2_mixer
+, freetype
+, libGL
+, libiconv
+, libpng
+, libvlc
+, libvorbis
+, openal
+, python2 # 0.9.0 crashes after character generation with py3, so stick to py2 for now
+, zlib
+}:
 
+let
+  # the GLES backend on rpi is untested as I don't have the hardware
+  backend =
+    if (stdenv.isx86_32 || stdenv.isx86_64) then "OpenGL" else "GLES";
+
+  withVLC = stdenv.isDarwin;
+
+  inherit (lib) optional optionalString;
+
+in
 stdenv.mkDerivation rec {
   pname = "gemrb";
-  version = "0.8.6";
+  version = "0.9.0";
 
   src = fetchFromGitHub {
-    owner  = "gemrb";
-    repo   = "gemrb";
-    rev    = "v${version}";
-    sha256 = "0vsr3fsqmv9b7s5l0cwhpq2pf7ah2wvgmcn9y8asj6w8hprp17d4";
+    owner = "gemrb";
+    repo = "gemrb";
+    rev = "v${version}";
+    sha256 = "sha256-h/dNPY0QZ2m7aYgRla3r1E8APJqO99ePa2ABhhh3Aoc=";
   };
 
-  # TODO: make libpng, libvorbis, sdl_mixer, freetype, vlc, glew (and other gl reqs) optional
-  buildInputs = [ freetype python openal SDL2 SDL2_mixer zlib libpng libvorbis libiconv ];
+  buildInputs = [
+    SDL2
+    SDL2_mixer
+    freetype
+    libGL
+    libiconv
+    libpng
+    libvorbis
+    openal
+    python2
+    zlib
+  ]
+  ++ optional withVLC libvlc;
 
   nativeBuildInputs = [ cmake ];
 
-  enableParallelBuilding = true;
+  # libvlc isn't being detected properly as of 0.9.0, so set it
+  LIBVLC_INCLUDE_PATH = optionalString withVLC "${lib.getDev libvlc}/include";
+  LIBVLC_LIBRARY_PATH = optionalString withVLC "${lib.getLib libvlc}/lib";
 
   cmakeFlags = [
+    "-DDATA_DIR=${placeholder "out"}/share/gemrb"
+    "-DEXAMPLE_CONF_DIR=${placeholder "out"}/share/doc/gemrb/examples"
+    "-DSYSCONF_DIR=/etc"
+    # use the Mesa drivers for video on ARM (harmless on x86)
+    "-DDISABLE_VIDEOCORE=ON"
     "-DLAYOUT=opt"
+    "-DOPENGL_BACKEND=${backend}"
+    "-DOpenGL_GL_PREFERENCE=GLVND"
   ];
 
-  meta = with stdenv.lib; {
+  postInstall = ''
+    for s in 36 48 72 96 144; do
+      install -Dm444 ../artwork/gemrb-logo-glow-''${s}px.png $out/share/icons/hicolor/''${s}x''${s}/gemrb.png
+    done
+    install -Dm444 ../artwork/gemrb-logo.png $out/share/icons/gemrb.png
+  '';
+
+  meta = with lib; {
     description = "A reimplementation of the Infinity Engine, used by games such as Baldur's Gate";
     longDescription = ''
       GemRB (Game engine made with pre-Rendered Background) is a portable
@@ -32,9 +82,8 @@ stdenv.mkDerivation rec {
       support pseudo-3D role playing games based on the Dungeons & Dragons
       ruleset (Baldur's Gate and Icewind Dale series, Planescape: Torment).
     '';
-    homepage = "http://gemrb.org/";
-    license = licenses.gpl2;
+    homepage = "https://gemrb.org/";
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ peterhoeg ];
-    platforms = platforms.all;
   };
 }