|
| 1 | +https://git.alpinelinux.org/aports/tree/community/kodi/fix-musl-incompability.patch |
| 2 | + |
| 3 | +diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp |
| 4 | +index 1d5564c8c5..73c07fb586 100644 |
| 5 | +--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp |
| 6 | ++++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp |
| 7 | +@@ -72,6 +72,13 @@ |
| 8 | + #include "platform/win32/CharsetConverter.h" |
| 9 | + #endif |
| 10 | + |
| 11 | ++#ifndef _PATH_MOUNTED |
| 12 | ++#define _PATH_MOUNTED "/proc/mounts" |
| 13 | ++#endif |
| 14 | ++#ifndef _PATH_MNTTAB |
| 15 | ++#define _PATH_MNTTAB "/etc/fstab" |
| 16 | ++#endif |
| 17 | ++ |
| 18 | + using namespace XFILE; |
| 19 | + |
| 20 | + struct SDirData |
| 21 | +@@ -124,7 +131,7 @@ extern "C" void __stdcall init_emu_environ() |
| 22 | + dll_putenv("OS=win10"); |
| 23 | + #elif defined(TARGET_DARWIN) |
| 24 | + dll_putenv("OS=darwin"); |
| 25 | +-#elif defined(TARGET_POSIX) |
| 26 | ++#elif defined(TARGET_POSIX) || !defined(__GLIBC__) |
| 27 | + dll_putenv("OS=linux"); |
| 28 | + #else |
| 29 | + dll_putenv("OS=unknown"); |
| 30 | +@@ -1480,7 +1487,7 @@ extern "C" |
| 31 | + int ret; |
| 32 | + |
| 33 | + ret = dll_fgetpos64(stream, &tmpPos); |
| 34 | +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 35 | ++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 36 | + *pos = (fpos_t)tmpPos; |
| 37 | + #else |
| 38 | + pos->__pos = (off_t)tmpPos.__pos; |
| 39 | +@@ -1493,8 +1500,9 @@ extern "C" |
| 40 | + CFile* pFile = g_emuFileWrapper.GetFileXbmcByStream(stream); |
| 41 | + if (pFile != NULL) |
| 42 | + { |
| 43 | +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 44 | +- *pos = pFile->GetPosition(); |
| 45 | ++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 46 | ++ uint64_t *ppos = (uint64_t *)pos; |
| 47 | ++ *ppos = pFile->GetPosition(); |
| 48 | + #else |
| 49 | + pos->__pos = pFile->GetPosition(); |
| 50 | + #endif |
| 51 | +@@ -1509,8 +1517,9 @@ extern "C" |
| 52 | + int fd = g_emuFileWrapper.GetDescriptorByStream(stream); |
| 53 | + if (fd >= 0) |
| 54 | + { |
| 55 | +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 56 | +- if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0) |
| 57 | ++#if !defined(TARGET_POSIX) || !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 58 | ++ const uint64_t *ppos = (const uint64_t *) pos; |
| 59 | ++ if (dll_lseeki64(fd, *ppos, SEEK_SET) >= 0) |
| 60 | + #else |
| 61 | + if (dll_lseeki64(fd, (__off64_t)pos->__pos, SEEK_SET) >= 0) |
| 62 | + #endif |
| 63 | +@@ -1532,7 +1541,7 @@ extern "C" |
| 64 | + if (fd >= 0) |
| 65 | + { |
| 66 | + fpos64_t tmpPos; |
| 67 | +-#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 68 | ++#if !defined(__GLIBC__) || !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 69 | + tmpPos= *pos; |
| 70 | + #else |
| 71 | + tmpPos.__pos = (off64_t)(pos->__pos); |
| 72 | +diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.h b/xbmc/cores/DllLoader/exports/emu_msvcrt.h |
| 73 | +index 7869dc221c..3b86d6b45b 100644 |
| 74 | +--- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h |
| 75 | ++++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h |
| 76 | +@@ -17,7 +17,7 @@ |
| 77 | + #define _onexit_t void* |
| 78 | + #endif |
| 79 | + |
| 80 | +-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 81 | ++#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 82 | + typedef off_t __off_t; |
| 83 | + typedef int64_t off64_t; |
| 84 | + typedef off64_t __off64_t; |
| 85 | +diff --git a/xbmc/cores/DllLoader/exports/wrapper.c b/xbmc/cores/DllLoader/exports/wrapper.c |
| 86 | +index 33ab3437c1..5a68de2c64 100644 |
| 87 | +--- a/xbmc/cores/DllLoader/exports/wrapper.c |
| 88 | ++++ b/xbmc/cores/DllLoader/exports/wrapper.c |
| 89 | +@@ -23,7 +23,7 @@ |
| 90 | + #include <dirent.h> |
| 91 | + #include <dlfcn.h> |
| 92 | + |
| 93 | +-#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 94 | ++#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) |
| 95 | + typedef off_t __off_t; |
| 96 | + typedef int64_t off64_t; |
| 97 | + typedef off64_t __off64_t; |
0 commit comments