aboutsummaryrefslogtreecommitdiffstats
path: root/main/xbmc
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-04-15 10:38:26 +0000
committerTimo Teräs <timo.teras@iki.fi>2014-04-15 10:39:28 +0000
commit3ef61caf02705593434b656b0ad7c65fee0d72c1 (patch)
tree5b0e2c95eb3eec9d2a4eff16464ea5211d007b47 /main/xbmc
parent450ffea21f019cfa559c6ee22a2315dc8c3bc8ac (diff)
downloadaports-3ef61caf02705593434b656b0ad7c65fee0d72c1.tar.bz2
aports-3ef61caf02705593434b656b0ad7c65fee0d72c1.tar.xz
main/xbmc: fix musl build, build against openjdk7
Diffstat (limited to 'main/xbmc')
-rw-r--r--main/xbmc/APKBUILD22
-rw-r--r--main/xbmc/fix-fileemu.patch449
-rw-r--r--main/xbmc/fix-musl.patch93
-rw-r--r--main/xbmc/fix-rsxs.patch24
-rw-r--r--main/xbmc/xbmc-uclibc.patch57
5 files changed, 582 insertions, 63 deletions
diff --git a/main/xbmc/APKBUILD b/main/xbmc/APKBUILD
index 3038c9682a..c4d56bbafc 100644
--- a/main/xbmc/APKBUILD
+++ b/main/xbmc/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=xbmc
pkgver=12.3
-pkgrel=1
+pkgrel=2
pkgdesc="A software media player and entertainment hub for digital media"
url="http://xbmc.org"
arch="x86 x86_64"
@@ -17,7 +17,7 @@ depends_dev="gettext-dev boost-dev mesa-dev glew-dev glu-dev mysql-dev libass-de
yasm-dev libmpeg2-dev libmad-dev libsamplerate-dev rtmpdump-dev
libjpeg-turbo-dev libcrystalhd-dev udev-dev libcap-dev udisks-dev faac-dev
libshairport-dev ffmpeg1-dev afpfs-ng-dev libcec-dev"
-makedepends="$depends_dev automake autoconf m4 libtool swig findutils openjdk6-jre-base
+makedepends="$depends_dev automake autoconf m4 libtool swig findutils openjdk7-jre-base
boost-thread zip gperf cmake coreutils nasm"
subpackages="$pkgname-dev $pkgname-doc"
install=""
@@ -25,7 +25,10 @@ options="ldpath-recursive"
source="http://mirrors.xbmc.org/releases/source/$pkgname-$pkgver.tar.gz
no-snesapu.patch
samba4.patch
- xbmc-uclibc.patch"
+ fix-musl.patch
+ fix-fileemu.patch
+ fix-rsxs.patch
+ "
_builddir="$srcdir/$pkgname-$pkgver-Frodo"
@@ -53,6 +56,7 @@ build() {
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localstatedir=/var \
+ --disable-non-free \
--disable-debug \
--disable-ccache \
--enable-crystalhd \
@@ -77,12 +81,18 @@ package() {
md5sums="7ae385ebf8e5cfcb917393235e6efbdb xbmc-12.3.tar.gz
5ad388f29ab8f4ca6bc9e2b73bf946ef no-snesapu.patch
32d11612e948622b195950b93371027c samba4.patch
-31ab49159268b20ecec0b73eeefbe15b xbmc-uclibc.patch"
+eef7181657647bb95452a85b1ff34331 fix-musl.patch
+d94b78880011d0e26c544ffcb9a3f6bf fix-fileemu.patch
+1c8cc1618f29613fe3521db3e4a99db5 fix-rsxs.patch"
sha256sums="3e15c960d034efdea5f92a7b74716cb48094842d077b076025fd8640754ede73 xbmc-12.3.tar.gz
3c04c2cd6909cfb587b194e6c5a3025f1a3f03a0c5178ad70541ff7e69915935 no-snesapu.patch
de0c56f7ff84bc891d758dba6b3a68d20443e34357cd5dc89e0d4675bfee312c samba4.patch
-1af5b669f901108a48a007b6e657820ebe7375f7876bf63a9a29229e9e67b423 xbmc-uclibc.patch"
+7f390049dee084a6900f51763b686fd3ecdba3c336143d063712a537eb13ad70 fix-musl.patch
+c88e17ab49d9bbb66da7cc30dfccd108d824fb6b2c00dfec9e723a3a13b40554 fix-fileemu.patch
+e5de7cf5e781de9288f362c9d1c88d226297ba4aae3f75e5980f0a7cfc2258f0 fix-rsxs.patch"
sha512sums="abe5333f940460a2d40b04a4821f932b44c7605e0d4954e48781317aa25ee04e102b051165842094c5804024c637ca30506773dc3319aba7ab6dbfbe1973ccaa xbmc-12.3.tar.gz
8b2b3159b536719bad7c00f2eb51c4778f8e6c049cfe07e2555a530ad8587ca7b83623e1b5f40220d2e490e38442f893f87496620aa94da27d37a8bddc72f434 no-snesapu.patch
c84cefc90450bc55710ff2f5d12e13b9cdfaf6342647db9acb4c285b63f9d5712956a34c4725f36f39751f2f17c2561f8b5f7c409cd53358567e5915f7bef6bd samba4.patch
-cba529e5c5f4395fa3858a24259df0688d1a94dbfd5dc4ee5603b72b9e039611cd8a5bf2ccc5f7a4e78dbfb3e557f5fbc6c93e9630c69186e94044e755f39310 xbmc-uclibc.patch"
+5577264078ce2c649ad0f1dbcfe245571ca525c66f52e05da2d758d0c20236476023912099b3baa40efce2a785dc1684381eb41704b1b420126fbca19a52b0db fix-musl.patch
+6c470003a03f034f012f9cd97ed479d6bb2d0286d1cf515ff0196d32d62ba6b1a0cf5fea900de04ddda5ce6340afd2593b6d222ea5ebe7c09e654f89eca1d16d fix-fileemu.patch
+e1ed2e2e53c20b59f2ea926e9097e99438fdaed9b9d4c0133567bd1c8dc26b003961ad045ce4aaba62e9825e1a2d9651e72bd21bdb09dcc840c8e14d9602d109 fix-rsxs.patch"
diff --git a/main/xbmc/fix-fileemu.patch b/main/xbmc/fix-fileemu.patch
new file mode 100644
index 0000000000..f853168c63
--- /dev/null
+++ b/main/xbmc/fix-fileemu.patch
@@ -0,0 +1,449 @@
+diff -ru xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
+--- xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp 2013-12-12 21:47:49.000000000 +0000
++++ xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp 2014-04-15 07:51:22.843024856 +0000
+@@ -49,6 +49,7 @@
+ #include <fcntl.h>
+ #include <time.h>
+ #include <signal.h>
++#include <paths.h>
+ #ifdef _LINUX
+ #include "PlatformDefs.h" // for __stat64
+ #endif
+@@ -479,13 +480,10 @@
+ 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))
+ {
+@@ -548,7 +546,7 @@
+ return -1;
+ }
+ object->mode = iMode;
+- return g_emuFileWrapper.GetDescriptorByStream(&object->file_emu);
++ return g_emuFileWrapper.GetDescriptorByFileObject(object);
+ }
+ delete pFile;
+ return -1;
+@@ -1194,8 +1192,8 @@
+ {
+ FILE* file = NULL;
+ #if defined(_LINUX) && !defined(TARGET_DARWIN) && !defined(__FreeBSD__) && !defined(__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);
+@@ -1586,7 +1584,7 @@
+ int ret;
+
+ ret = dll_fgetpos64(stream, &tmpPos);
+-#if !defined(_LINUX) || defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__)
++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__)
+ *pos = (fpos_t)tmpPos;
+ #else
+ pos->__pos = (off_t)tmpPos.__pos;
+@@ -1599,8 +1597,9 @@
+ CFile* pFile = g_emuFileWrapper.GetFileXbmcByStream(stream);
+ if (pFile != NULL)
+ {
+-#if !defined(_LINUX) || defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__)
+- *pos = pFile->GetPosition();
++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__)
++ uint64_t *ppos = (uint64_t *) pos;
++ *ppos = pFile->GetPosition();
+ #else
+ pos->__pos = pFile->GetPosition();
+ #endif
+@@ -1621,8 +1620,9 @@
+ int fd = g_emuFileWrapper.GetDescriptorByStream(stream);
+ if (fd >= 0)
+ {
+-#if !defined(_LINUX) || defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__)
+- if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0)
++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__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
+@@ -1654,7 +1654,7 @@
+ if (fd >= 0)
+ {
+ fpos64_t tmpPos;
+-#if !defined(_LINUX) || defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__)
++#if !defined(GLIBC) || defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__)
+ tmpPos= *pos;
+ #else
+ tmpPos.__pos = (off64_t)(pos->__pos);
+diff -ru xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/emu_msvcrt.h xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/emu_msvcrt.h
+--- xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/emu_msvcrt.h 2014-04-15 05:52:42.214313750 +0000
++++ xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/emu_msvcrt.h 2014-04-15 05:55:24.897232874 +0000
+@@ -26,7 +26,7 @@
+ #define _onexit_t void*
+ #endif
+
+-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD)
++#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || !defined(GLIBC)
+ typedef off_t __off_t;
+ typedef int64_t off64_t;
+ typedef off64_t __off64_t;
+@@ -46,9 +46,9 @@
+
+ typedef void ( *PFV)(void);
+
+-#define __IS_STDIN_STREAM(stream) (stream == stdin || stream->_file == stdin->_file || stream->_file == 0)
+-#define __IS_STDOUT_STREAM(stream) (stream == stdout || stream->_file == stdout->_file || stream->_file == 1)
+-#define __IS_STDERR_STREAM(stream) (stream == stderr || stream->_file == stderr->_file || stream->_file == 2)
++#define __IS_STDIN_STREAM(stream) (stream == stdin || fileno(stream) == fileno(stdin) || fileno(stream) == 0)
++#define __IS_STDOUT_STREAM(stream) (stream == stdout || fileno(stream) == fileno(stdout) || fileno(stream) == 1)
++#define __IS_STDERR_STREAM(stream) (stream == stderr || fileno(stream) == fileno(stderr) || fileno(stream) == 2)
+ #define IS_STDIN_STREAM(stream) (stream != NULL && __IS_STDIN_STREAM(stream))
+ #define IS_STDOUT_STREAM(stream) (stream != NULL && __IS_STDOUT_STREAM(stream))
+ #define IS_STDERR_STREAM(stream) (stream != NULL && __IS_STDERR_STREAM(stream))
+diff -ru xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp
+--- xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp 2013-12-12 21:47:49.000000000 +0000
++++ xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp 2014-04-15 09:48:39.551659175 +0000
+@@ -27,12 +27,7 @@
+ 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 @@
+ {
+ 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 @@
+
+ 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 @@
+ 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 @@
+ 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 @@
+ {
+ 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 @@
+
+ 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 -ru xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h
+--- xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h 2014-04-15 05:52:42.214313750 +0000
++++ xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h 2014-04-15 08:00:04.209129880 +0000
+@@ -27,12 +27,7 @@
+ #include "system.h"
+ #include "threads/CriticalSection.h"
+
+-#if defined(_LINUX) && !defined(TARGET_DARWIN) && !defined(__FreeBSD__) && !defined(__ANDROID__)
+-#define _file _fileno
+-#endif
+-
+ #define MAX_EMULATED_FILES 50
+-#define FILE_WRAPPER_OFFSET 0x00000100
+
+ namespace XFILE
+ {
+@@ -41,11 +36,9 @@
+
+ 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
+@@ -60,13 +53,16 @@
+ 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);
+ int GetDescriptorByStream(FILE* stream);
+diff -ru xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/wrapper.c xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/wrapper.c
+--- xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/exports/wrapper.c 2013-12-12 21:47:49.000000000 +0000
++++ xbmc-12.3-Frodo/xbmc/cores/DllLoader/exports/wrapper.c 2014-04-15 07:51:55.146945331 +0000
+@@ -39,7 +39,7 @@
+ #endif
+ #include <dlfcn.h>
+
+-#if defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__)
++#if defined(TARGET_DARWIN) || defined(__FreeBSD__) || defined(__ANDROID__) || !defined(GLIBC)
+ typedef off_t __off_t;
+ typedef int64_t off64_t;
+ typedef off64_t __off64_t;
diff --git a/main/xbmc/fix-musl.patch b/main/xbmc/fix-musl.patch
new file mode 100644
index 0000000000..f5b4d987c6
--- /dev/null
+++ b/main/xbmc/fix-musl.patch
@@ -0,0 +1,93 @@
+diff -ru xbmc-12.3-Frodo.orig/configure.in xbmc-12.3-Frodo/configure.in
+--- xbmc-12.3-Frodo.orig/configure.in 2014-04-15 05:52:42.214313750 +0000
++++ xbmc-12.3-Frodo/configure.in 2014-04-15 05:49:51.921324165 +0000
+@@ -556,11 +556,11 @@
+ use_cpu="i686"
+ ffmpeg_target_os=linux
+ ;;
+- i*86*-linux-gnu*)
++ i*86*-linux-gnu*|i*86*-linux-uclibc*|i*86*-linux-musl*)
+ ARCH="i486-linux"
+ AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
+ ;;
+- x86_64-*-linux-gnu*)
++ x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*)
+ ARCH="x86_64-linux"
+ AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
+ ;;
+@@ -619,7 +619,7 @@
+ ARCH="powerpc64-linux"
+ AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64")
+ ;;
+- arm*-*-linux-gnu*)
++ arm*-*-linux-gnu*|arm*-*-linux-muslgnu*)
+ use_texturepacker=no
+ ARCH="arm"
+ use_arch="arm"
+diff -ru xbmc-12.3-Frodo.orig/lib/SlingboxLib/SlingboxLib.cpp xbmc-12.3-Frodo/lib/SlingboxLib/SlingboxLib.cpp
+--- xbmc-12.3-Frodo.orig/lib/SlingboxLib/SlingboxLib.cpp 2013-12-12 21:47:49.000000000 +0000
++++ xbmc-12.3-Frodo/lib/SlingboxLib/SlingboxLib.cpp 2014-04-15 06:07:15.746789122 +0000
+@@ -29,7 +29,9 @@
+ #include <time.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#include <sys/time.h>
+ #include <sys/socket.h>
++#include <sys/select.h>
+ #define INVALID_SOCKET (SOCKET)(~0)
+ #define SOCKET_ERROR (-1)
+ #endif
+diff -ru xbmc-12.3-Frodo.orig/lib/libXDAAP/thread.h xbmc-12.3-Frodo/lib/libXDAAP/thread.h
+--- xbmc-12.3-Frodo.orig/lib/libXDAAP/thread.h 2013-12-12 21:47:49.000000000 +0000
++++ xbmc-12.3-Frodo/lib/libXDAAP/thread.h 2014-04-15 06:11:09.940947997 +0000
+@@ -37,7 +37,7 @@
+ #define ts_mutex pthread_mutex_t
+ #define ts_condition pthread_cond_t
+
+-#if defined(__APPLE__) || defined(__FreeBSD__)
++#if !defined(PTHREAD_MUTEX_RECURSIVE_NP)
+ #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
+ #endif
+
+diff -ru xbmc-12.3-Frodo.orig/xbmc/visualizations/XBMCProjectM/libprojectM/BeatDetect.cpp xbmc-12.3-Frodo/xbmc/visualizations/XBMCProjectM/libprojectM/BeatDetect.cpp
+--- xbmc-12.3-Frodo.orig/xbmc/visualizations/XBMCProjectM/libprojectM/BeatDetect.cpp 2014-04-15 05:52:42.214313750 +0000
++++ xbmc-12.3-Frodo/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 <cmath>
++#include "math.h"
+ #include "BeatDetect.hpp"
+
+ #ifdef _WIN32
+diff -ru xbmc-12.3-Frodo.orig/tools/TexturePacker/XBTFWriter.cpp xbmc-12.3-Frodo/tools/TexturePacker/XBTFWriter.cpp
+--- xbmc-12.3-Frodo.orig/tools/TexturePacker/XBTFWriter.cpp 2013-12-12 21:47:49.000000000 +0000
++++ xbmc-12.3-Frodo/tools/TexturePacker/XBTFWriter.cpp 2014-04-15 09:58:29.222353358 +0000
+@@ -24,11 +24,7 @@
+ #include <inttypes.h>
+ #include "guilib/XBTF.h"
+ #include "utils/EndianSwap.h"
+-#if defined(__FreeBSD__)
+ #include <stdlib.h>
+-#elif !defined(__APPLE__)
+-#include <malloc.h>
+-#endif
+ #include <memory.h>
+
+ #define WRITE_STR(str, size, file) fwrite(str, size, 1, file)
+diff -ru xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/ldt_keeper.c xbmc-12.3-Frodo/xbmc/cores/DllLoader/ldt_keeper.c
+--- xbmc-12.3-Frodo.orig/xbmc/cores/DllLoader/ldt_keeper.c 2013-12-12 21:47:49.000000000 +0000
++++ xbmc-12.3-Frodo/xbmc/cores/DllLoader/ldt_keeper.c 2014-04-15 10:10:17.091888453 +0000
+@@ -48,11 +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(__ANDROID__) && defined(__i386__) && !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);
+-#endif
+ #endif
+ #ifdef __cplusplus
+ }
diff --git a/main/xbmc/fix-rsxs.patch b/main/xbmc/fix-rsxs.patch
new file mode 100644
index 0000000000..ccc7698c73
--- /dev/null
+++ b/main/xbmc/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/main/xbmc/xbmc-uclibc.patch b/main/xbmc/xbmc-uclibc.patch
deleted file mode 100644
index 233770b77d..0000000000
--- a/main/xbmc/xbmc-uclibc.patch
+++ /dev/null
@@ -1,57 +0,0 @@
---- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h.orig
-+++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h
-@@ -27,8 +27,10 @@
- #include "system.h"
- #include "threads/CriticalSection.h"
-
--#if defined(_LINUX) && !defined(TARGET_DARWIN) && !defined(__FreeBSD__) && !defined(__ANDROID__)
-+#if defined(_LINUX) && !defined(TARGET_DARWIN) && !defined(__FreeBSD__) && !defined(__ANDROID__) && !defined(__UCLIBC__)
- #define _file _fileno
-+#elif defined(__UCLIBC__)
-+#define _file __filedes
- #endif
-
- #define MAX_EMULATED_FILES 50
---- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h.orig
-+++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h
-@@ -46,9 +46,9 @@
-
- typedef void ( *PFV)(void);
-
--#define __IS_STDIN_STREAM(stream) (stream == stdin || stream->_file == stdin->_file || stream->_file == 0)
--#define __IS_STDOUT_STREAM(stream) (stream == stdout || stream->_file == stdout->_file || stream->_file == 1)
--#define __IS_STDERR_STREAM(stream) (stream == stderr || stream->_file == stderr->_file || stream->_file == 2)
-+#define __IS_STDIN_STREAM(stream) (stream == stdin || fileno(stream) == fileno(stdin) || fileno(stream) == 0)
-+#define __IS_STDOUT_STREAM(stream) (stream == stdout || fileno(stream) == fileno(stdout) || fileno(stream) == 1)
-+#define __IS_STDERR_STREAM(stream) (stream == stderr || fileno(stream) == fileno(stderr) || fileno(stream) == 2)
- #define IS_STDIN_STREAM(stream) (stream != NULL && __IS_STDIN_STREAM(stream))
- #define IS_STDOUT_STREAM(stream) (stream != NULL && __IS_STDOUT_STREAM(stream))
- #define IS_STDERR_STREAM(stream) (stream != NULL && __IS_STDERR_STREAM(stream))
---- a/xbmc/visualizations/XBMCProjectM/libprojectM/BeatDetect.cpp.orig
-+++ b/xbmc/visualizations/XBMCProjectM/libprojectM/BeatDetect.cpp
-@@ -33,7 +33,7 @@
-
- #include "Common.hpp"
- #include "PCM.hpp"
--#include <cmath>
-+#include "math.h"
- #include "BeatDetect.hpp"
-
- #ifdef _WIN32
-
---- ./configure.in.orig 2013-05-03 05:57:40.000000000 +0000
-+++ ./configure.in 2013-07-08 07:42:11.960541402 +0000
-@@ -556,11 +556,11 @@
- use_cpu="i686"
- ffmpeg_target_os=linux
- ;;
-- i*86*-linux-gnu*)
-+ i*86*-linux-gnu*|i*86*-linux-uclibc*)
- ARCH="i486-linux"
- AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
- ;;
-- x86_64-*-linux-gnu*)
-+ x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*)
- ARCH="x86_64-linux"
- AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
- ;;