nixpkgs/pkgs/games/gemrb/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

90 lines
2.2 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, SDL2
, SDL2_mixer
, freetype
, libGL
, libiconv
, libpng
, libvlc
, libvorbis
, openal
, python3
, zlib
}:
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.3";
src = fetchFromGitHub {
owner = "gemrb";
repo = "gemrb";
rev = "v${version}";
hash = "sha256-n01Q/27iYXahBbUDFHW1Q3lPqCtTvhstUBgownZbKtg=";
};
buildInputs = [
SDL2
SDL2_mixer
freetype
libGL
libiconv
libpng
libvorbis
openal
python3
zlib
]
++ optional withVLC libvlc;
nativeBuildInputs = [ cmake ];
# 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"
];
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 = "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
open-source implementation of Bioware's Infinity Engine. It was written to
support pseudo-3D role playing games based on the Dungeons & Dragons
ruleset (Baldur's Gate and Icewind Dale series, Planescape: Torment).
'';
homepage = "https://gemrb.org/";
license = licenses.gpl2Only;
maintainers = with maintainers; [ peterhoeg ];
};
}