gemrb: cleaning up (#377400)

* gemrb: cleaning up
This commit is contained in:
Peter Hoeg
2025-02-24 23:44:46 +01:00
committed by GitHub
parent 96184f1af0
commit f869e8f2f6

View File

@@ -1,8 +1,12 @@
{ {
lib, lib,
stdenv, stdenv,
runCommand,
fetchFromGitHub, fetchFromGitHub,
cmake, cmake,
pkg-config,
imagemagick,
gtest,
SDL2, SDL2,
SDL2_mixer, SDL2_mixer,
freetype, freetype,
@@ -14,19 +18,16 @@
openal, openal,
python3, python3,
zlib, zlib,
# the GLES backend on rpi is untested as I don't have the hardware
backend ? if stdenv.hostPlatform.isx86 then "OpenGL" else "GLES",
}: }:
# Previously we only used libvlc *on* darwin, which is incorrect. According to
# https://github.com/gemrb/gemrb/blob/master/INSTALL it is needed for some mac versions of some
# games but there is obviously nothing wrong using those on linux.
# Additionally, when gemrb adds support for the EE games, libvlc will be needed anyway.
let let
# the GLES backend on rpi is untested as I don't have the hardware
backend = if stdenv.hostPlatform.isx86 then "OpenGL" else "GLES";
withVLC = stdenv.hostPlatform.isDarwin;
inherit (lib) optional optionalString;
in
stdenv.mkDerivation rec {
pname = "gemrb";
version = "0.9.4"; version = "0.9.4";
src = fetchFromGitHub { src = fetchFromGitHub {
@@ -36,6 +37,20 @@ stdenv.mkDerivation rec {
hash = "sha256-+aPnOJQGRblqcrblVU5ZwA8CZqeT19rxEtn3GLuofYU="; hash = "sha256-+aPnOJQGRblqcrblVU5ZwA8CZqeT19rxEtn3GLuofYU=";
}; };
icons = runCommand "gemrb-icons" { nativeBuildInputs = [ imagemagick ]; } ''
for s in 48 64 96 128 256 512 1024; do
size=''${s}x''${s}
dir=$out/share/icons/hicolor/$size
mkdir -p $dir
magick -background none -size $size ${src}/artwork/logo04-rb_only.svg -format png $dir/gemrb.png
done
'';
in
stdenv.mkDerivation (finalAttrs: {
pname = "gemrb";
inherit version src;
buildInputs = [ buildInputs = [
SDL2 SDL2
SDL2_mixer SDL2_mixer
@@ -43,36 +58,37 @@ stdenv.mkDerivation rec {
libGL libGL
libiconv libiconv
libpng libpng
libvlc
libvorbis libvorbis
openal openal
python3 python3
zlib zlib
] ++ optional withVLC libvlc; ];
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [
cmake
# libvlc isn't being detected properly as of 0.9.0, so set it pkg-config
LIBVLC_INCLUDE_PATH = optionalString withVLC "${lib.getDev libvlc}/include"; ] ++ lib.optionals (finalAttrs.doCheck or false) [ gtest ];
LIBVLC_LIBRARY_PATH = optionalString withVLC "${lib.getLib libvlc}/lib";
cmakeFlags = [ cmakeFlags = [
"-DDATA_DIR=${placeholder "out"}/share/gemrb" (lib.cmakeFeature "DATA_DIR" "${placeholder "out"}/share/gemrb")
"-DEXAMPLE_CONF_DIR=${placeholder "out"}/share/doc/gemrb/examples" (lib.cmakeFeature "EXAMPLE_CONF_DIR" "${placeholder "out"}/share/doc/gemrb/examples")
"-DSYSCONF_DIR=/etc" (lib.cmakeFeature "SYSCONF_DIR" "/etc")
# use the Mesa drivers for video on ARM (harmless on x86) # use the Mesa drivers for video on ARM (harmless on x86)
"-DDISABLE_VIDEOCORE=ON" (lib.cmakeBool "DISABLE_VIDEOCORE" true)
"-DLAYOUT=opt" (lib.cmakeFeature "LAYOUT" "opt")
"-DOPENGL_BACKEND=${backend}" (lib.cmakeFeature "OPENGL_BACKEND" backend)
"-DOpenGL_GL_PREFERENCE=GLVND" (lib.cmakeFeature "OpenGL_GL_PREFERENCE" "GLVND")
(lib.cmakeBool "USE_TESTS" (finalAttrs.doCheck or false))
]; ];
postInstall = '' postInstall = ''
for s in 36 48 72 96 144; do cp -r ${icons}/share/icons $out/share/
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
''; '';
# a bunch of tests fail in our sandbox
doCheck = false;
meta = with lib; { meta = with lib; {
description = "Reimplementation of the Infinity Engine, used by games such as Baldur's Gate"; description = "Reimplementation of the Infinity Engine, used by games such as Baldur's Gate";
longDescription = '' longDescription = ''
@@ -84,5 +100,6 @@ stdenv.mkDerivation rec {
homepage = "https://gemrb.org/"; homepage = "https://gemrb.org/";
license = licenses.gpl2Only; license = licenses.gpl2Only;
maintainers = with maintainers; [ peterhoeg ]; maintainers = with maintainers; [ peterhoeg ];
mainProgram = "gemrb";
}; };
} })