openrw: unstable-2021-10-14 -> 0-unstable-2024-04-20

Includes fixes for FFmpeg 6.
This commit is contained in:
Emily 2024-07-15 14:35:10 +01:00
parent 9e94196358
commit 9a6b722284
2 changed files with 35 additions and 6 deletions

View File

@ -2,6 +2,7 @@
, stdenv
, fetchFromGitHub
, cmake
, ninja
, sfml
, libGLU
, libGL
@ -11,31 +12,37 @@
, openal
, SDL2
, boost
, ffmpeg_4
, ffmpeg_6
, Cocoa
, OpenAL }:
stdenv.mkDerivation {
version = "unstable-2021-10-14";
version = "0-unstable-2024-04-20";
pname = "openrw";
src = fetchFromGitHub {
owner = "rwengine";
repo = "openrw";
rev = "0f83c16f6518c427a4f156497c3edc843610c402";
sha256 = "0i6nx9g0xb8sziak5swi8636fszcjjx8n2jwgz570izw2fl698ff";
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 ];
nativeBuildInputs = [ cmake ninja ];
buildInputs = [
sfml libGLU libGL bullet glm libmad openal SDL2 boost ffmpeg_4
sfml libGLU libGL bullet glm libmad openal SDL2 boost ffmpeg_6
] ++ lib.optionals stdenv.isDarwin [ OpenAL Cocoa ];
meta = with lib; {

View File

@ -0,0 +1,22 @@
From ad7be040894661b708f9c861696499640ac7f9dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomi=20L=C3=A4hteenm=C3=A4ki?= <lihis@lihis.net>
Date: Fri, 1 Dec 2023 16:01:59 +0200
Subject: [PATCH] SoundSource.cpp: return AVERROR_EOF when buffer is empty
---
rwengine/src/audio/SoundSource.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rwengine/src/audio/SoundSource.cpp b/rwengine/src/audio/SoundSource.cpp
index c93376e73..d355cab74 100644
--- a/rwengine/src/audio/SoundSource.cpp
+++ b/rwengine/src/audio/SoundSource.cpp
@@ -55,7 +55,7 @@ int read_packet(void* opaque, uint8_t* buf, int buf_size) {
memcpy(buf, input->ptr, buf_size);
input->ptr += buf_size;
input->size -= buf_size;
- return buf_size;
+ return buf_size <= 0 ? AVERROR_EOF : buf_size;
}
} // namespace