From 1601b6e92c5f49fe482eef6f8041a66058b70754 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 5 Nov 2015 18:30:36 +0100 Subject: [PATCH] kodi: musl is now supported. - Applied patches from Alpine and adapted triplets for more general cases. - Use the generated addons tarball to not require java when bootstrapping. --- .../kodi/patches/add-missing-includes.patch | 10 + srcpkgs/kodi/patches/dvddemux-ffmpeg.patch | 16 - srcpkgs/kodi/patches/fix-fileemu.patch | 467 ++++++++++++++++++ srcpkgs/kodi/patches/fix-musl.patch | 116 +++++ srcpkgs/kodi/patches/fix-rsxs.patch | 24 + srcpkgs/kodi/patches/fortify-source-fix.patch | 11 + srcpkgs/kodi/patches/remove-filewrap.patch | 40 ++ .../kodi/patches/set-default-stacksize.patch | 10 + srcpkgs/kodi/template | 33 +- 9 files changed, 701 insertions(+), 26 deletions(-) create mode 100644 srcpkgs/kodi/patches/add-missing-includes.patch delete mode 100644 srcpkgs/kodi/patches/dvddemux-ffmpeg.patch create mode 100644 srcpkgs/kodi/patches/fix-fileemu.patch create mode 100644 srcpkgs/kodi/patches/fix-musl.patch create mode 100644 srcpkgs/kodi/patches/fix-rsxs.patch create mode 100644 srcpkgs/kodi/patches/fortify-source-fix.patch create mode 100644 srcpkgs/kodi/patches/remove-filewrap.patch create mode 100644 srcpkgs/kodi/patches/set-default-stacksize.patch diff --git a/srcpkgs/kodi/patches/add-missing-includes.patch b/srcpkgs/kodi/patches/add-missing-includes.patch new file mode 100644 index 00000000000..236bfa6fd0e --- /dev/null +++ b/srcpkgs/kodi/patches/add-missing-includes.patch @@ -0,0 +1,10 @@ +--- a/xbmc/filesystem/ZipManager.h.orig ++++ b/xbmc/filesystem/ZipManager.h +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + class CURL; + diff --git a/srcpkgs/kodi/patches/dvddemux-ffmpeg.patch b/srcpkgs/kodi/patches/dvddemux-ffmpeg.patch deleted file mode 100644 index 4f09af45f9d..00000000000 --- a/srcpkgs/kodi/patches/dvddemux-ffmpeg.patch +++ /dev/null @@ -1,16 +0,0 @@ -origin: -http://cvs.rpmfusion.org/viewvc/rpms/kodi/devel/kodi-14.0-dvddemux-ffmpeg.patch?revision=1.1&root=free&view=markup - ---- xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp.orig 2014-08-01 11:18:24.000000000 -0500 -+++ xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp 2014-08-24 15:36:34.844966866 -0500 -@@ -542,10 +542,6 @@ - - void CDVDDemuxFFmpeg::Flush() - { -- // naughty usage of an internal ffmpeg function -- if (m_pFormatContext) -- avformat_flush(m_pFormatContext); -- - m_currentPts = DVD_NOPTS_VALUE; - - m_pkt.result = -1; diff --git a/srcpkgs/kodi/patches/fix-fileemu.patch b/srcpkgs/kodi/patches/fix-fileemu.patch new file mode 100644 index 00000000000..59d0045ac1c --- /dev/null +++ b/srcpkgs/kodi/patches/fix-fileemu.patch @@ -0,0 +1,467 @@ +diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp +index ae7ccb5..d8fd7fc 100644 +--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp ++++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp +@@ -49,6 +49,7 @@ + #include + #include + #include ++#include + #ifdef TARGET_POSIX + #include "PlatformDefs.h" // for __stat64 + #endif +@@ -466,13 +467,10 @@ extern "C" + EmuFileObject* o = g_emuFileWrapper.GetFileObjectByDescriptor(fd); + if (o) + { +- if(!o->used) +- return NULL; +- + int nmode = convert_fmode(mode); + if( (o->mode & nmode) != nmode) + CLog::Log(LOGWARNING, "dll_fdopen - mode 0x%x differs from fd mode 0x%x", nmode, o->mode); +- return &o->file_emu; ++ return g_emuFileWrapper.GetStreamByFileObject(o); + } + else if (!IS_STD_DESCRIPTOR(fd)) + { +@@ -535,7 +533,7 @@ extern "C" + return -1; + } + object->mode = iMode; +- return g_emuFileWrapper.GetDescriptorByStream(&object->file_emu); ++ return g_emuFileWrapper.GetDescriptorByFileObject(object); + } + delete pFile; + return -1; +@@ -1181,8 +1179,8 @@ extern "C" + { + FILE* file = NULL; + #if defined(TARGET_LINUX) && !defined(TARGET_ANDROID) +- if (strcmp(filename, MOUNTED) == 0 +- || strcmp(filename, MNTTAB) == 0) ++ if (strcmp(filename, _PATH_MOUNTED) == 0 ++ || strcmp(filename, _PATH_MNTTAB) == 0) + { + CLog::Log(LOGINFO, "%s - something opened the mount file, let's hope it knows what it's doing", __FUNCTION__); + return fopen(filename, mode); +@@ -1572,7 +1570,7 @@ extern "C" + int ret; + + ret = dll_fgetpos64(stream, &tmpPos); +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) ++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) + *pos = (fpos_t)tmpPos; + #else + pos->__pos = (off_t)tmpPos.__pos; +@@ -1585,8 +1583,9 @@ extern "C" + CFile* pFile = g_emuFileWrapper.GetFileXbmcByStream(stream); + if (pFile != NULL) + { +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) +- *pos = pFile->GetPosition(); ++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) ++ uint64_t *ppos = (uint64_t *) pos; ++ *ppos = pFile->GetPosition(); + #else + pos->__pos = pFile->GetPosition(); + #endif +@@ -1607,8 +1606,9 @@ extern "C" + int fd = g_emuFileWrapper.GetDescriptorByStream(stream); + if (fd >= 0) + { +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) +- if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0) ++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) ++ const uint64_t *ppos = (const uint64_t *) pos; ++ if (dll_lseeki64(fd, *ppos, SEEK_SET) >= 0) + #else + if (dll_lseeki64(fd, (__off64_t)pos->__pos, SEEK_SET) >= 0) + #endif +@@ -1624,7 +1624,7 @@ extern "C" + { + // it might be something else than a file, or the file is not emulated + // let the operating system handle it +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) ++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) + return fsetpos(stream, pos); + #else + return fsetpos64(stream, pos); +@@ -1640,7 +1640,7 @@ extern "C" + if (fd >= 0) + { + fpos64_t tmpPos; +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) ++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) + tmpPos= *pos; + #else + tmpPos.__pos = (off64_t)(pos->__pos); +diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.h b/xbmc/cores/DllLoader/exports/emu_msvcrt.h +index ae9b1c4..3b19122 100644 +--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h ++++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h +@@ -26,7 +26,7 @@ + #define _onexit_t void* + #endif + +-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) ++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(GLIBC) + typedef off_t __off_t; + typedef int64_t off64_t; + typedef off64_t __off64_t; +diff --git a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp +index cf8a060..9110312 100644 +--- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp ++++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp +@@ -27,12 +27,7 @@ CEmuFileWrapper g_emuFileWrapper; + CEmuFileWrapper::CEmuFileWrapper() + { + // since we always use dlls we might just initialize it directly +- for (int i = 0; i < MAX_EMULATED_FILES; i++) +- { +- memset(&m_files[i], 0, sizeof(EmuFileObject)); +- m_files[i].used = false; +- m_files[i].file_emu._file = -1; +- } ++ memset(m_files, 0, sizeof(m_files)); + } + + CEmuFileWrapper::~CEmuFileWrapper() +@@ -43,22 +38,7 @@ void CEmuFileWrapper::CleanUp() + { + CSingleLock lock(m_criticalSection); + for (int i = 0; i < MAX_EMULATED_FILES; i++) +- { +- if (m_files[i].used) +- { +- m_files[i].file_xbmc->Close(); +- delete m_files[i].file_xbmc; +- +- if (m_files[i].file_lock) +- { +- delete m_files[i].file_lock; +- m_files[i].file_lock = NULL; +- } +- memset(&m_files[i], 0, sizeof(EmuFileObject)); +- m_files[i].used = false; +- m_files[i].file_emu._file = -1; +- } +- } ++ UnRegisterFileObject(&m_files[i], true); + } + + EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile) +@@ -69,13 +49,11 @@ EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile) + + for (int i = 0; i < MAX_EMULATED_FILES; i++) + { +- if (!m_files[i].used) ++ if (!m_files[i].file_xbmc) + { + // found a free location + object = &m_files[i]; +- object->used = true; + object->file_xbmc = pFile; +- object->file_emu._file = (i + FILE_WRAPPER_OFFSET); + object->file_lock = new CCriticalSection(); + break; + } +@@ -84,82 +62,71 @@ EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile) + return object; + } + +-void CEmuFileWrapper::UnRegisterFileObjectByDescriptor(int fd) ++void CEmuFileWrapper::UnRegisterFileObject(EmuFileObject *object, bool free_file) + { +- int i = fd - FILE_WRAPPER_OFFSET; +- if (i >= 0 && i < MAX_EMULATED_FILES) ++ if (object && object->file_xbmc) + { +- if (m_files[i].used) ++ if (object->file_xbmc && free_file) + { +- CSingleLock lock(m_criticalSection); +- +- // we assume the emulated function alreay deleted the CFile object +- if (m_files[i].used) +- { +- if (m_files[i].file_lock) +- { +- delete m_files[i].file_lock; +- m_files[i].file_lock = NULL; +- } +- memset(&m_files[i], 0, sizeof(EmuFileObject)); +- m_files[i].used = false; +- m_files[i].file_emu._file = -1; +- } ++ object->file_xbmc->Close(); ++ delete object->file_xbmc; + } ++ if (object->file_lock) ++ { ++ delete object->file_lock; ++ } ++ ++ memset(object, 0, sizeof(*object)); + } + } + ++void CEmuFileWrapper::UnRegisterFileObjectByDescriptor(int fd) ++{ ++ CSingleLock lock(m_criticalSection); ++ UnRegisterFileObject(GetFileObjectByDescriptor(fd), false); ++} ++ + void CEmuFileWrapper::UnRegisterFileObjectByStream(FILE* stream) + { +- if (stream != NULL) +- { +- return UnRegisterFileObjectByDescriptor(stream->_file); +- } ++ CSingleLock lock(m_criticalSection); ++ UnRegisterFileObject(GetFileObjectByStream(stream), false); + } + + void CEmuFileWrapper::LockFileObjectByDescriptor(int fd) + { +- int i = fd - FILE_WRAPPER_OFFSET; +- if (i >= 0 && i < MAX_EMULATED_FILES) ++ EmuFileObject* object = GetFileObjectByDescriptor(fd); ++ if (object && object->file_xbmc) + { +- if (m_files[i].used) +- { +- m_files[i].file_lock->lock(); +- } ++ object->file_lock->lock(); + } + } + + bool CEmuFileWrapper::TryLockFileObjectByDescriptor(int fd) +-{ +- int i = fd - FILE_WRAPPER_OFFSET; +- if (i >= 0 && i < MAX_EMULATED_FILES) +- { +- if (m_files[i].used) +- { +- return m_files[i].file_lock->try_lock(); +- } ++{ ++ EmuFileObject* object = GetFileObjectByDescriptor(fd); ++ if (object && object->file_xbmc) ++ { ++ return object->file_lock->try_lock(); + } ++ + return false; + } + + void CEmuFileWrapper::UnlockFileObjectByDescriptor(int fd) +-{ +- int i = fd - FILE_WRAPPER_OFFSET; +- if (i >= 0 && i < MAX_EMULATED_FILES) +- { +- if (m_files[i].used) +- { +- m_files[i].file_lock->unlock(); +- } ++{ ++ EmuFileObject* object = GetFileObjectByDescriptor(fd); ++ if (object && object->file_xbmc) ++ { ++ object->file_lock->unlock(); + } + } + + EmuFileObject* CEmuFileWrapper::GetFileObjectByDescriptor(int fd) + { +- int i = fd - FILE_WRAPPER_OFFSET; ++ int i = fd - 0x7000000; + if (i >= 0 && i < MAX_EMULATED_FILES) + { +- if (m_files[i].used) ++ if (m_files[i].file_xbmc) + { + return &m_files[i]; + } +@@ -167,20 +134,38 @@ EmuFileObject* CEmuFileWrapper::GetFileObjectByDescriptor(int fd) + return NULL; + } + +-EmuFileObject* CEmuFileWrapper::GetFileObjectByStream(FILE* stream) ++int CEmuFileWrapper::GetDescriptorByFileObject(EmuFileObject *object) + { +- if (stream != NULL) ++ int i = object - m_files; ++ if (i >= 0 && i < MAX_EMULATED_FILES) + { +- return GetFileObjectByDescriptor(stream->_file); ++ return 0x7000000 + i; + } ++ return -1; ++} + ++EmuFileObject* CEmuFileWrapper::GetFileObjectByStream(FILE* stream) ++{ ++ EmuFileObject *object = (EmuFileObject*) stream; ++ if (object >= &m_files[0] || object < &m_files[MAX_EMULATED_FILES]) ++ { ++ if (object->file_xbmc) ++ { ++ return object; ++ } ++ } + return NULL; + } + ++FILE* CEmuFileWrapper::GetStreamByFileObject(EmuFileObject *object) ++{ ++ return (FILE*) object; ++} ++ + XFILE::CFile* CEmuFileWrapper::GetFileXbmcByDescriptor(int fd) + { + EmuFileObject* object = GetFileObjectByDescriptor(fd); +- if (object != NULL && object->used) ++ if (object != NULL) + { + return object->file_xbmc; + } +@@ -191,8 +176,8 @@ XFILE::CFile* CEmuFileWrapper::GetFileXbmcByStream(FILE* stream) + { + if (stream != NULL) + { +- EmuFileObject* object = GetFileObjectByDescriptor(stream->_file); +- if (object != NULL && object->used) ++ EmuFileObject* object = GetFileObjectByStream(stream); ++ if (object != NULL) + { + return object->file_xbmc; + } +@@ -202,42 +187,20 @@ XFILE::CFile* CEmuFileWrapper::GetFileXbmcByStream(FILE* stream) + + int CEmuFileWrapper::GetDescriptorByStream(FILE* stream) + { +- if (stream != NULL) +- { +- int i = stream->_file - FILE_WRAPPER_OFFSET; +- if (i >= 0 && i < MAX_EMULATED_FILES) +- { +- return stream->_file; +- } +- } +- return -1; ++ return GetDescriptorByFileObject(GetFileObjectByStream(stream)); + } + + FILE* CEmuFileWrapper::GetStreamByDescriptor(int fd) + { +- EmuFileObject* object = GetFileObjectByDescriptor(fd); +- if (object != NULL && object->used) +- { +- return &object->file_emu; +- } +- return NULL; ++ return GetStreamByFileObject(GetFileObjectByDescriptor(fd)); + } + + bool CEmuFileWrapper::DescriptorIsEmulatedFile(int fd) + { +- int i = fd - FILE_WRAPPER_OFFSET; +- if (i >= 0 && i < MAX_EMULATED_FILES) +- { +- return true; +- } +- return false; ++ return GetFileObjectByDescriptor(fd) != NULL; + } + + bool CEmuFileWrapper::StreamIsEmulatedFile(FILE* stream) + { +- if (stream != NULL) +- { +- return DescriptorIsEmulatedFile(stream->_file); +- } +- return false; ++ return GetFileObjectByStream(stream) != NULL; + } +diff --git a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h +index 3d79c7a..1b3e62f 100644 +--- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h ++++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h +@@ -27,14 +27,14 @@ + #include "system.h" + #include "threads/CriticalSection.h" + +-#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_ANDROID) && !defined(__UCLIBC__) +-#define _file _fileno +-#elif defined(__UCLIBC__) +-#define _file __filedes +-#endif ++//#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_ANDROID) && !defined(__UCLIBC__) ++//#define _file _fileno ++//#elif defined(__UCLIBC__) ++//#define _file __filedes ++//#endif + + #define MAX_EMULATED_FILES 50 +-#define FILE_WRAPPER_OFFSET 0x00000100 ++//#define FILE_WRAPPER_OFFSET 0x00000100 + + namespace XFILE + { +@@ -43,11 +43,9 @@ namespace XFILE + + typedef struct stEmuFileObject + { +- bool used; +- FILE file_emu; +- XFILE::CFile* file_xbmc; ++ XFILE::CFile* file_xbmc; + CCriticalSection *file_lock; +- int mode; ++ int mode; + } EmuFileObject; + + class CEmuFileWrapper +@@ -62,19 +60,22 @@ public: + void CleanUp(); + + EmuFileObject* RegisterFileObject(XFILE::CFile* pFile); ++ void UnRegisterFileObject(EmuFileObject*, bool free_file); + void UnRegisterFileObjectByDescriptor(int fd); + void UnRegisterFileObjectByStream(FILE* stream); + void LockFileObjectByDescriptor(int fd); + bool TryLockFileObjectByDescriptor(int fd); + void UnlockFileObjectByDescriptor(int fd); +- EmuFileObject* GetFileObjectByDescriptor(int fd); +- EmuFileObject* GetFileObjectByStream(FILE* stream); ++ EmuFileObject* GetFileObjectByDescriptor(int fd); ++ int GetDescriptorByFileObject(EmuFileObject*); ++ EmuFileObject* GetFileObjectByStream(FILE* stream); ++ FILE* GetStreamByFileObject(EmuFileObject*); + XFILE::CFile* GetFileXbmcByDescriptor(int fd); + XFILE::CFile* GetFileXbmcByStream(FILE* stream); +- static int GetDescriptorByStream(FILE* stream); ++ int GetDescriptorByStream(FILE* stream); + FILE* GetStreamByDescriptor(int fd); +- static bool DescriptorIsEmulatedFile(int fd); +- static bool StreamIsEmulatedFile(FILE* stream); ++ bool DescriptorIsEmulatedFile(int fd); ++ bool StreamIsEmulatedFile(FILE* stream); + private: + EmuFileObject m_files[MAX_EMULATED_FILES]; + CCriticalSection m_criticalSection; +diff --git a/xbmc/cores/DllLoader/exports/wrapper.c b/xbmc/cores/DllLoader/exports/wrapper.c +index a9225e5..355da1c 100644 +--- a/xbmc/cores/DllLoader/exports/wrapper.c ++++ b/xbmc/cores/DllLoader/exports/wrapper.c +@@ -39,7 +39,7 @@ + #endif + #include + +-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) ++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(GLIBC) + typedef off_t __off_t; + typedef int64_t off64_t; + typedef off64_t __off64_t; diff --git a/srcpkgs/kodi/patches/fix-musl.patch b/srcpkgs/kodi/patches/fix-musl.patch new file mode 100644 index 00000000000..08502c8ba57 --- /dev/null +++ b/srcpkgs/kodi/patches/fix-musl.patch @@ -0,0 +1,116 @@ +--- ./lib/SlingboxLib/SlingboxLib.cpp 2013-12-12 21:47:49.000000000 +0000 ++++ ./lib/SlingboxLib/SlingboxLib.cpp 2014-04-15 06:07:15.746789122 +0000 +@@ -29,7 +29,9 @@ + #include + #include + #include ++#include + #include ++#include + #define INVALID_SOCKET (SOCKET)(~0) + #define SOCKET_ERROR (-1) + #endif +--- ./xbmc/visualizations/XBMCProjectM/libprojectM/BeatDetect.cpp 2014-04-15 05:52:42.214313750 +0000 ++++ ./xbmc/visualizations/XBMCProjectM/libprojectM/BeatDetect.cpp 2014-04-15 05:49:51.921324165 +0000 +@@ -33,7 +33,7 @@ + + #include "Common.hpp" + #include "PCM.hpp" +-#include ++#include "math.h" + #include "BeatDetect.hpp" + + #ifdef _WIN32 +--- ./xbmc/cores/DllLoader/ldt_keeper.c.orig ++++ ./xbmc/cores/DllLoader/ldt_keeper.c +@@ -48,7 +48,7 @@ + #if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)) + _syscall3( int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount ); + #else +-#if defined(TARGET_ANDROID) && defined(__i386__) && !defined(modify_ldt) ++#if defined(__linux__) && !defined(__GLIBC__) && !defined(modify_ldt) + #define modify_ldt(a,b,c) syscall( __NR_modify_ldt, a, b, c); + #else + int modify_ldt(int func, void *ptr, unsigned long bytecount); +--- ./tools/depends/native/TexturePacker/src/XBTFWriter.cpp ++++ ./tools/depends/native/TexturePacker/src/XBTFWriter.cpp +@@ -23,11 +23,7 @@ + #include + #include "guilib/XBTF.h" + #include "utils/EndianSwap.h" +-#if defined(TARGET_FREEBSD) || defined(TARGET_DARWIN) + #include +-#elif !defined(TARGET_DARWIN) +-#include +-#endif + #include + + #define WRITE_STR(str, size, file) fwrite(str, size, 1, file) +--- ./m4/xbmc_arch.m4.orig ++++ ./m4/xbmc_arch.m4 +@@ -2,10 +2,10 @@ + + # host detection and setup + case $host in +- i*86*-linux-gnu*|i*86*-*-linux-uclibc*) ++ i*86*-linux-gnu*|i*86*-*-linux-uclibc|*i*86*-linux-musl*) + AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") + ;; +- x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*) ++ x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*) + AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") + ;; + i386-*-freebsd*) +--- ./configure.ac.orig ++++ ./configure.ac +@@ -604,7 +604,7 @@ + use_x11=no + build_shared_lib=yes + ;; +- i*86*-linux-gnu*|i*86*-*-linux-uclibc*) ++ i*86*-linux-gnu*|i*86*-*-linux-uclibc*|i*86*-linux-musl*) + ARCH="i486-linux" + if test "$use_cpu" = "no" -a "$cross_compiling" = "yes"; then + use_arch="x86" +@@ -625,7 +625,7 @@ + fi + fi + ;; +- x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*) ++ x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*) + ARCH="x86_64-linux" + if test "$use_cpu" = "no" -a "$cross_compiling" = "yes"; then + use_arch="x86_64" +@@ -681,7 +681,7 @@ + powerpc64-*-linux-gnu*|powerpc64-*-linux-uclibc*) + ARCH="powerpc64-linux" + ;; +- arm*-*-linux-gnu*|arm*-*-linux-uclibc*) ++ arm*-*-linux-gnu*|arm*-*-linux-uclibc*|arm*-*-linux-musl*) + ARCH="arm" + use_arch="arm" + use_joystick=no +--- ./m4/xbmc_arch.m4.orig ++++ ./m4/xbmc_arch.m4 +@@ -2,10 +2,10 @@ + + # build detection and setup - this is the native arch + case $build in +- i*86*-linux-gnu*|i*86*-*-linux-uclibc*) ++ i*86*-linux-gnu*|i*86*-*-linux-uclibc*|i*86*-linux-musl*) + AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") + ;; +- x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*) ++ x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*) + AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") + ;; + i386-*-freebsd*) +@@ -23,7 +23,7 @@ + powerpc64-*-linux-gnu*|powerpc64-*-linux-uclibc*) + AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64") + ;; +- arm*-*-linux-gnu*|arm*-*-linux-uclibc*) ++ arm*-*-linux-gnu*|arm*-*-linux-uclibc*|arm*-*-linux-musl*) + AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") + ;; + *) diff --git a/srcpkgs/kodi/patches/fix-rsxs.patch b/srcpkgs/kodi/patches/fix-rsxs.patch new file mode 100644 index 00000000000..ccc7698c73d --- /dev/null +++ b/srcpkgs/kodi/patches/fix-rsxs.patch @@ -0,0 +1,24 @@ +--- xbmc-12.3-Frodo/xbmc/screensavers/rsxs-0.9/configure.ac 2014-04-15 10:22:51.025587069 +0000 ++++ xbmc-12.3-Frodo/xbmc/screensavers/rsxs-0.9/configure.ac 2014-04-15 10:21:51.947852111 +0000 +@@ -14,18 +14,13 @@ + + # Checks for programs. + LT_AC_PROG_SED +-AC_LANG(C++) +-AC_PROG_CXX +-#CXXFLAGS=`echo $CXXFLAGS | sed -e s,-O2,-O3,` +-AC_PROG_CXXCPP +- +-#if test x"$GXX" = x"yes"; then +-# CXXFLAGS=`echo $CXXFLAGS -Wall` +-#fi + + AC_PROG_CC + AM_PROG_CC_C_O + gl_EARLY ++AC_PROG_CXX ++AC_PROG_CXXCPP ++ + AC_PROG_RANLIB + + # Cut-down version of AC_LIB_LTDL. We don't want the option to install diff --git a/srcpkgs/kodi/patches/fortify-source-fix.patch b/srcpkgs/kodi/patches/fortify-source-fix.patch new file mode 100644 index 00000000000..5717746e09e --- /dev/null +++ b/srcpkgs/kodi/patches/fortify-source-fix.patch @@ -0,0 +1,11 @@ +--- a/xbmc/cores/DllLoader/exports/wrapper.c.orig ++++ b/xbmc/cores/DllLoader/exports/wrapper.c +@@ -462,7 +462,7 @@ + // are actually #defines which are inlined when compiled with -O. Those defines + // actally call __*chk (for example, __fread_chk). We need to bypass this whole + // thing to actually call our wrapped functions. +-#if _FORTIFY_SOURCE > 1 ++#if defined(__GLIBC__) && _FORTIFY_SOURCE > 1 + + size_t __wrap___fread_chk(void * ptr, size_t ptrlen, size_t size, size_t n, FILE * stream) + { diff --git a/srcpkgs/kodi/patches/remove-filewrap.patch b/srcpkgs/kodi/patches/remove-filewrap.patch new file mode 100644 index 00000000000..70145b0ba8c --- /dev/null +++ b/srcpkgs/kodi/patches/remove-filewrap.patch @@ -0,0 +1,40 @@ +--- a/xbmc/utils/posix/PosixInterfaceForCLog.cpp.orig ++++ b/xbmc/utils/posix/PosixInterfaceForCLog.cpp +@@ -28,10 +28,6 @@ + #include "android/activity/XBMCApp.h" + #endif // TARGET_ANDROID + +-struct FILEWRAP : public FILE +-{}; +- +- + CPosixInterfaceForCLog::CPosixInterfaceForCLog() : + m_file(NULL) + { } +@@ -50,7 +46,7 @@ + (void)remove(backupOldLogToFilename.c_str()); // if it's failed, try to continue + (void)rename(logFilename.c_str(), backupOldLogToFilename.c_str()); // if it's failed, try to continue + +- m_file = (FILEWRAP*)fopen(logFilename.c_str(), "wb"); ++ m_file = fopen(logFilename.c_str(), "wb"); + if (!m_file) + return false; // error, can't open log file + +--- a/xbmc/utils/posix/PosixInterfaceForCLog.h.orig ++++ b/xbmc/utils/posix/PosixInterfaceForCLog.h +@@ -21,8 +21,6 @@ + + #include + +-struct FILEWRAP; // forward declaration, wrapper for FILE +- + class CPosixInterfaceForCLog + { + public: +@@ -34,5 +32,5 @@ + void PrintDebugString(const std::string& debugString); + static void GetCurrentLocalTime(int& hour, int& minute, int& second); + private: +- FILEWRAP* m_file; ++ FILE * m_file; + }; diff --git a/srcpkgs/kodi/patches/set-default-stacksize.patch b/srcpkgs/kodi/patches/set-default-stacksize.patch new file mode 100644 index 00000000000..8a79215f8b1 --- /dev/null +++ b/srcpkgs/kodi/patches/set-default-stacksize.patch @@ -0,0 +1,10 @@ +--- ./xbmc/threads/platform/pthreads/ThreadImpl.cpp.orig ++++ ./xbmc/threads/platform/pthreads/ThreadImpl.cpp +@@ -42,6 +42,7 @@ + { + pthread_attr_t attr; + pthread_attr_init(&attr); ++ if (!stacksize) stacksize = 1024*1024; + #if !defined(TARGET_ANDROID) // http://code.google.com/p/android/issues/detail?id=7808 + if (stacksize > PTHREAD_STACK_MIN) + pthread_attr_setstacksize(&attr, stacksize); diff --git a/srcpkgs/kodi/template b/srcpkgs/kodi/template index a0c2f113935..7cf1a8c7312 100644 --- a/srcpkgs/kodi/template +++ b/srcpkgs/kodi/template @@ -1,7 +1,8 @@ # Template file for 'kodi' pkgname=kodi version=15.2 -revision=1 +revision=2 +patch_args="-Np1" _codename="Isengard" wrksrc="xbmc-${version}-${_codename}" short_desc="A software media player and entertainment hub for digital media" @@ -13,15 +14,12 @@ checksum=dd8aeb942e6de5d1488e243e1346cff3f6597e21b5131a3ba72ff5cc82037110 lib32disabled=yes broken_as_needed=yes -only_for_archs="i686 x86_64" - -provides="xbmc-${version}_${revision}" -replaces="xbmc>=0" +only_for_archs="i686 i686-musl x86_64 x86_64-musl" # XXX add support for afp. hostmakedepends=" automake libtool pkg-config gperf cmake zip unzip nasm yasm python-devel - swig openjdk-jre gettext-devel libltdl-devel curl" + gettext-devel libltdl-devel curl" makedepends=" libudev-devel pcre-devel expat-devel libpng-devel libjpeg-turbo-devel libXrandr-devel avahi-libs-devel pulseaudio-devel samba-devel tiff-devel @@ -39,15 +37,28 @@ depends="libbluray libmad libvorbis libcurl libflac libmodplug libass libmpeg2 lame librtmp libnfs>=1.9.7 libplist>=1.12" depends+=" glxinfo hicolor-icon-theme desktop-file-utils xdpyinfo" +# musl builds need generated addons (no java). +case "$XBPS_TARGET_MACHINE" in + *-musl) _kodi_nojava=yes;; + *) hostmakedepends+=" swig openjdk-jre";; +esac + # XXX http://build.voidlinux.eu/builders/x86_64_builder/builds/10520/steps/shell_3/logs/stdio CXXFLAGS="-fpermissive" pre_configure() { - . /etc/profile.d/10_openjdk.sh - ./bootstrap + # Copy generated files to avoid requiring java. + if [ -n "${_kodi_nojava}" ]; then + $XBPS_FETCH_CMD http://repo.voidlinux.eu/distfiles/kodi-${version}-generated-addons.tar.xz + tar xf kodi-${version}-generated-addons.tar.xz -C ${wrksrc} + BOOTSTRAP_STANDALONE=1 make JAVA=/bin/true SWIG=/bin/true -f codegenerator.mk + else + . /etc/profile.d/10_openjdk.sh + BOOTSTRAP_STANDALONE=1 make -f codegenerator.mk + fi + BOOTSTRAP_STANDALONE=1 make -f bootstrap.mk } do_configure() { - . /etc/profile.d/10_openjdk.sh ./configure ${configure_args} \ --disable-debug --enable-optimizations --enable-gl \ --enable-sdl --enable-vdpau --enable-vaapi --enable-joystick \ @@ -57,7 +68,9 @@ do_configure() { --enable-airplay --enable-ffmpeg-libvorbis --enable-udev \ --enable-avahi --enable-libbluray \ --enable-texturepacker --enable-external-libraries \ - --with-ffmpeg=shared + --with-ffmpeg=shared \ + ac_cv_path_JAVA_EXE=/bin/true \ + ac_cv_path_SWIG_EXE=/bin/true } do_build() { make ${makejobs}