summaryrefslogtreecommitdiff
path: root/media-tv/kodi/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-11-22 13:04:14 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-11-22 13:04:14 +0000
commitca064c8956ad6daf677aff6a8e667c0c39d08ffb (patch)
tree3048673e663d6387e298c40d8a4cd402a5d84936 /media-tv/kodi/files
parentefed6cdc510e082a9fa5885f2846337bf86573b6 (diff)
media-tv/kodi : import from gentoo, attempt to fix build against dav1d 1.0.0
Diffstat (limited to 'media-tv/kodi/files')
-rw-r--r--media-tv/kodi/files/dav1d.patch94
-rw-r--r--media-tv/kodi/files/kodi-19.4-atomic.patch108
-rw-r--r--media-tv/kodi/files/kodi-19.4-fmt-9.patch74
3 files changed, 276 insertions, 0 deletions
diff --git a/media-tv/kodi/files/dav1d.patch b/media-tv/kodi/files/dav1d.patch
new file mode 100644
index 00000000..12470162
--- /dev/null
+++ b/media-tv/kodi/files/dav1d.patch
@@ -0,0 +1,94 @@
+diff -Nur a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake
+--- a/cmake/modules/FindFFMPEG.cmake 2022-03-02 18:38:51.000000000 +0000
++++ b/cmake/modules/FindFFMPEG.cmake 2022-11-22 12:59:57.338906199 +0000
+@@ -275,6 +275,8 @@
+ PATCH_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/CMakeLists.txt
+ <SOURCE_DIR> &&
++ patch -p1 < ${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/build-fix-for-dav1d-1.0.0.patch &&
++ echo "########################################## patched ffmpeg ##############################"
+ ${CMAKE_COMMAND} -E copy
+ ${CMAKE_SOURCE_DIR}/tools/depends/target/ffmpeg/FindGnuTls.cmake
+ <SOURCE_DIR>)
+diff -Nur a/tools/depends/target/ffmpeg/build-fix-for-dav1d-1.0.0.patch b/tools/depends/target/ffmpeg/build-fix-for-dav1d-1.0.0.patch
+--- a/tools/depends/target/ffmpeg/build-fix-for-dav1d-1.0.0.patch 1970-01-01 01:00:00.000000000 +0100
++++ b/tools/depends/target/ffmpeg/build-fix-for-dav1d-1.0.0.patch 2022-11-22 12:20:07.727744168 +0000
+@@ -0,0 +1,78 @@
++From 2546e1ed27f92a840a2cf319e3c1833799974cf1 Mon Sep 17 00:00:00 2001
++From: BlackEagle <ike.devolder@gmail.com>
++Date: Fri, 29 Apr 2022 14:33:12 +0200
++Subject: [PATCH] add build fix for dav1d 1.0.0
++
++Taken from https://github.com/FFmpeg/FFmpeg/commit/e204846ec16c1ab34c7f3a681734cf5190433018
++
++add FF_DAV1D_VERSION_AT_LEAST
++
++Extracted from https://github.com/FFmpeg/FFmpeg/commit/7ee17ec7e46afef0e0af20af196292ec75f50b62
++
++Signed-off-by: BlackEagle <ike.devolder@gmail.com>
++---
++ libavcodec/libdav1d.c | 24 ++++++++++++++++++++++--
++ 1 file changed, 22 insertions(+), 2 deletions(-)
++
++diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
++index bbb3ec1e6c..08b4af8ac8 100644
++--- a/libavcodec/libdav1d.c
+++++ b/libavcodec/libdav1d.c
++@@ -30,6 +30,9 @@
++ #include "decode.h"
++ #include "internal.h"
++
+++#define FF_DAV1D_VERSION_AT_LEAST(x,y) \
+++ (DAV1D_API_VERSION_MAJOR > (x) || DAV1D_API_VERSION_MAJOR == (x) && DAV1D_API_VERSION_MINOR >= (y))
+++
++ typedef struct Libdav1dContext {
++ AVClass *class;
++ Dav1dContext *c;
++@@ -140,6 +143,15 @@ static av_cold int libdav1d_init(AVCodecContext *c)
++ if (dav1d->operating_point >= 0)
++ s.operating_point = dav1d->operating_point;
++
+++#if FF_DAV1D_VERSION_AT_LEAST(6,0)
+++ if (dav1d->frame_threads || dav1d->tile_threads)
+++ s.n_threads = FFMAX(dav1d->frame_threads, dav1d->tile_threads);
+++ else
+++ s.n_threads = FFMIN(threads, DAV1D_MAX_THREADS);
+++ s.max_frame_delay = (c->flags & AV_CODEC_FLAG_LOW_DELAY) ? 1 : s.n_threads;
+++ av_log(c, AV_LOG_DEBUG, "Using %d threads, %d max_frame_delay\n",
+++ s.n_threads, s.max_frame_delay);
+++#else
++ s.n_tile_threads = dav1d->tile_threads
++ ? dav1d->tile_threads
++ : FFMIN(floor(sqrt(threads)), DAV1D_MAX_TILE_THREADS);
++@@ -148,6 +160,7 @@ static av_cold int libdav1d_init(AVCodecContext *c)
++ : FFMIN(ceil(threads / s.n_tile_threads), DAV1D_MAX_FRAME_THREADS);
++ av_log(c, AV_LOG_DEBUG, "Using %d frame threads, %d tile threads\n",
++ s.n_frame_threads, s.n_tile_threads);
+++#endif
++
++ res = dav1d_open(&dav1d->c, &s);
++ if (res < 0)
++@@ -384,11 +397,18 @@ static av_cold int libdav1d_close(AVCodecContext *c)
++ return 0;
++ }
++
+++#ifndef DAV1D_MAX_FRAME_THREADS
+++#define DAV1D_MAX_FRAME_THREADS DAV1D_MAX_THREADS
+++#endif
+++#ifndef DAV1D_MAX_TILE_THREADS
+++#define DAV1D_MAX_TILE_THREADS DAV1D_MAX_THREADS
+++#endif
+++
++ #define OFFSET(x) offsetof(Libdav1dContext, x)
++ #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
++ static const AVOption libdav1d_options[] = {
++- { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_TILE_THREADS, VD },
++- { "framethreads", "Frame threads", OFFSET(frame_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_THREADS, VD },
+++ { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_TILE_THREADS, VD | AV_OPT_FLAG_DEPRECATED },
+++ { "framethreads", "Frame threads", OFFSET(frame_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_THREADS, VD | AV_OPT_FLAG_DEPRECATED },
++ { "filmgrain", "Apply Film Grain", OFFSET(apply_grain), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD },
++ { "oppoint", "Select an operating point of the scalable bitstream", OFFSET(operating_point), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 31, VD },
++ { "alllayers", "Output all spatial layers", OFFSET(all_layers), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD },
++--
++2.36.0
++
diff --git a/media-tv/kodi/files/kodi-19.4-atomic.patch b/media-tv/kodi/files/kodi-19.4-atomic.patch
new file mode 100644
index 00000000..3811fda8
--- /dev/null
+++ b/media-tv/kodi/files/kodi-19.4-atomic.patch
@@ -0,0 +1,108 @@
+From ac3213e683e4c62c50dc02fef3b168d883245094 Mon Sep 17 00:00:00 2001
+From: Yixun Lan <dlan@gentoo.org>
+Date: Tue, 9 Aug 2022 16:45:09 +0800
+Subject: [PATCH] [cmake] link atomic library for certain CPU architectures
+
+For those CPU architectures:
+RISC-V lack 8-bit and 16-bit atomic instructions, and
+ARM/MIPS/PPC lack 64-bit atomic instruction.
+
+GCC is supposed to convert these atomics via masking and shifting
+like LLVM, which means anything that wants to use these instructions
+needs the link option -latomic.
+
+In this patch, we will try to detect if 8-bit, 64-bit atomic instructions exist,
+otherwise the atomic library will append to the DEPLIBS list.
+
+Original issue:
+* https://gitlab.kitware.com/cmake/cmake/-/issues/23021#note_1098733
+
+For reference:
+* https://gcc.gnu.org/wiki/Atomic/GCCMM
+
+riscv64 specific:
+* https://lists.debian.org/debian-riscv/2022/01/msg00009.html
+
+Signed-off-by: Yixun Lan <dlan@gentoo.org>
+---
+ cmake/modules/FindAtomic.cmake | 56 +++++++++++++++++++++++++++++
+ cmake/scripts/linux/ArchSetup.cmake | 3 ++
+ 2 files changed, 59 insertions(+)
+ create mode 100644 cmake/modules/FindAtomic.cmake
+
+diff --git a/cmake/modules/FindAtomic.cmake b/cmake/modules/FindAtomic.cmake
+new file mode 100644
+index 0000000000..8ea3c815d7
+--- /dev/null
++++ b/cmake/modules/FindAtomic.cmake
+@@ -0,0 +1,56 @@
++#.rst:
++# FindAtomic
++# -----
++# Finds the ATOMIC library
++#
++# This will define the following variables::
++#
++# ATOMIC_FOUND - system has ATOMIC
++# ATOMIC_LIBRARIES - the ATOMIC libraries
++#
++# and the following imported targets::
++#
++# ATOMIC::ATOMIC - The ATOMIC library
++
++
++include(CheckCXXSourceCompiles)
++
++set(atomic_code
++ "
++ #include <atomic>
++ #include <cstdint>
++ std::atomic<uint8_t> n8 (0); // riscv64
++ std::atomic<uint64_t> n64 (0); // armel, mipsel, powerpc
++ int main() {
++ ++n8;
++ ++n64;
++ return 0;
++ }")
++
++check_cxx_source_compiles("${atomic_code}" ATOMIC_LOCK_FREE_INSTRUCTIONS)
++
++if(ATOMIC_LOCK_FREE_INSTRUCTIONS)
++ set(ATOMIC_FOUND TRUE)
++ set(ATOMIC_LIBRARIES)
++else()
++ set(CMAKE_REQUIRED_LIBRARIES "-latomic")
++ check_cxx_source_compiles("${atomic_code}" ATOMIC_IN_LIBRARY)
++ set(CMAKE_REQUIRED_LIBRARIES)
++ if(ATOMIC_IN_LIBRARY)
++ set(ATOMIC_LIBRARY atomic)
++ include(FindPackageHandleStandardArgs)
++ find_package_handle_standard_args(Atomic DEFAULT_MSG ATOMIC_LIBRARY)
++ set(ATOMIC_LIBRARIES ${ATOMIC_LIBRARY})
++ if(NOT TARGET ATOMIC::ATOMIC)
++ add_library(ATOMIC::ATOMIC UNKNOWN IMPORTED)
++ set_target_properties(ATOMIC::ATOMIC PROPERTIES
++ IMPORTED_LOCATION "${ATOMIC_LIBRARY}")
++ endif()
++ unset(ATOMIC_LIBRARY)
++ else()
++ if(Atomic_FIND_REQUIRED)
++ message(FATAL_ERROR "Neither lock free instructions nor -latomic found.")
++ endif()
++ endif()
++endif()
++unset(atomic_code)
+diff --git a/cmake/scripts/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake
+index 35ab1402f5..848723af1f 100644
+--- a/cmake/scripts/linux/ArchSetup.cmake
++++ b/cmake/scripts/linux/ArchSetup.cmake
+@@ -199,3 +199,6 @@ if(NOT USE_INTERNAL_LIBS)
+ set(USE_INTERNAL_LIBS OFF)
+ endif()
+ endif()
++
++# Atomic library
++list(APPEND PLATFORM_REQUIRED_DEPS Atomic)
+--
+2.35.1
+
diff --git a/media-tv/kodi/files/kodi-19.4-fmt-9.patch b/media-tv/kodi/files/kodi-19.4-fmt-9.patch
new file mode 100644
index 00000000..b60d9ccc
--- /dev/null
+++ b/media-tv/kodi/files/kodi-19.4-fmt-9.patch
@@ -0,0 +1,74 @@
+From 6e081841981af8fc0d88d4f549456fd93b7ae2ac Mon Sep 17 00:00:00 2001
+From: Rudi Heitbaum <rudi@heitbaum.com>
+Date: Wed, 6 Jul 2022 22:48:35 +1000
+Subject: [PATCH 1/2] GLUtils: cast as char as formatting of non-void pointers
+ is disallowed
+
+---
+ xbmc/utils/GLUtils.cpp | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/xbmc/utils/GLUtils.cpp b/xbmc/utils/GLUtils.cpp
+index 1ef804709ff56..c36dcf6a20fec 100644
+--- a/xbmc/utils/GLUtils.cpp
++++ b/xbmc/utils/GLUtils.cpp
+@@ -148,27 +148,27 @@ void _VerifyGLState(const char* szfile, const char* szfunction, int lineno)
+ void LogGraphicsInfo()
+ {
+ #if defined(HAS_GL) || defined(HAS_GLES)
+- const GLubyte *s;
++ const char* s;
+
+- s = glGetString(GL_VENDOR);
++ s = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
+ if (s)
+ CLog::Log(LOGINFO, "GL_VENDOR = %s", s);
+ else
+ CLog::Log(LOGINFO, "GL_VENDOR = NULL");
+
+- s = glGetString(GL_RENDERER);
++ s = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
+ if (s)
+ CLog::Log(LOGINFO, "GL_RENDERER = %s", s);
+ else
+ CLog::Log(LOGINFO, "GL_RENDERER = NULL");
+
+- s = glGetString(GL_VERSION);
++ s = reinterpret_cast<const char*>(glGetString(GL_VERSION));
+ if (s)
+ CLog::Log(LOGINFO, "GL_VERSION = %s", s);
+ else
+ CLog::Log(LOGINFO, "GL_VERSION = NULL");
+
+- s = glGetString(GL_SHADING_LANGUAGE_VERSION);
++ s = reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
+ if (s)
+ CLog::Log(LOGINFO, "GL_SHADING_LANGUAGE_VERSION = %s", s);
+ else
+
+From 6a504c306b743b73225bd81e490ef7dc9fae2c25 Mon Sep 17 00:00:00 2001
+From: Rudi Heitbaum <rudi@heitbaum.com>
+Date: Mon, 11 Jul 2022 09:39:02 +0000
+Subject: [PATCH 2/2] WinSystemX11: cast as char as formatting of non-void
+ pointers is disallowed
+
+---
+ xbmc/windowing/X11/WinSystemX11.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp
+index 8a18288fd8af0..033c0f77bf454 100644
+--- a/xbmc/windowing/X11/WinSystemX11.cpp
++++ b/xbmc/windowing/X11/WinSystemX11.cpp
+@@ -1038,7 +1038,10 @@ bool CWinSystemX11::HasWindowManager()
+
+ if(status == Success && items_read)
+ {
+- CLog::Log(LOGDEBUG,"Window Manager Name: %s", data);
++ const char* s;
++
++ s = reinterpret_cast<const char*>(data);
++ CLog::Log(LOGDEBUG, "Window Manager Name: {}", s);
+ }
+ else
+ CLog::Log(LOGDEBUG,"Window Manager Name: ");