Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
From 6604cce38fed748e98d3bd2bf9d0f368d67eeb3c Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Wed, 29 Jul 2015 23:13:33 +0200
Subject: [PATCH] kodi-config.cmake: use CMAKE_FIND_ROOT_PATH to fix
cross-compilation
When cross-compiling, the location at build time of the libraries is
not the same as the one at run-time. The CMAKE_FIND_ROOT_PATH variable
is here to handle this difference, so use it in kodi-config.cmake.
Upstream: Reverted (PR 17616 and 18680)
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
(rebased and simplified for Kodi 17.0-Krypton)
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
(rebased for Kodi 19.0-Matrix)
---
cmake/KodiConfig.cmake.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/KodiConfig.cmake.in b/cmake/KodiConfig.cmake.in
index a06d889fca9d..ff299807ea44 100644
--- a/cmake/KodiConfig.cmake.in
+++ b/cmake/KodiConfig.cmake.in
@@ -9,7 +9,7 @@ if(NOT @APP_NAME_UC@_PREFIX)
set(@APP_NAME_UC@_PREFIX @APP_PREFIX@)
endif()
if(NOT @APP_NAME_UC@_INCLUDE_DIR)
- set(@APP_NAME_UC@_INCLUDE_DIR @APP_INCLUDE_DIR@)
+ set(@APP_NAME_UC@_INCLUDE_DIR ${CMAKE_FIND_ROOT_PATH}/@APP_INCLUDE_DIR@)
endif()
if(NOT @APP_NAME_UC@_LIB_DIR)
set(@APP_NAME_UC@_LIB_DIR @APP_LIB_DIR@)
@@ -18,7 +18,7 @@ if(NOT @APP_NAME_UC@_DATA_DIR)
set(@APP_NAME_UC@_DATA_DIR @APP_DATA_DIR@)
endif()
set(APP_RENDER_SYSTEM @APP_RENDER_SYSTEM@)
-list(APPEND CMAKE_MODULE_PATH @APP_LIB_DIR@ @APP_DATA_DIR@/cmake)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_FIND_ROOT_PATH}/@APP_LIB_DIR@ ${CMAKE_FIND_ROOT_PATH}/@APP_DATA_DIR@/cmake)
string(REPLACE ";" " " ARCH_DEFINES "@ARCH_DEFINES@")
add_definitions(${ARCH_DEFINES} -DBUILD_KODI_ADDON)
--
2.5.0

View File

@@ -0,0 +1,71 @@
From 29492cbd20d4c90a9c00a30ab525d4d0e81a968b Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Sun, 15 Mar 2026 11:38:16 +0000
Subject: [PATCH] TexturePacker: allow build with giflib 6.x
Current #if clauses are written with a maximum of giflib 5 written in,
update the to >= to allow for newer versiosn of the giflib api.
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Upstream: https://github.com/xbmc/xbmc/pull/28016
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
.../native/TexturePacker/src/decoder/GifHelper.cpp | 8 ++++----
.../depends/native/TexturePacker/src/decoder/GifHelper.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp b/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp
index eb513134b3eb8..b216ecbcef7fa 100644
--- a/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp
+++ b/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp
@@ -52,7 +52,7 @@ GifHelper::~GifHelper()
bool GifHelper::Open(GifFileType*& gif, void *dataPtr, InputFunc readFunc)
{
int err = 0;
-#if GIFLIB_MAJOR == 5
+#if GIFLIB_MAJOR >= 5
gif = DGifOpen(dataPtr, readFunc, &err);
#else
gif = DGifOpen(dataPtr, readFunc);
@@ -73,7 +73,7 @@ void GifHelper::Close(GifFileType* gif)
{
int err = 0;
int reason = 0;
-#if GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1
+#if (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1) || GIFLIB_MAJOR >= 6
err = DGifCloseFile(gif, &reason);
#else
err = DGifCloseFile(gif);
@@ -181,7 +181,7 @@ bool GifHelper::Slurp(GifFileType* gif)
if (DGifSlurp(gif) == GIF_ERROR)
{
int reason = 0;
-#if GIFLIB_MAJOR == 5
+#if GIFLIB_MAJOR >= 5
reason = gif->Error;
#else
reason = GifLastError();
@@ -246,7 +246,7 @@ bool GifHelper::GcbToFrame(GifFrame &frame, unsigned int imgIdx)
if (m_gif->ImageCount > 0)
{
-#if GIFLIB_MAJOR == 5
+#if GIFLIB_MAJOR >= 5
GraphicsControlBlock gcb;
if (DGifSavedExtensionToGCB(m_gif, imgIdx, &gcb))
{
diff --git a/tools/depends/native/TexturePacker/src/decoder/GifHelper.h b/tools/depends/native/TexturePacker/src/decoder/GifHelper.h
index 6124b69e46296..ce5dca3394b41 100644
--- a/tools/depends/native/TexturePacker/src/decoder/GifHelper.h
+++ b/tools/depends/native/TexturePacker/src/decoder/GifHelper.h
@@ -128,7 +128,7 @@ class GifHelper
bool PrepareTemplate(GifFrame &frame);
void Release();
-#if GIFLIB_MAJOR != 5
+#if GIFLIB_MAJOR < 5
/*
taken from giflib 5.1.0
*/

View File

@@ -0,0 +1,127 @@
From 4dd017b2eae39356cda0d96a2f5743dbb8ccf299 Mon Sep 17 00:00:00 2001
From: fuzzard <fuzzard@kodi.tv>
Date: Sun, 2 Jun 2024 12:13:01 +1000
Subject: [PATCH] RegExp remove unused methods
Upstream: https://github.com/xbmc/xbmc/commit/5df2e57368cf5867f588d00a503eb624e5121460
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
xbmc/utils/RegExp.cpp | 30 ------------------------------
xbmc/utils/RegExp.h | 5 -----
xbmc/utils/test/TestRegExp.cpp | 17 -----------------
3 files changed, 52 deletions(-)
diff --git a/xbmc/utils/RegExp.cpp b/xbmc/utils/RegExp.cpp
index 9667b646a9..40263a28eb 100644
--- a/xbmc/utils/RegExp.cpp
+++ b/xbmc/utils/RegExp.cpp
@@ -485,11 +485,6 @@ int CRegExp::GetSubStart(int iSub) const
return m_iOvector[iSub*2] + m_offset;
}
-int CRegExp::GetSubStart(const std::string& subName) const
-{
- return GetSubStart(GetNamedSubPatternNumber(subName.c_str()));
-}
-
int CRegExp::GetSubLength(int iSub) const
{
if (!IsValidSubNumber(iSub))
@@ -498,11 +493,6 @@ int CRegExp::GetSubLength(int iSub) const
return m_iOvector[(iSub*2)+1] - m_iOvector[(iSub*2)];
}
-int CRegExp::GetSubLength(const std::string& subName) const
-{
- return GetSubLength(GetNamedSubPatternNumber(subName.c_str()));
-}
-
std::string CRegExp::GetMatch(int iSub /* = 0 */) const
{
if (!IsValidSubNumber(iSub))
@@ -516,26 +506,6 @@ std::string CRegExp::GetMatch(int iSub /* = 0 */) const
return m_subject.substr(pos, len);
}
-std::string CRegExp::GetMatch(const std::string& subName) const
-{
- return GetMatch(GetNamedSubPatternNumber(subName.c_str()));
-}
-
-bool CRegExp::GetNamedSubPattern(const char* strName, std::string& strMatch) const
-{
- strMatch.clear();
- int iSub = pcre_get_stringnumber(m_re, strName);
- if (!IsValidSubNumber(iSub))
- return false;
- strMatch = GetMatch(iSub);
- return true;
-}
-
-int CRegExp::GetNamedSubPatternNumber(const char* strName) const
-{
- return pcre_get_stringnumber(m_re, strName);
-}
-
void CRegExp::DumpOvector(int iLog /* = LOGDEBUG */)
{
if (iLog < LOGDEBUG || iLog > LOGNONE)
diff --git a/xbmc/utils/RegExp.h b/xbmc/utils/RegExp.h
index 53f6019a8f..feea89cd0d 100644
--- a/xbmc/utils/RegExp.h
+++ b/xbmc/utils/RegExp.h
@@ -111,15 +111,10 @@ public:
};
int GetSubCount() const { return m_iMatchCount - 1; } // PCRE returns the number of sub-patterns + 1
int GetSubStart(int iSub) const;
- int GetSubStart(const std::string& subName) const;
int GetSubLength(int iSub) const;
- int GetSubLength(const std::string& subName) const;
int GetCaptureTotal() const;
std::string GetMatch(int iSub = 0) const;
- std::string GetMatch(const std::string& subName) const;
const std::string& GetPattern() const { return m_pattern; }
- bool GetNamedSubPattern(const char* strName, std::string& strMatch) const;
- int GetNamedSubPatternNumber(const char* strName) const;
void DumpOvector(int iLog);
/**
* Check is RegExp object is ready for matching
diff --git a/xbmc/utils/test/TestRegExp.cpp b/xbmc/utils/test/TestRegExp.cpp
index d757127417..9435a46aa4 100644
--- a/xbmc/utils/test/TestRegExp.cpp
+++ b/xbmc/utils/test/TestRegExp.cpp
@@ -96,19 +96,6 @@ TEST(TestRegExp, GetPattern)
EXPECT_STREQ("^(Test)\\s*(.*)\\.", regex.GetPattern().c_str());
}
-TEST(TestRegExp, GetNamedSubPattern)
-{
- CRegExp regex;
- std::string match;
-
- EXPECT_TRUE(regex.RegComp("^(?<first>Test)\\s*(?<second>.*)\\."));
- EXPECT_EQ(0, regex.RegFind("Test string."));
- EXPECT_TRUE(regex.GetNamedSubPattern("first", match));
- EXPECT_STREQ("Test", match.c_str());
- EXPECT_TRUE(regex.GetNamedSubPattern("second", match));
- EXPECT_STREQ("string", match.c_str());
-}
-
TEST(TestRegExp, operatorEqual)
{
CRegExp regex, regexcopy;
@@ -117,10 +104,6 @@ TEST(TestRegExp, operatorEqual)
EXPECT_TRUE(regex.RegComp("^(?<first>Test)\\s*(?<second>.*)\\."));
regexcopy = regex;
EXPECT_EQ(0, regexcopy.RegFind("Test string."));
- EXPECT_TRUE(regexcopy.GetNamedSubPattern("first", match));
- EXPECT_STREQ("Test", match.c_str());
- EXPECT_TRUE(regexcopy.GetNamedSubPattern("second", match));
- EXPECT_STREQ("string", match.c_str());
}
class TestRegExpLog : public testing::Test
--
2.47.3

View File

@@ -0,0 +1,192 @@
From 4a4642b1d7562b553f80da279255a9755a9e20f7 Mon Sep 17 00:00:00 2001
From: fuzzard <fuzzard@kodi.tv>
Date: Sun, 2 Jun 2024 13:24:57 +1000
Subject: [PATCH] Introduce PCRE2 dependency
create PCRE2 in tools/depends/target
Create Find module for PCRE2
Upstream: https://github.com/xbmc/xbmc/commit/5c24bf262e5cd75b413fcb4c2c5c144d6971d7cc
[Bernd: backported relevant parts to 21.3-Omega]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
cmake/modules/FindPCRE2.cmake | 151 +++++++++++++++++++++++
tools/depends/target/pcre2/PCRE2-VERSION | 7 ++
2 files changed, 158 insertions(+)
create mode 100644 cmake/modules/FindPCRE2.cmake
create mode 100644 tools/depends/target/pcre2/PCRE2-VERSION
diff --git a/cmake/modules/FindPCRE2.cmake b/cmake/modules/FindPCRE2.cmake
new file mode 100644
index 0000000000..7e50d5f2c1
--- /dev/null
+++ b/cmake/modules/FindPCRE2.cmake
@@ -0,0 +1,151 @@
+#.rst:
+# FindPCRE2
+# --------
+# Finds the PCRE2 library
+#
+# This will define the following imported target::
+#
+# ${APP_NAME_LC}::PCRE2 - The PCRE2 library
+
+if(NOT TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME})
+
+ macro(buildPCRE2)
+ set(PCRE2_VERSION ${${MODULE}_VER})
+ if(WIN32)
+ set(PCRE_DEBUG_POSTFIX d)
+ endif()
+
+ set(patches "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-all-enable_docs_pc.patch"
+ "${CORE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/002-all-cmake-config-installdir.patch")
+
+ generate_patchcommand("${patches}")
+
+ set(CMAKE_ARGS -DBUILD_STATIC_LIBS=ON
+ -DPCRE2_BUILD_PCRE2_8=ON
+ -DPCRE2_BUILD_PCRE2_16=OFF
+ -DPCRE2_BUILD_PCRE2_32=OFF
+ -DPCRE2_SUPPORT_JIT=ON
+ -DPCRE2_SUPPORT_UNICODE=ON
+ -DPCRE2_BUILD_PCRE2GREP=OFF
+ -DPCRE2_BUILD_TESTS=OFF
+ -DENABLE_DOCS=OFF)
+
+ if(CORE_SYSTEM_NAME STREQUAL darwin_embedded)
+ list(APPEND CMAKE_ARGS -DPCRE2_SUPPORT_JIT=OFF)
+ endif()
+
+ set(${CMAKE_FIND_PACKAGE_NAME}_COMPILEDEFINITIONS PCRE2_STATIC)
+
+ BUILD_DEP_TARGET()
+ endmacro()
+
+ include(cmake/scripts/common/ModuleHelpers.cmake)
+
+ set(MODULE_LC pcre2)
+
+ SETUP_BUILD_VARS()
+
+ if(KODI_DEPENDSBUILD OR (WIN32 OR WINDOWS_STORE))
+ set(PCRE2_USE_STATIC_LIBS ON)
+ endif()
+
+ # Check for existing PCRE2. If version >= PCRE2-VERSION file version, dont build
+ find_package(PCRE2 CONFIG COMPONENTS 8BIT QUIET)
+
+ if((PCRE2_VERSION VERSION_LESS ${${MODULE}_VER} AND ENABLE_INTERNAL_PCRE2) OR
+ ((CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) AND ENABLE_INTERNAL_PCRE2))
+ buildPCRE2()
+ else()
+ # if PCRE2::8BIT target exists, it meets version requirements
+ # we only do a pkgconfig search when a suitable cmake config returns nothing
+ if(TARGET PCRE2::8BIT)
+ get_target_property(_PCRE2_CONFIGURATIONS PCRE2::8BIT IMPORTED_CONFIGURATIONS)
+ if(_PCRE2_CONFIGURATIONS)
+ foreach(_pcre2_config IN LISTS _PCRE2_CONFIGURATIONS)
+ # Just set to RELEASE var so select_library_configurations can continue to work its magic
+ string(TOUPPER ${_pcre2_config} _pcre2_config_UPPER)
+ if((NOT ${_pcre2_config_UPPER} STREQUAL "RELEASE") AND
+ (NOT ${_pcre2_config_UPPER} STREQUAL "DEBUG"))
+ get_target_property(PCRE2_LIBRARY_RELEASE PCRE2::8BIT IMPORTED_LOCATION_${_pcre2_config_UPPER})
+ else()
+ get_target_property(PCRE2_LIBRARY_${_pcre2_config_UPPER} PCRE2::8BIT IMPORTED_LOCATION_${_pcre2_config_UPPER})
+ endif()
+ endforeach()
+ else()
+ get_target_property(PCRE2_LIBRARY_RELEASE PCRE2::8BIT IMPORTED_LOCATION)
+ endif()
+ get_target_property(PCRE2_INCLUDE_DIR PCRE2::8BIT INTERFACE_INCLUDE_DIRECTORIES)
+ else()
+ # ToDo: use pkgconfig data imported and drop manual find_path/find_library
+ find_package(PkgConfig)
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PCRE2 libpcre2-8 QUIET)
+ endif()
+
+ find_path(PCRE2_INCLUDE_DIR pcre2.h
+ HINTS ${PC_PCRE2_INCLUDEDIR})
+ find_library(PCRE2_LIBRARY_RELEASE NAMES pcre2-8
+ HINTS ${PC_PCRE2_LIBDIR})
+ set(PCRE2_VERSION ${PC_PCRE2_VERSION})
+ endif()
+ endif()
+
+ include(SelectLibraryConfigurations)
+ select_library_configurations(PCRE2)
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(PCRE2
+ REQUIRED_VARS PCRE2_LIBRARY PCRE2_INCLUDE_DIR
+ VERSION_VAR PCRE2_VERSION)
+
+ if(PCRE2_FOUND)
+ if(TARGET PCRE2::8BIT AND NOT TARGET pcre2)
+ add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} ALIAS PCRE2::8BIT)
+ else()
+ add_library(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} UNKNOWN IMPORTED)
+ if(PCRE2_LIBRARY_RELEASE)
+ set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION_RELEASE "${PCRE2_LIBRARY_RELEASE}")
+ endif()
+ if(PCRE2_LIBRARY_DEBUG)
+ set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
+ IMPORTED_LOCATION_DEBUG "${PCRE2_LIBRARY_DEBUG}")
+ set_property(TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ endif()
+ set_target_properties(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}")
+
+ # Add interface compile definitions. This will usually come from an INTERNAL build being required.
+ if(${CMAKE_FIND_PACKAGE_NAME}_COMPILEDEFINITIONS)
+ set_property(TARGET ${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} APPEND PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS ${${CMAKE_FIND_PACKAGE_NAME}_COMPILEDEFINITIONS})
+ endif()
+ endif()
+ if(TARGET pcre2)
+ add_dependencies(${APP_NAME_LC}::${CMAKE_FIND_PACKAGE_NAME} pcre2)
+ endif()
+
+ # Add internal build target when a Multi Config Generator is used
+ # We cant add a dependency based off a generator expression for targeted build types,
+ # https://gitlab.kitware.com/cmake/cmake/-/issues/19467
+ # therefore if the find heuristics only find the library, we add the internal build
+ # target to the project to allow user to manually trigger for any build type they need
+ # in case only a specific build type is actually available (eg Release found, Debug Required)
+ # This is mainly targeted for windows who required different runtime libs for different
+ # types, and they arent compatible
+ if(_multiconfig_generator)
+ if(NOT TARGET pcre2)
+ buildPCRE2()
+ set_target_properties(pcre2 PROPERTIES EXCLUDE_FROM_ALL TRUE)
+ endif()
+ add_dependencies(build_internal_depends pcre2)
+ endif()
+
+ else()
+ if(PCRE2_FIND_REQUIRED)
+ message(FATAL_ERROR "PCRE2 not found. Possibly use -DENABLE_INTERNAL_PCRE2=ON to build PCRE2")
+ endif()
+ endif()
+endif()
diff --git a/tools/depends/target/pcre2/PCRE2-VERSION b/tools/depends/target/pcre2/PCRE2-VERSION
new file mode 100644
index 0000000000..800eebf0b9
--- /dev/null
+++ b/tools/depends/target/pcre2/PCRE2-VERSION
@@ -0,0 +1,7 @@
+LIBNAME=pcre2
+VERSION=10.42
+ARCHIVE=$(LIBNAME)-$(VERSION).tar.bz2
+SHA512=72fbde87fecec3aa4b47225dd919ea1d55e97f2cbcf02aba26e5a0d3b1ffb58c25a80a9ef069eb99f9cf4e41ba9604ad06a7ec159870e1e875d86820e12256d3
+BYPRODUCT=libpcre2-8.a
+BYPRODUCT_WIN=pcre2-8-static.lib
+
--
2.47.3

View File

@@ -0,0 +1,486 @@
From 250d14b8e3f614147c9465ca6c1b86a3b5a5f7a2 Mon Sep 17 00:00:00 2001
From: fuzzard <fuzzard@kodi.tv>
Date: Sun, 2 Jun 2024 13:56:07 +1000
Subject: [PATCH] Migrate PCRE to PCRE2 and remove PCRE
Upstream: https://github.com/xbmc/xbmc/commit/8e0c4fd22a0b1f9c54b0536960752263f0d5a04f
[Bernd: backported to 21.3-Omega]
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
CMakeLists.txt | 4 +-
xbmc/utils/RegExp.cpp | 202 ++++++++++++++++++-------------------
xbmc/utils/RegExp.h | 22 ++--
xbmc/utils/StringUtils.cpp | 6 +-
4 files changed, 111 insertions(+), 123 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb648e9a27..319b95044f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,7 +92,7 @@ dependent_option(ENABLE_INTERNAL_CEC "Enable internal libcec?")
dependent_option(ENABLE_INTERNAL_FLATBUFFERS "Enable internal flatbuffers?")
dependent_option(ENABLE_INTERNAL_FMT "Enable internal fmt?")
dependent_option(ENABLE_INTERNAL_NFS "Enable internal libnfs?")
-dependent_option(ENABLE_INTERNAL_PCRE "Enable internal pcre?")
+dependent_option(ENABLE_INTERNAL_PCRE2 "Enable internal pcre2?")
dependent_option(ENABLE_INTERNAL_RapidJSON "Enable internal rapidjson?")
# If ENABLE_INTERNAL_FMT is ON, we force ENABLE_INTERNAL_SPDLOG ON as it has a hard
@@ -215,7 +215,7 @@ set(required_deps ASS>=0.15.0
LibDvd
Lzo2
OpenSSL>=1.1.0
- PCRE
+ PCRE2
RapidJSON>=1.0.2
Spdlog
Sqlite3
diff --git a/xbmc/utils/RegExp.cpp b/xbmc/utils/RegExp.cpp
index 40263a28eb..cb620208dc 100644
--- a/xbmc/utils/RegExp.cpp
+++ b/xbmc/utils/RegExp.cpp
@@ -16,27 +16,6 @@
#include <stdlib.h>
#include <string.h>
-using namespace PCRE;
-
-#ifndef PCRE_UCP
-#define PCRE_UCP 0
-#endif // PCRE_UCP
-
-#ifdef PCRE_CONFIG_JIT
-#define PCRE_HAS_JIT_CODE 1
-#endif
-
-#ifndef PCRE_STUDY_JIT_COMPILE
-#define PCRE_STUDY_JIT_COMPILE 0
-#endif
-#ifndef PCRE_INFO_JIT
-// some unused number
-#define PCRE_INFO_JIT 2048
-#endif
-#ifndef PCRE_HAS_JIT_CODE
-#define pcre_free_study(x) pcre_free((x))
-#endif
-
int CRegExp::m_Utf8Supported = -1;
int CRegExp::m_UcpSupported = -1;
int CRegExp::m_JitSupported = -1;
@@ -51,25 +30,24 @@ void CRegExp::InitValues(bool caseless /*= false*/, CRegExp::utf8Mode utf8 /*= a
{
m_utf8Mode = utf8;
m_re = NULL;
- m_sd = NULL;
- m_iOptions = PCRE_DOTALL | PCRE_NEWLINE_ANY;
+ m_ctxt = nullptr;
+ m_iOptions = PCRE2_DOTALL;
if(caseless)
- m_iOptions |= PCRE_CASELESS;
+ m_iOptions |= PCRE2_CASELESS;
if (m_utf8Mode == forceUtf8)
{
if (IsUtf8Supported())
- m_iOptions |= PCRE_UTF8;
+ m_iOptions |= PCRE2_UTF;
if (AreUnicodePropertiesSupported())
- m_iOptions |= PCRE_UCP;
+ m_iOptions |= PCRE2_UCP;
}
m_offset = 0;
m_jitCompiled = false;
m_bMatched = false;
m_iMatchCount = 0;
- m_jitStack = NULL;
-
- memset(m_iOvector, 0, sizeof(m_iOvector));
+ m_iOvector = nullptr;
+ m_jitStack = NULL;
}
CRegExp::CRegExp(bool caseless, CRegExp::utf8Mode utf8, const char *re, studyMode study /*= NoStudy*/)
@@ -225,7 +203,8 @@ bool CRegExp::isCharClassWithUnicode(const std::string& regexp, size_t& pos)
CRegExp::CRegExp(const CRegExp& re)
{
m_re = NULL;
- m_sd = NULL;
+ m_ctxt = nullptr;
+ m_iOvector = nullptr;
m_jitStack = NULL;
m_utf8Mode = re.m_utf8Mode;
m_iOptions = re.m_iOptions;
@@ -240,12 +219,13 @@ CRegExp& CRegExp::operator=(const CRegExp& re)
m_pattern = re.m_pattern;
if (re.m_re)
{
- if (pcre_fullinfo(re.m_re, NULL, PCRE_INFO_SIZE, &size) >= 0)
+ if (pcre2_pattern_info(re.m_re, PCRE2_INFO_SIZE, &size) >= 0)
{
- if ((m_re = (pcre*)malloc(size)))
+ if ((m_re = pcre2_code_copy(re.m_re)))
{
- memcpy(m_re, re.m_re, size);
- memcpy(m_iOvector, re.m_iOvector, OVECCOUNT*sizeof(int));
+ if (re.m_ctxt)
+ m_ctxt = pcre2_match_context_copy(re.m_ctxt);
+ m_iOvector = re.m_iOvector;
m_offset = re.m_offset;
m_iMatchCount = re.m_iMatchCount;
m_bMatched = re.m_bMatched;
@@ -273,18 +253,27 @@ bool CRegExp::RegComp(const char *re, studyMode study /*= NoStudy*/)
m_jitCompiled = false;
m_bMatched = false;
m_iMatchCount = 0;
- const char *errMsg = NULL;
- int errOffset = 0;
- int options = m_iOptions;
+ pcre2_compile_context* ctxt;
+ int errCode;
+ char errMsg[120];
+ PCRE2_SIZE errOffset;
+ uint32_t options = m_iOptions;
if (m_utf8Mode == autoUtf8 && requireUtf8(re))
- options |= (IsUtf8Supported() ? PCRE_UTF8 : 0) | (AreUnicodePropertiesSupported() ? PCRE_UCP : 0);
+ options |=
+ (IsUtf8Supported() ? PCRE2_UTF : 0) | (AreUnicodePropertiesSupported() ? PCRE2_UCP : 0);
Cleanup();
- m_re = pcre_compile(re, options, &errMsg, &errOffset, NULL);
+ ctxt = pcre2_compile_context_create(NULL);
+ pcre2_set_newline(ctxt, PCRE2_NEWLINE_ANY);
+ m_re = pcre2_compile(reinterpret_cast<PCRE2_SPTR>(re), PCRE2_ZERO_TERMINATED, options, &errCode,
+ &errOffset, ctxt);
+ pcre2_compile_context_free(ctxt);
+
if (!m_re)
{
m_pattern.clear();
+ pcre2_get_error_message(errCode, reinterpret_cast<PCRE2_UCHAR*>(errMsg), sizeof(errMsg));
CLog::Log(LOGERROR, "PCRE: {}. Compilation failed at offset {} in expression '{}'", errMsg,
errOffset, re);
return false;
@@ -295,23 +284,12 @@ bool CRegExp::RegComp(const char *re, studyMode study /*= NoStudy*/)
if (study)
{
const bool jitCompile = (study == StudyWithJitComp) && IsJitSupported();
- const int studyOptions = jitCompile ? PCRE_STUDY_JIT_COMPILE : 0;
-
- m_sd = pcre_study(m_re, studyOptions, &errMsg);
- if (errMsg != NULL)
- {
- CLog::Log(LOGWARNING, "{}: PCRE error \"{}\" while studying expression", __FUNCTION__,
- errMsg);
- if (m_sd != NULL)
- {
- pcre_free_study(m_sd);
- m_sd = NULL;
- }
- }
- else if (jitCompile)
+ if (jitCompile)
{
- int jitPresent = 0;
- m_jitCompiled = (pcre_fullinfo(m_re, m_sd, PCRE_INFO_JIT, &jitPresent) == 0 && jitPresent == 1);
+ pcre2_jit_compile(m_re, PCRE2_JIT_COMPLETE);
+ size_t jitPresent = 0;
+ m_jitCompiled =
+ (pcre2_pattern_info(m_re, PCRE2_INFO_JITSIZE, &jitPresent) == 0 && jitPresent > 0);
}
}
@@ -325,6 +303,9 @@ int CRegExp::RegFind(const char *str, unsigned int startoffset /*= 0*/, int maxN
int CRegExp::PrivateRegFind(size_t bufferLen, const char *str, unsigned int startoffset /* = 0*/, int maxNumberOfCharsToTest /*= -1*/)
{
+ pcre2_match_data* md;
+ PCRE2_SIZE offset;
+
m_offset = 0;
m_bMatched = false;
m_iMatchCount = 0;
@@ -347,37 +328,46 @@ int CRegExp::PrivateRegFind(size_t bufferLen, const char *str, unsigned int star
return -1;
}
-#ifdef PCRE_HAS_JIT_CODE
+ if (!m_ctxt)
+ m_ctxt = pcre2_match_context_create(NULL);
+
if (m_jitCompiled && !m_jitStack)
{
- m_jitStack = pcre_jit_stack_alloc(32*1024, 512*1024);
+ m_jitStack = pcre2_jit_stack_create(32 * 1024, 512 * 1024, NULL);
if (m_jitStack == NULL)
CLog::Log(LOGWARNING, "{}: can't allocate address space for JIT stack", __FUNCTION__);
- pcre_assign_jit_stack(m_sd, NULL, m_jitStack);
+ pcre2_jit_stack_assign(m_ctxt, NULL, m_jitStack);
}
-#endif
if (maxNumberOfCharsToTest >= 0)
bufferLen = std::min<size_t>(bufferLen, startoffset + maxNumberOfCharsToTest);
m_subject.assign(str + startoffset, bufferLen - startoffset);
- int rc = pcre_exec(m_re, NULL, m_subject.c_str(), m_subject.length(), 0, 0, m_iOvector, OVECCOUNT);
+ md = pcre2_match_data_create(OVECCOUNT, nullptr);
+ int rc = pcre2_match(m_re, reinterpret_cast<PCRE2_SPTR>(m_subject.c_str()), m_subject.length(), 0,
+ 0, md, m_ctxt);
+ m_iOvector = pcre2_get_ovector_pointer(md);
+ offset = pcre2_get_startchar(md);
+ pcre2_match_data_free(md);
if (rc<1)
{
static const int fragmentLen = 80; // length of excerpt before erroneous char for log
switch(rc)
{
- case PCRE_ERROR_NOMATCH:
- return -1;
+ case PCRE2_ERROR_NOMATCH:
+ return -1;
- case PCRE_ERROR_MATCHLIMIT:
- CLog::Log(LOGERROR, "PCRE: Match limit reached");
- return -1;
+ case PCRE2_ERROR_MATCHLIMIT:
+ CLog::Log(LOGERROR, "PCRE: Match limit reached");
+ return -1;
-#ifdef PCRE_ERROR_SHORTUTF8
- case PCRE_ERROR_SHORTUTF8:
+ case PCRE2_ERROR_UTF8_ERR1:
+ case PCRE2_ERROR_UTF8_ERR2:
+ case PCRE2_ERROR_UTF8_ERR3:
+ case PCRE2_ERROR_UTF8_ERR4:
+ case PCRE2_ERROR_UTF8_ERR5:
{
const size_t startPos = (m_subject.length() > fragmentLen) ? CUtf8Utils::RFindValidUtf8Char(m_subject, m_subject.length() - fragmentLen) : 0;
if (startPos != std::string::npos)
@@ -389,28 +379,44 @@ int CRegExp::PrivateRegFind(size_t bufferLen, const char *str, unsigned int star
CLog::Log(LOGERROR, "PCRE: Bad UTF-8 character at the end of string");
return -1;
}
-#endif
- case PCRE_ERROR_BADUTF8:
+ case PCRE2_ERROR_UTF8_ERR6:
+ case PCRE2_ERROR_UTF8_ERR7:
+ case PCRE2_ERROR_UTF8_ERR8:
+ case PCRE2_ERROR_UTF8_ERR9:
+ case PCRE2_ERROR_UTF8_ERR10:
+ case PCRE2_ERROR_UTF8_ERR11:
+ case PCRE2_ERROR_UTF8_ERR12:
+ case PCRE2_ERROR_UTF8_ERR13:
+ case PCRE2_ERROR_UTF8_ERR14:
+ case PCRE2_ERROR_UTF8_ERR15:
+ case PCRE2_ERROR_UTF8_ERR16:
+ case PCRE2_ERROR_UTF8_ERR17:
+ case PCRE2_ERROR_UTF8_ERR18:
+ case PCRE2_ERROR_UTF8_ERR19:
+ case PCRE2_ERROR_UTF8_ERR20:
+ case PCRE2_ERROR_UTF8_ERR21:
{
+ char errbuf[120];
+
+ pcre2_get_error_message(rc, reinterpret_cast<PCRE2_UCHAR*>(errbuf), sizeof(errbuf));
const size_t startPos = (m_iOvector[0] > fragmentLen) ? CUtf8Utils::RFindValidUtf8Char(m_subject, m_iOvector[0] - fragmentLen) : 0;
- if (m_iOvector[0] >= 0 && startPos != std::string::npos)
+ if ((int)m_iOvector[0] >= 0 && startPos != std::string::npos)
CLog::Log(LOGERROR,
"PCRE: Bad UTF-8 character, error code: {}, position: {}. Text before bad "
"char: \"{}\"",
- m_iOvector[1], m_iOvector[0],
- m_subject.substr(startPos, m_iOvector[0] - startPos + 1));
+ errbuf, offset, m_subject.substr(startPos, m_iOvector[0] - startPos + 1));
else
- CLog::Log(LOGERROR, "PCRE: Bad UTF-8 character, error code: {}, position: {}",
- m_iOvector[1], m_iOvector[0]);
+ CLog::Log(LOGERROR, "PCRE: Bad UTF-8 character, error code: {}, position: {}", errbuf,
+ offset);
return -1;
}
- case PCRE_ERROR_BADUTF8_OFFSET:
- CLog::Log(LOGERROR, "PCRE: Offset is pointing to the middle of UTF-8 character");
- return -1;
+ case PCRE2_ERROR_BADUTFOFFSET:
+ CLog::Log(LOGERROR, "PCRE: Offset is pointing to the middle of UTF-8 character");
+ return -1;
- default:
- CLog::Log(LOGERROR, "PCRE: Unknown error: {}", rc);
- return -1;
+ default:
+ CLog::Log(LOGERROR, "PCRE: Unknown error: {}", rc);
+ return -1;
}
}
m_offset = startoffset;
@@ -423,7 +429,7 @@ int CRegExp::GetCaptureTotal() const
{
int c = -1;
if (m_re)
- pcre_fullinfo(m_re, NULL, PCRE_INFO_CAPTURECOUNT, &c);
+ pcre2_pattern_info(m_re, PCRE2_INFO_CAPTURECOUNT, &c);
return c;
}
@@ -528,23 +534,21 @@ void CRegExp::Cleanup()
{
if (m_re)
{
- pcre_free(m_re);
- m_re = NULL;
+ pcre2_code_free(m_re);
+ m_re = nullptr;
}
- if (m_sd)
+ if (m_ctxt)
{
- pcre_free_study(m_sd);
- m_sd = NULL;
+ pcre2_match_context_free(m_ctxt);
+ m_ctxt = nullptr;
}
-#ifdef PCRE_HAS_JIT_CODE
if (m_jitStack)
{
- pcre_jit_stack_free(m_jitStack);
+ pcre2_jit_stack_free(m_jitStack);
m_jitStack = NULL;
}
-#endif
}
inline bool CRegExp::IsValidSubNumber(int iSub) const
@@ -557,7 +561,7 @@ bool CRegExp::IsUtf8Supported(void)
{
if (m_Utf8Supported == -1)
{
- if (pcre_config(PCRE_CONFIG_UTF8, &m_Utf8Supported) != 0)
+ if (pcre2_config(PCRE2_CONFIG_UNICODE, &m_Utf8Supported) < 0)
m_Utf8Supported = 0;
}
@@ -566,13 +570,11 @@ bool CRegExp::IsUtf8Supported(void)
bool CRegExp::AreUnicodePropertiesSupported(void)
{
-#if defined(PCRE_CONFIG_UNICODE_PROPERTIES) && PCRE_UCP != 0
if (m_UcpSupported == -1)
{
- if (pcre_config(PCRE_CONFIG_UNICODE_PROPERTIES, &m_UcpSupported) != 0)
+ if (pcre2_config(PCRE2_CONFIG_UNICODE, &m_UcpSupported) < 0)
m_UcpSupported = 0;
}
-#endif
return m_UcpSupported == 1;
}
@@ -595,13 +597,13 @@ bool CRegExp::LogCheckUtf8Support(void)
if (!utf8FullSupport)
{
+ char ver[24];
+
+ pcre2_config(PCRE2_CONFIG_VERSION, ver);
CLog::Log(LOGINFO,
- "Consider installing PCRE lib version 8.10 or later with enabled Unicode properties "
+ "Consider installing PCRE lib version 10.10 or later with enabled Unicode properties "
"and UTF-8 support. Your PCRE lib version: {}",
- PCRE::pcre_version());
-#if PCRE_UCP == 0
- CLog::Log(LOGINFO, "You will need to rebuild XBMC after PCRE lib update.");
-#endif
+ ver);
}
return utf8FullSupport;
@@ -611,9 +613,7 @@ bool CRegExp::IsJitSupported(void)
{
if (m_JitSupported == -1)
{
-#ifdef PCRE_HAS_JIT_CODE
- if (pcre_config(PCRE_CONFIG_JIT, &m_JitSupported) != 0)
-#endif
+ if (pcre2_config(PCRE2_CONFIG_JIT, &m_JitSupported) < 0)
m_JitSupported = 0;
}
diff --git a/xbmc/utils/RegExp.h b/xbmc/utils/RegExp.h
index feea89cd0d..90d3db541e 100644
--- a/xbmc/utils/RegExp.h
+++ b/xbmc/utils/RegExp.h
@@ -13,16 +13,8 @@
#include <string>
#include <vector>
-/* make sure stdlib.h is included before including pcre.h inside the
- namespace; this works around stdlib.h definitions also living in
- the PCRE namespace */
-#include <stdlib.h>
-
-namespace PCRE {
-struct real_pcre_jit_stack; // forward declaration for PCRE without JIT
-typedef struct real_pcre_jit_stack pcre_jit_stack;
-#include <pcre.h>
-}
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
class CRegExp
{
@@ -138,17 +130,17 @@ private:
void Cleanup();
inline bool IsValidSubNumber(int iSub) const;
- PCRE::pcre* m_re;
- PCRE::pcre_extra* m_sd;
+ pcre2_code* m_re;
+ pcre2_match_context* m_ctxt;
static const int OVECCOUNT=(m_MaxNumOfBackrefrences + 1) * 3;
unsigned int m_offset;
- int m_iOvector[OVECCOUNT];
+ PCRE2_SIZE* m_iOvector;
utf8Mode m_utf8Mode;
int m_iMatchCount;
- int m_iOptions;
+ uint32_t m_iOptions;
bool m_jitCompiled;
bool m_bMatched;
- PCRE::pcre_jit_stack* m_jitStack;
+ pcre2_jit_stack* m_jitStack;
std::string m_subject;
std::string m_pattern;
static int m_Utf8Supported;
diff --git a/xbmc/utils/StringUtils.cpp b/xbmc/utils/StringUtils.cpp
index 2c77e58ebd..d390113dd7 100644
--- a/xbmc/utils/StringUtils.cpp
+++ b/xbmc/utils/StringUtils.cpp
@@ -30,6 +30,7 @@
#include "LangInfo.h"
#include "StringUtils.h"
#include "XBDateTime.h"
+#include "utils/RegExp.h"
#include <algorithm>
#include <array>
@@ -46,11 +47,6 @@
#include <fstrcmp.h>
#include <memory.h>
-// don't move or std functions end up in PCRE namespace
-// clang-format off
-#include "utils/RegExp.h"
-// clang-format on
-
#define FORMAT_BLOCK_SIZE 512 // # of bytes for initial allocation for printf
namespace
--
2.47.3

View File

@@ -0,0 +1,41 @@
From 1695ba12380272056f369f434747839b2ae38d91 Mon Sep 17 00:00:00 2001
From: fossdd <fossdd@pwned.life>
Date: Sat, 22 Feb 2025 20:59:28 +0100
Subject: [PATCH] [cmake] Set ARCH to CPU by default
Reduces complexity of redundant architecture names and allows building
for other architectures implicitly.
Upstream: https://github.com/xbmc/xbmc/commit/1695ba12380272056f369f434747839b2ae38d91
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
cmake/scripts/linux/ArchSetup.cmake | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/cmake/scripts/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake
index ab142177c8..f29a870a1e 100644
--- a/cmake/scripts/linux/ArchSetup.cmake
+++ b/cmake/scripts/linux/ArchSetup.cmake
@@ -37,17 +37,8 @@ else()
elseif(CPU MATCHES aarch64 OR CPU MATCHES arm64)
set(ARCH aarch64)
set(NEON True)
- elseif(CPU MATCHES riscv64)
- set(ARCH riscv64)
- set(NEON False)
- elseif(CPU MATCHES ppc64le)
- set(ARCH ppc64le)
- set(NEON False)
- elseif(CPU MATCHES loongarch64)
- set(ARCH loongarch64)
- set(NEON False)
else()
- message(SEND_ERROR "Unknown CPU: ${CPU}")
+ set(ARCH ${CPU})
endif()
endif()
--
2.47.3

376
package/kodi/Config.in Normal file
View File

@@ -0,0 +1,376 @@
config BR2_PACKAGE_KODI_ARCH_SUPPORTS
bool
default y if BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS
default y if BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS
# i386: needs sse (see upstream PR 10351)
depends on !(BR2_i386 && !BR2_X86_CPU_HAS_SSE)
# m68k not supported upstream
depends on !BR2_m68k
depends on BR2_USE_MMU # libcdio, and others
comment "kodi needs python3 w/ .py modules, a uClibc or glibc toolchain w/ C++, threads, wchar, dynamic library, gcc >= 9.x, host gcc >= 9.x"
depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS \
|| !BR2_USE_WCHAR || BR2_STATIC_LIBS \
|| !BR2_TOOLCHAIN_GCC_AT_LEAST_9 \
|| !BR2_HOST_GCC_AT_LEAST_9 \
|| BR2_TOOLCHAIN_USES_MUSL \
|| !BR2_PACKAGE_PYTHON3 \
|| BR2_PACKAGE_PYTHON3_PYC_ONLY
config BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
bool
config BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_GBM
bool
default y
depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
depends on BR2_PACKAGE_HAS_LIBGBM
depends on BR2_PACKAGE_LIBGBM_HAS_FEATURE_DMA_BUF
depends on BR2_PACKAGE_HAS_LIBUDEV # libinput
select BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
comment "kodi needs libudev support for gbm"
depends on !BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
config BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_WAYLAND
bool
default y
depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
depends on BR2_HOST_GCC_AT_LEAST_4_9 # waylandpp
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # waylandpp
depends on BR2_INSTALL_LIBSTDCPP # waylandpp
depends on BR2_PACKAGE_WAYLAND # waylandpp
select BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
config BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_X11
bool
default y
depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
depends on BR2_PACKAGE_XORG7
select BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
comment "kodi needs an OpenGL EGL backend with OpenGL or GLES support"
depends on !BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
menuconfig BR2_PACKAGE_KODI
bool "kodi"
depends on BR2_INSTALL_LIBSTDCPP
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libass -> harfbuzz
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9 # C++17
depends on BR2_HOST_GCC_AT_LEAST_9 # C++17
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on !BR2_TOOLCHAIN_USES_MUSL
depends on BR2_USE_WCHAR
depends on !BR2_STATIC_LIBS # gnutls, python3 and others
depends on BR2_PACKAGE_HAS_LIBEGL
depends on BR2_PACKAGE_KODI_ARCH_SUPPORTS
depends on BR2_PACKAGE_KODI_PLATFORM_SUPPORTS
depends on BR2_PACKAGE_PYTHON3
depends on !BR2_PACKAGE_PYTHON3_PYC_ONLY
select BR2_HOST_CMAKE_AT_LEAST_3_24
select BR2_PACKAGE_FFMPEG
select BR2_PACKAGE_FFMPEG_GPL
select BR2_PACKAGE_FFMPEG_POSTPROC
select BR2_PACKAGE_FFMPEG_SWSCALE
select BR2_PACKAGE_FLATBUFFERS
select BR2_PACKAGE_FMT
select BR2_PACKAGE_FONTCONFIG # needed for libass
select BR2_PACKAGE_FREETYPE
select BR2_PACKAGE_FSTRCMP
select BR2_PACKAGE_GIFLIB
select BR2_PACKAGE_JPEG
select BR2_PACKAGE_LIBASS
select BR2_PACKAGE_LIBCDIO
select BR2_PACKAGE_LIBCROSSGUID
select BR2_PACKAGE_LIBCURL
select BR2_PACKAGE_LIBDRM
select BR2_PACKAGE_LIBFRIBIDI
select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
select BR2_PACKAGE_LIBICONV_EXTRA_ENCODINGS if !BR2_ENABLE_LOCALE
select BR2_PACKAGE_LIBPLIST
select BR2_PACKAGE_LIBPNG
select BR2_PACKAGE_LZO
select BR2_PACKAGE_OPENSSL
select BR2_PACKAGE_PCRE2
select BR2_PACKAGE_PYTHON3_2TO3
select BR2_PACKAGE_PYTHON3_PYEXPAT
select BR2_PACKAGE_PYTHON3_SQLITE
select BR2_PACKAGE_PYTHON3_SSL
select BR2_PACKAGE_PYTHON3_UNICODEDATA
select BR2_PACKAGE_PYTHON3_ZLIB
select BR2_PACKAGE_RAPIDJSON
select BR2_PACKAGE_SPDLOG
select BR2_PACKAGE_SQLITE
select BR2_PACKAGE_TAGLIB
select BR2_PACKAGE_TINYXML
select BR2_PACKAGE_TINYXML2
select BR2_PACKAGE_ZLIB
select BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY if BR2_TOOLCHAIN_USES_GLIBC # runtime UTF conversion support
select BR2_PACKAGE_LIBDISPLAY_INFO if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_GBM
select BR2_PACKAGE_LIBINPUT if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_GBM
select BR2_PACKAGE_LIBXKBCOMMON if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_GBM
select BR2_PACKAGE_LIBXKBCOMMON if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_WAYLAND
select BR2_PACKAGE_WAYLANDPP if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_WAYLAND
select BR2_PACKAGE_XLIB_LIBXRANDR if BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_X11
help
Kodi is an award-winning free and open source (GPL) software
media player and entertainment hub for digital media.
http://kodi.tv
if BR2_PACKAGE_KODI
config BR2_PACKAGE_KODI_ALSA_LIB
bool "alsa"
select BR2_PACKAGE_ALSA_LIB
help
Enable alsa support.
config BR2_PACKAGE_KODI_AVAHI
bool "avahi"
select BR2_PACKAGE_AVAHI
select BR2_PACKAGE_AVAHI_DAEMON
help
Enable Avahi support.
Select this if you want Kodi to support Bonjour protocol.
config BR2_PACKAGE_KODI_BLUEZ
bool "bluetooth"
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_18 # bluez5_utils hid plugin
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # bluez5_utils
select BR2_PACKAGE_BLUEZ5_UTILS
select BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_AUDIO
select BR2_PACKAGE_BLUEZ5_UTILS_PLUGINS_HID
help
Enable bluetooth support
comment "bluetooth support needs a toolchain w/ headers >= 3.18"
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_18
config BR2_PACKAGE_KODI_DBUS
bool "dbus"
select BR2_PACKAGE_DBUS
help
Enable D-Bus support
config BR2_PACKAGE_KODI_EVENTCLIENTS
bool "eventclients"
help
Enable event clients support
https://github.com/xbmc/xbmc/blob/master/tools/EventClients/README.txt
config BR2_PACKAGE_KODI_LIBBLURAY
bool "blu-ray"
select BR2_PACKAGE_LIBBLURAY
help
Enable Blu-ray input support.
Select this if you want to play back Blu-ray content.
config BR2_PACKAGE_KODI_LIBCEC
bool "hdmi cec"
select BR2_PACKAGE_LIBCEC
help
Enable CEC (Consumer Electronics Control) support.
Select this if you want Kodi to support HDMI CEC.
config BR2_PACKAGE_KODI_LCMS2
bool "lcms2"
select BR2_PACKAGE_LCMS2
help
Enable color management support.
config BR2_PACKAGE_KODI_LIBMICROHTTPD
bool "web server"
select BR2_PACKAGE_LIBMICROHTTPD
help
Enable webserver feature
config BR2_PACKAGE_KODI_LIBNFS
bool "nfs"
# libnfs -> libtirpc
depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC || BR2_TOOLCHAIN_HAS_THREADS
select BR2_PACKAGE_LIBNFS
help
Enable NFS server support.
comment "nfs support needs a toolchain w/ threads support"
depends on !(BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_HAS_NATIVE_RPC)
config BR2_PACKAGE_KODI_MYSQL
bool "mysql"
select BR2_PACKAGE_MARIADB
help
Enable MySQL support
choice
prompt "render system"
default BR2_PACKAGE_KODI_RENDER_SYSTEM_GL
config BR2_PACKAGE_KODI_RENDER_SYSTEM_GL
bool "OpenGL"
depends on BR2_PACKAGE_HAS_LIBGL
select BR2_PACKAGE_LIBGLU
config BR2_PACKAGE_KODI_RENDER_SYSTEM_GLES
bool "GLES"
depends on BR2_PACKAGE_HAS_LIBGLES
endchoice
config BR2_PACKAGE_KODI_PIPEWIRE
bool "pipewire"
depends on BR2_PACKAGE_PIPEWIRE
help
Enable Pipewire support.
config BR2_PACKAGE_KODI_PULSEAUDIO
bool "pulseaudio"
depends on BR2_PACKAGE_PULSEAUDIO_HAS_ATOMIC
# Pulseaudio support in kodi needs glib support in Pulseaudio,
# see FindPulseAudio.cmake. Kodi meets all dependencies of
# libglib2, so there is no need to propagate them here.
select BR2_PACKAGE_LIBGLIB2
select BR2_PACKAGE_PULSEAUDIO
help
Enable Pulseaudio support.
config BR2_PACKAGE_KODI_LIBSHAIRPLAY
bool "shairport"
select BR2_PACKAGE_LIBSHAIRPLAY
help
Enable Shairport support.
Select this if you want to stream content from an Apple
device.
config BR2_PACKAGE_KODI_LIBSMBCLIENT
bool "samba"
depends on BR2_PACKAGE_SAMBA4
help
Enable Samba support
config BR2_PACKAGE_KODI_LIBUSB
bool "usb"
# https://github.com/xbmc/xbmc/blob/Jarvis/configure.ac#L1554
# "if libudev is available, we don't need libusb"
depends on !BR2_PACKAGE_HAS_LIBUDEV
select BR2_PACKAGE_LIBUSB
select BR2_PACKAGE_LIBUSB_COMPAT
help
Enable libusb support.
config BR2_PACKAGE_KODI_LIBVDPAU
bool "vdpau"
depends on BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_X11 && \
BR2_PACKAGE_KODI_RENDER_SYSTEM_GL
select BR2_PACKAGE_LIBVDPAU
help
Enable libvdpau support.
comment "libvdpau support needs platform 'X11/OpenGL'"
depends on !BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_X11 || \
!BR2_PACKAGE_KODI_RENDER_SYSTEM_GL
config BR2_PACKAGE_KODI_UPNP
bool "upnp"
help
Enable UPnP support
config BR2_PACKAGE_KODI_OPTICALDRIVE
bool "optical drives"
help
Add support for optical drives, to read e.g. DVDs...
menu "Audio decoder addons"
source "package/kodi-audiodecoder-modplug/Config.in"
source "package/kodi-audiodecoder-nosefart/Config.in"
source "package/kodi-audiodecoder-sidplay/Config.in"
source "package/kodi-audiodecoder-snesapu/Config.in"
source "package/kodi-audiodecoder-stsound/Config.in"
source "package/kodi-audiodecoder-timidity/Config.in"
source "package/kodi-audiodecoder-vgmstream/Config.in"
endmenu
menu "Audio encoder addons"
source "package/kodi-audioencoder-flac/Config.in"
source "package/kodi-audioencoder-lame/Config.in"
source "package/kodi-audioencoder-vorbis/Config.in"
source "package/kodi-audioencoder-wav/Config.in"
endmenu
menu "Image decoder addons"
source "package/kodi-imagedecoder-heif/Config.in"
source "package/kodi-imagedecoder-raw/Config.in"
endmenu
menu "Peripheral addons"
source "package/kodi-peripheral-joystick/Config.in"
source "package/kodi-peripheral-xarcade/Config.in"
endmenu
menu "Inputstream addons"
source "package/kodi-inputstream-adaptive/Config.in"
source "package/kodi-inputstream-ffmpegdirect/Config.in"
source "package/kodi-inputstream-rtmp/Config.in"
endmenu
menu "PVR addons"
source "package/kodi-pvr-argustv/Config.in"
source "package/kodi-pvr-dvblink/Config.in"
source "package/kodi-pvr-dvbviewer/Config.in"
source "package/kodi-pvr-filmon/Config.in"
source "package/kodi-pvr-hts/Config.in"
source "package/kodi-pvr-iptvsimple/Config.in"
source "package/kodi-pvr-mediaportal-tvserver/Config.in"
source "package/kodi-pvr-mythtv/Config.in"
source "package/kodi-pvr-nextpvr/Config.in"
source "package/kodi-pvr-njoy/Config.in"
source "package/kodi-pvr-octonet/Config.in"
source "package/kodi-pvr-pctv/Config.in"
source "package/kodi-pvr-plutotv/Config.in"
source "package/kodi-pvr-stalker/Config.in"
source "package/kodi-pvr-vbox/Config.in"
source "package/kodi-pvr-vdr-vnsi/Config.in"
source "package/kodi-pvr-vuplus/Config.in"
source "package/kodi-pvr-waipu/Config.in"
source "package/kodi-pvr-wmc/Config.in"
source "package/kodi-pvr-zattoo/Config.in"
endmenu
menu "Screensavers"
source "package/kodi-screensaver-asteroids/Config.in"
source "package/kodi-screensaver-asterwave/Config.in"
source "package/kodi-screensaver-biogenesis/Config.in"
source "package/kodi-screensaver-cpblobs/Config.in"
source "package/kodi-screensaver-greynetic/Config.in"
source "package/kodi-screensaver-matrixtrails/Config.in"
source "package/kodi-screensaver-pingpong/Config.in"
source "package/kodi-screensaver-pyro/Config.in"
source "package/kodi-screensaver-rsxs/Config.in"
source "package/kodi-screensaver-stars/Config.in"
endmenu
menu "Skins"
source "package/kodi-skin-confluence/Config.in"
endmenu
menu "Virtual file systems"
source "package/kodi-vfs-libarchive/Config.in"
source "package/kodi-vfs-rar/Config.in"
source "package/kodi-vfs-sftp/Config.in"
endmenu
menu "Visualisations"
source "package/kodi-visualisation-fishbmc/Config.in"
source "package/kodi-visualisation-goom/Config.in"
source "package/kodi-visualisation-matrix/Config.in"
source "package/kodi-visualisation-shadertoy/Config.in"
source "package/kodi-visualisation-spectrum/Config.in"
source "package/kodi-visualisation-starburst/Config.in"
source "package/kodi-visualisation-waveform/Config.in"
endmenu
endif # BR2_PACKAGE_KODI

39
package/kodi/S50kodi Normal file
View File

@@ -0,0 +1,39 @@
#!/bin/sh
#
# Starts Kodi
#
BIN=/usr/bin/br-kodi
KODI=/usr/lib/kodi/kodi.bin
KODI_ARGS="--standalone -fs -n"
PIDFILE=/var/run/kodi.pid
start() {
printf "Starting Kodi: "
start-stop-daemon -S -q -b -m -p $PIDFILE --exec $BIN -- $KODI $KODI_ARGS
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
stop() {
printf "Stopping Kodi: "
start-stop-daemon -K -q -p $PIDFILE
[ $? = 0 ] && echo "OK" || echo "FAIL"
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

38
package/kodi/br-kodi Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
# We're called with the real Kodi executable as
# first argument, followed by any Kodi extra args
KODI="${1}"
shift
# shellcheck disable=SC2329 # https://www.shellcheck.net/wiki/SC2329
# shellcheck disable=SC2317 # shellcheck 0.9.0 "spammy"
# In case someone asked we terminate, just kill
# the Kodi process
trap_kill() {
LOOP=0
killall "${KODI##*/}"
}
trap trap_kill INT QUIT TERM
LOOP=1
while [ ${LOOP} -eq 1 ]; do
# Hack: BusyBox ash does not catch signals while a non-builtin
# is running, and only catches the signal when the non-builtin
# command ends. So, we just background the Kodi binary, and wait
# for it. But BusyBox' ash's wait builtin does not return the
# exit code even if there was only one job (which is correct
# for POSIX). So we explicitly wait for the Kodi job
"${KODI}" "${@}" &
wait %1
ret=$?
case "${ret}" in
0) ;;
64) poweroff; LOOP=0;;
66) reboot; LOOP=0;;
*) # Crash
sleep 1
;;
esac
done
exit "${ret}"

10
package/kodi/kodi.hash Normal file
View File

@@ -0,0 +1,10 @@
# From https://github.com/xbmc/xbmc/blob/Omega/xbmc/interfaces/swig/CMakeLists.txt
sha512 60d1aea85008a438a9498178dc2137385653f1ea294e7e257959e9e0f94382e160e217e1090047c2a944e328cf46e8ebcfc4b015f7d0cb9f2fcf9d880c6c1344 apache-groovy-binary-4.0.26.zip
sha512 8927a406a1bd084b548f89cf15fe4bc7567dcaa50ae8abae54e9c883c1574c648fcc8ad6c3abaa381dfbdf1801727ac5e6c4572063203a1dfac293d122282f05 commons-lang3-3.17.0-bin.tar.gz
sha512 a51667463e88b2d017c3baebb9bbe42c4e50cba96ffe19c89680e82002a4db8b9007daff75f8dbf8bf3725be13a3f03f3c2bc4e1f11e8e02dcab4408abdb44a1 commons-text-1.13.0-bin.tar.gz
# Locally computed
sha256 a60afcb556e4a00cb19fc35b7e77758107c9a8096c6ce9b66af5f92396be31aa kodi-21.3-Omega.tar.gz
sha256 f38c4a4e7a4f4da6d8e83b8852489aa3bb6588a915dc41f5ee89d9aad305a06e kodi-libdvdcss-1.4.3-Next-Nexus-Alpha2-2.tar.gz
sha256 584f62a3896794408d46368e2ecf2c6217ab9c676ce85921b2d68b8961f49dfc kodi-libdvdnav-6.1.1-Next-Nexus-Alpha2-2.tar.gz
sha256 719130091e3adc9725ba72df808f24a14737a009dca5a4c38c601c0c76449b62 kodi-libdvdread-6.1.3-Next-Nexus-Alpha2-2.tar.gz
sha256 9d2396ef3e091d3b82bc84143e070700412984e8589513570f54e0675d1e8851 LICENSE.md

440
package/kodi/kodi.mk Normal file
View File

@@ -0,0 +1,440 @@
################################################################################
#
# kodi
#
################################################################################
# When updating the version, please also update kodi-jsonschemabuilder
# and kodi-texturepacker
KODI_VERSION_MAJOR = 21.3
KODI_VERSION_NAME = Omega
KODI_VERSION = $(KODI_VERSION_MAJOR)-$(KODI_VERSION_NAME)
KODI_SITE = $(call github,xbmc,xbmc,$(KODI_VERSION))
KODI_LICENSE = GPL-2.0
KODI_LICENSE_FILES = LICENSE.md
KODI_CPE_ID_VENDOR = kodi
KODI_CPE_ID_VERSION = $(KODI_VERSION_MAJOR)
# needed for binary addons
KODI_INSTALL_STAGING = YES
# kodi recommends building out-of-source
KODI_SUPPORTS_IN_SOURCE_BUILD = NO
KODI_DEPENDENCIES = \
ffmpeg \
flatbuffers \
fmt \
fontconfig \
freetype \
fstrcmp \
giflib \
host-flatbuffers \
host-gawk \
host-gettext \
host-gperf \
host-kodi-jsonschemabuilder \
host-kodi-texturepacker \
host-nasm \
host-openjdk-bin \
host-swig \
host-xmlstarlet \
jpeg \
libass \
libcdio \
libcrossguid \
libcurl \
libdrm \
libegl \
libfribidi \
libplist \
libpng \
lzo \
openssl \
pcre2 \
python3 \
rapidjson \
spdlog \
sqlite \
taglib \
tinyxml \
tinyxml2 \
zlib
# taken from tools/depends/target/*/*-VERSION
KODI_APACHE_GROOVY_VERSION = 4.0.26
KODI_COMMONS_LANG3_VERSION = 3.17.0
KODI_COMMONS_TEXT_VERSION = 1.13.0
KODI_LIBDVDCSS_VERSION = 1.4.3-Next-Nexus-Alpha2-2
KODI_LIBDVDNAV_VERSION = 6.1.1-Next-Nexus-Alpha2-2
KODI_LIBDVDREAD_VERSION = 6.1.3-Next-Nexus-Alpha2-2
KODI_EXTRA_DOWNLOADS += \
https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-binary-$(KODI_APACHE_GROOVY_VERSION).zip \
https://archive.apache.org/dist/commons/lang/binaries/commons-lang3-$(KODI_COMMONS_LANG3_VERSION)-bin.tar.gz \
https://archive.apache.org/dist/commons/text/binaries/commons-text-$(KODI_COMMONS_TEXT_VERSION)-bin.tar.gz \
$(call github,xbmc,libdvdcss,$(KODI_LIBDVDCSS_VERSION))/kodi-libdvdcss-$(KODI_LIBDVDCSS_VERSION).tar.gz \
$(call github,xbmc,libdvdnav,$(KODI_LIBDVDNAV_VERSION))/kodi-libdvdnav-$(KODI_LIBDVDNAV_VERSION).tar.gz \
$(call github,xbmc,libdvdread,$(KODI_LIBDVDREAD_VERSION))/kodi-libdvdread-$(KODI_LIBDVDREAD_VERSION).tar.gz
define KODI_PROVIDE_JAVA_TARBALLS
mkdir -p $(@D)/buildroot-build/build/download
cp $(KODI_DL_DIR)/apache-groovy-binary-$(KODI_APACHE_GROOVY_VERSION).zip $(@D)/buildroot-build/build/download
cp $(KODI_DL_DIR)/commons-lang3-$(KODI_COMMONS_LANG3_VERSION)-bin.tar.gz $(@D)/buildroot-build/build/download
cp $(KODI_DL_DIR)/commons-text-$(KODI_COMMONS_TEXT_VERSION)-bin.tar.gz $(@D)/buildroot-build/build/download
endef
KODI_POST_EXTRACT_HOOKS = KODI_PROVIDE_JAVA_TARBALLS
KODI_CONF_OPTS += \
-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) $(KODI_C_FLAGS)" \
-DCMAKE_EXE_LINKER_FLAGS="$(KODI_EXTRA_LIBS)" \
-DENABLE_APP_AUTONAME=OFF \
-DENABLE_CCACHE=OFF \
-DENABLE_DVDCSS=ON \
-DENABLE_INTERNAL_CROSSGUID=OFF \
-DWITH_FFMPEG=$(STAGING_DIR)/usr \
-DENABLE_INTERNAL_FLATBUFFERS=OFF \
-DFLATBUFFERS_FLATC_EXECUTABLE=$(HOST_DIR)/bin/flatc \
-DENABLE_INTERNAL_RapidJSON=OFF \
-DENABLE_INTERNAL_SPDLOG=OFF \
-DKODI_DEPENDSBUILD=OFF \
-DENABLE_GOLD=OFF \
-DCLANG_FORMAT_EXECUTABLE=OFF \
-DHOST_CAN_EXECUTE_TARGET=FALSE \
-DNATIVEPREFIX=$(HOST_DIR) \
-DDEPENDS_PATH=$(STAGING_DIR)/usr \
-DENABLE_TESTING=OFF \
-DENABLE_DEBUGFISSION=OFF \
-DJAVA_HOME=$(HOST_OPENJDK_BIN_ROOT_DIR) \
-DPYTHON_EXECUTABLE=$(HOST_DIR)/bin/python \
-DPYTHON_INCLUDE_DIRS=$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR) \
-DPYTHON_PATH=$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) \
-DPYTHON_VER=$(PYTHON3_VERSION_MAJOR) \
-DWITH_JSONSCHEMABUILDER=$(HOST_DIR)/bin/ \
-DWITH_TEXTUREPACKER=$(HOST_DIR)/bin/ \
-DLIBDVDCSS_URL=$(KODI_DL_DIR)/kodi-libdvdcss-$(KODI_LIBDVDCSS_VERSION).tar.gz \
-DLIBDVDNAV_URL=$(KODI_DL_DIR)/kodi-libdvdnav-$(KODI_LIBDVDNAV_VERSION).tar.gz \
-DLIBDVDREAD_URL=$(KODI_DL_DIR)/kodi-libdvdread-$(KODI_LIBDVDREAD_VERSION).tar.gz
ifeq ($(BR2_PACKAGE_KODI_RENDER_SYSTEM_GL),y)
KODI_CONF_OPTS += -DAPP_RENDER_SYSTEM=gl
KODI_DEPENDENCIES += libgl libglu
else ifeq ($(BR2_PACKAGE_KODI_RENDER_SYSTEM_GLES),y)
KODI_CONF_OPTS += -DAPP_RENDER_SYSTEM=gles
KODI_DEPENDENCIES += libgles
endif
ifeq ($(BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_GBM),y)
KODI_CORE_PLATFORM_NAME += gbm
KODI_DEPENDENCIES += libdisplay-info libgbm libinput libxkbcommon
endif
ifeq ($(BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_WAYLAND),y)
KODI_CONF_OPTS += \
-DPC_WAYLANDPP_SCANNER=$(HOST_DIR)/bin/wayland-scanner \
-DPC_WAYLANDPP_SCANNER_FOUND=ON \
-DWAYLANDPP_PROTOCOLS_DIR=$(STAGING_DIR)/usr/share/waylandpp/protocols
KODI_CORE_PLATFORM_NAME += wayland
KODI_DEPENDENCIES += libxkbcommon waylandpp
endif
ifeq ($(BR2_PACKAGE_KODI_PLATFORM_SUPPORTS_X11),y)
KODI_CORE_PLATFORM_NAME += x11
KODI_DEPENDENCIES += \
xlib_libX11 \
xlib_libXext \
xlib_libXrandr
endif
KODI_CONF_OPTS += -DCORE_PLATFORM_NAME="$(KODI_CORE_PLATFORM_NAME)"
ifeq ($(BR2_ENABLE_LOCALE),)
KODI_DEPENDENCIES += libiconv
KODI_EXTRA_LIBS += -liconv
endif
ifeq ($(BR2_arcle),y)
KODI_CONF_OPTS += -DWITH_ARCH=arc -DWITH_CPU=arc
else ifeq ($(BR2_armeb),y)
KODI_CONF_OPTS += -DWITH_ARCH=arm -DWITH_CPU=arm
else ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
KODI_CONF_OPTS += \
-DWITH_ARCH=mips$(if $(BR2_ARCH_IS_64),64) \
-DWITH_CPU=mips$(if $(BR2_ARCH_IS_64),64)
else ifeq ($(BR2_powerpc)$(BR2_powerpc64le),y)
KODI_CONF_OPTS += \
-DWITH_ARCH=powerpc$(if $(BR2_ARCH_IS_64),64) \
-DWITH_CPU=powerpc$(if $(BR2_ARCH_IS_64),64)
else ifeq ($(BR2_or1k)$(BR2_powerpc64)$(BR2_riscv)$(BR2_sparc64)$(BR2_sh4)$(BR2_xtensa),y)
KODI_CONF_OPTS += -DWITH_ARCH=$(BR2_ARCH) -DWITH_CPU=$(BR2_ARCH)
else
# Kodi auto-detects ARCH, tested: arm, aarch64, i386, x86_64
# see project/cmake/scripts/linux/ArchSetup.cmake
KODI_CONF_OPTS += -DWITH_CPU=$(BR2_ARCH)
endif
ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
KODI_CONF_OPTS += -DENABLE_NEON=ON
else ifeq ($(BR2_aarch64),y)
KODI_CONF_OPTS += -DENABLE_NEON=ON
else
KODI_CONF_OPTS += -DENABLE_NEON=OFF
endif
ifeq ($(BR2_X86_CPU_HAS_SSE),y)
KODI_CONF_OPTS += -D_SSE_OK=ON -D_SSE_TRUE=ON
else
KODI_CONF_OPTS += -D_SSE_OK=OFF -D_SSE_TRUE=OFF
endif
ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
KODI_CONF_OPTS += -D_SSE2_OK=ON -D_SSE2_TRUE=ON
else
KODI_CONF_OPTS += -D_SSE2_OK=OFF -D_SSE2_TRUE=OFF
endif
ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
KODI_CONF_OPTS += -D_SSE3_OK=ON -D_SSE3_TRUE=ON
else
KODI_CONF_OPTS += -D_SSE3_OK=OFF -D_SSE3_TRUE=OFF
endif
ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
KODI_CONF_OPTS += -D_SSSE3_OK=ON -D_SSSE3_TRUE=ON
else
KODI_CONF_OPTS += -D_SSSE3_OK=OFF -D_SSSE3_TRUE=OFF
endif
ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
KODI_CONF_OPTS += -D_SSE41_OK=ON -D_SSE41_TRUE=ON
else
KODI_CONF_OPTS += -D_SSE41_OK=OFF -D_SSE41_TRUE=OFF
endif
ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
KODI_CONF_OPTS += -D_SSE42_OK=ON -D_SSE42_TRUE=ON
else
KODI_CONF_OPTS += -D_SSE42_OK=OFF -D_SSE42_TRUE=OFF
endif
ifeq ($(BR2_X86_CPU_HAS_AVX),y)
KODI_CONF_OPTS += -D_AVX_OK=ON -D_AVX_TRUE=ON
else
KODI_CONF_OPTS += -D_AVX_OK=OFF -D_AVX_TRUE=OFF
endif
ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
KODI_CONF_OPTS += -D_AVX2_OK=ON -D_AVX2_TRUE=ON
else
KODI_CONF_OPTS += -D_AVX2_OK=OFF -D_AVX2_TRUE=OFF
endif
ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5),)
KODI_C_FLAGS += -std=gnu99
endif
ifeq ($(BR2_PACKAGE_KODI_MYSQL),y)
KODI_CONF_OPTS += -DENABLE_MYSQLCLIENT=ON
KODI_DEPENDENCIES += mariadb
else
KODI_CONF_OPTS += -DENABLE_MYSQLCLIENT=OFF
endif
ifeq ($(BR2_PACKAGE_HAS_LIBUDEV),y)
KODI_CONF_OPTS += -DENABLE_UDEV=ON
KODI_DEPENDENCIES += libudev
else
KODI_CONF_OPTS += -DENABLE_UDEV=OFF
ifeq ($(BR2_PACKAGE_KODI_LIBUSB),y)
KODI_CONF_OPTS += -DENABLE_LIBUSB=ON
KODI_DEPENDENCIES += libusb-compat
else
KODI_CONF_OPTS += -DENABLE_LIBUSB=OFF
endif
endif
ifeq ($(BR2_PACKAGE_LIBCAP),y)
KODI_CONF_OPTS += -DENABLE_CAP=ON
KODI_DEPENDENCIES += libcap
else
KODI_CONF_OPTS += -DENABLE_CAP=OFF
endif
ifeq ($(BR2_PACKAGE_LIBXML2)$(BR2_PACKAGE_LIBXSLT),yy)
KODI_CONF_OPTS += -DENABLE_XSLT=ON
KODI_DEPENDENCIES += libxml2 libxslt
else
KODI_CONF_OPTS += -DENABLE_XSLT=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_BLUEZ),y)
KODI_CONF_OPTS += -DENABLE_BLUETOOTH=ON
KODI_DEPENDENCIES += bluez5_utils
else
KODI_CONF_OPTS += -DENABLE_BLUETOOTH=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_DBUS),y)
KODI_DEPENDENCIES += dbus
KODI_CONF_OPTS += -DENABLE_DBUS=ON
else
KODI_CONF_OPTS += -DENABLE_DBUS=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_EVENTCLIENTS),y)
KODI_CONF_OPTS += -DENABLE_EVENTCLIENTS=ON
else
KODI_CONF_OPTS += -DENABLE_EVENTCLIENTS=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_ALSA_LIB),y)
KODI_CONF_OPTS += -DENABLE_ALSA=ON
KODI_DEPENDENCIES += alsa-lib
else
KODI_CONF_OPTS += -DENABLE_ALSA=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_LIBMICROHTTPD),y)
KODI_CONF_OPTS += -DENABLE_MICROHTTPD=ON
KODI_DEPENDENCIES += libmicrohttpd
else
KODI_CONF_OPTS += -DENABLE_MICROHTTPD=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_LIBSMBCLIENT),y)
KODI_DEPENDENCIES += samba4
KODI_CONF_OPTS += -DENABLE_SMBCLIENT=ON
else
KODI_CONF_OPTS += -DENABLE_SMBCLIENT=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_LIBNFS),y)
KODI_DEPENDENCIES += libnfs
KODI_CONF_OPTS += -DENABLE_NFS=ON
else
KODI_CONF_OPTS += -DENABLE_NFS=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_LIBBLURAY),y)
KODI_DEPENDENCIES += libbluray
KODI_CONF_OPTS += -DENABLE_BLURAY=ON
else
KODI_CONF_OPTS += -DENABLE_BLURAY=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_LIBSHAIRPLAY),y)
KODI_DEPENDENCIES += libshairplay
KODI_CONF_OPTS += -DENABLE_AIRTUNES=ON
else
KODI_CONF_OPTS += -DENABLE_AIRTUNES=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_AVAHI),y)
KODI_DEPENDENCIES += avahi
KODI_CONF_OPTS += -DENABLE_AVAHI=ON
else
KODI_CONF_OPTS += -DENABLE_AVAHI=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_LIBCEC),y)
KODI_DEPENDENCIES += libcec
KODI_CONF_OPTS += -DENABLE_CEC=ON
else
KODI_CONF_OPTS += -DENABLE_CEC=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_LCMS2),y)
KODI_DEPENDENCIES += lcms2
KODI_CONF_OPTS += -DENABLE_LCMS2=ON
else
KODI_CONF_OPTS += -DENABLE_LCMS2=OFF
endif
ifeq ($(BR2_PACKAGE_LIRC_TOOLS),y)
KODI_DEPENDENCIES += lirc-tools
endif
ifeq ($(BR2_PACKAGE_LIBVA),y)
KODI_DEPENDENCIES += libva
KODI_CONF_OPTS += -DENABLE_VAAPI=ON
else
KODI_CONF_OPTS += -DENABLE_VAAPI=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_LIBVDPAU),y)
KODI_DEPENDENCIES += libvdpau
KODI_CONF_OPTS += -DENABLE_VDPAU=ON
else
KODI_CONF_OPTS += -DENABLE_VDPAU=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_UPNP),y)
KODI_CONF_OPTS += -DENABLE_UPNP=ON
else
KODI_CONF_OPTS += -DENABLE_UPNP=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_OPTICALDRIVE),y)
KODI_CONF_OPTS += -DENABLE_OPTICAL=ON
else
KODI_CONF_OPTS += -DENABLE_OPTICAL=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_PIPEWIRE),y)
KODI_CONF_OPTS += -DENABLE_PIPEWIRE=ON
KODI_DEPENDENCIES += pipewire
else
KODI_CONF_OPTS += -DENABLE_PIPEWIRE=OFF
endif
ifeq ($(BR2_PACKAGE_KODI_PULSEAUDIO),y)
KODI_CONF_OPTS += -DENABLE_PULSEAUDIO=ON
KODI_DEPENDENCIES += pulseaudio
else
KODI_CONF_OPTS += -DENABLE_PULSEAUDIO=OFF
endif
ifeq ($(BR2_PACKAGE_LIBUDFREAD),y)
KODI_CONF_OPTS += -DENABLE_UDFREAD=ON
KODI_DEPENDENCIES += libudfread
else
KODI_CONF_OPTS += -DENABLE_UDFREAD=OFF
endif
# Remove versioncheck addon, updating Kodi is done by building a new
# buildroot image.
KODI_ADDON_MANIFEST = $(TARGET_DIR)/usr/share/kodi/system/addon-manifest.xml
define KODI_CLEAN_UNUSED_ADDONS
rm -Rf $(TARGET_DIR)/usr/share/kodi/addons/service.xbmc.versioncheck
$(HOST_DIR)/bin/xml ed -L \
-d "/addons/addon[text()='service.xbmc.versioncheck']" \
$(KODI_ADDON_MANIFEST)
endef
KODI_POST_INSTALL_TARGET_HOOKS += KODI_CLEAN_UNUSED_ADDONS
define KODI_INSTALL_BR_WRAPPER
$(INSTALL) -D -m 0755 package/kodi/br-kodi \
$(TARGET_DIR)/usr/bin/br-kodi
endef
KODI_POST_INSTALL_TARGET_HOOKS += KODI_INSTALL_BR_WRAPPER
# When run from a startup script, Kodi has no $HOME where to store its
# configuration, so ends up storing it in /.kodi (yes, at the root of
# the rootfs). This is a problem for read-only filesystems. But we can't
# easily change that, so create /.kodi as a symlink where we want the
# config to eventually be. Add synlinks for the legacy XBMC name as well
define KODI_INSTALL_CONFIG_DIR
$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/kodi
ln -sf /var/kodi $(TARGET_DIR)/.kodi
ln -sf /var/kodi $(TARGET_DIR)/var/xbmc
ln -sf /var/kodi $(TARGET_DIR)/.xbmc
endef
KODI_POST_INSTALL_TARGET_HOOKS += KODI_INSTALL_CONFIG_DIR
define KODI_INSTALL_INIT_SYSV
$(INSTALL) -D -m 755 package/kodi/S50kodi \
$(TARGET_DIR)/etc/init.d/S50kodi
endef
define KODI_INSTALL_INIT_SYSTEMD
$(INSTALL) -D -m 644 package/kodi/kodi.service \
$(TARGET_DIR)/usr/lib/systemd/system/kodi.service
endef
$(eval $(cmake-package))

12
package/kodi/kodi.service Normal file
View File

@@ -0,0 +1,12 @@
[Unit]
Description = Kodi Entertainment Center
After = network.target
[Service]
Type = simple
ExecStart = /usr/lib/kodi/kodi.bin --standalone -fs -n
Restart = on-failure
[Install]
WantedBy = multi-user.target