nixpkgs/pkgs/games/openrw/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

61 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, ninja
, sfml
, libGLU
, libGL
, bullet
, glm
, libmad
, openal
, SDL2
, boost
, ffmpeg_6
, Cocoa
, OpenAL }:
stdenv.mkDerivation {
version = "0-unstable-2024-04-20";
pname = "openrw";
src = fetchFromGitHub {
owner = "rwengine";
repo = "openrw";
rev = "f10a5a8f7abc79a0728847e9a10ee104a1216047";
hash = "sha256-4ydwPh/pCzuZNNOyZuEEeX4wzI+dqTtAxUyXOXz76zk=";
fetchSubmodules = true;
};
patches = [
# SoundSource.cpp: return AVERROR_EOF when buffer is empty
# https://github.com/rwengine/openrw/pull/747
./fix-ffmpeg-6.patch
];
postPatch = lib.optional (stdenv.cc.isClang && (lib.versionAtLeast stdenv.cc.version "9"))''
substituteInPlace cmake_configure.cmake \
--replace 'target_link_libraries(rw_interface INTERFACE "stdc++fs")' ""
'';
nativeBuildInputs = [ cmake ninja ];
buildInputs = [
sfml libGLU libGL bullet glm libmad openal SDL2 boost ffmpeg_6
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ OpenAL Cocoa ];
meta = with lib; {
description = "Unofficial open source recreation of the classic Grand Theft Auto III game executable";
homepage = "https://github.com/rwengine/openrw";
license = licenses.gpl3;
longDescription = ''
OpenRW is an open source re-implementation of Rockstar Games' Grand Theft
Auto III, a classic 3D action game first published in 2001.
'';
maintainers = with maintainers; [ kragniz ];
platforms = platforms.all;
mainProgram = "rwgame";
};
}