diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-11-06 23:22:59 -0800 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-02-06 16:48:19 +0100 |
commit | 610e0942289e99cbe2739ac956b9923cf55ab535 (patch) | |
tree | 79d72b85526ae2ee68433ece3660dd8aaec7da81 /meta-multimedia | |
parent | eb45dac03da296beffbba30991a7077a73220300 (diff) | |
download | meta-openembedded-610e0942289e99cbe2739ac956b9923cf55ab535.tar.gz |
kodi-17: Fix build with musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-multimedia')
4 files changed, 740 insertions, 0 deletions
diff --git a/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0006-build-Add-support-for-musl-triplets.patch b/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0006-build-Add-support-for-musl-triplets.patch new file mode 100644 index 000000000..71c5c414b --- /dev/null +++ b/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0006-build-Add-support-for-musl-triplets.patch | |||
@@ -0,0 +1,180 @@ | |||
1 | From 99769ac5653884e49d1c8c34e65d2e565cd9e314 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 6 Nov 2016 11:54:41 -0800 | ||
4 | Subject: [PATCH 6/6] build: Add support for musl triplets | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | configure.ac | 12 ++++++------ | ||
9 | m4/xbmc_arch.m4 | 22 +++++++++++----------- | ||
10 | tools/depends/configure.ac | 12 ++++++------ | ||
11 | 3 files changed, 23 insertions(+), 23 deletions(-) | ||
12 | |||
13 | diff --git a/configure.ac b/configure.ac | ||
14 | index 52d5f11..a772973 100644 | ||
15 | --- a/configure.ac | ||
16 | +++ b/configure.ac | ||
17 | @@ -526,7 +526,7 @@ case $host in | ||
18 | use_x11=no | ||
19 | build_shared_lib=yes | ||
20 | ;; | ||
21 | - i*86*-linux-gnu*|i*86*-*-linux-uclibc*) | ||
22 | + i*86*-linux-gnu*|i*86*-*-linux-uclibc*|i*86*-*-linux-musl*) | ||
23 | target_platform=target_linux | ||
24 | CORE_SYSTEM_NAME=linux | ||
25 | ARCH="i486-linux" | ||
26 | @@ -549,7 +549,7 @@ case $host in | ||
27 | fi | ||
28 | fi | ||
29 | ;; | ||
30 | - x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*) | ||
31 | + x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*) | ||
32 | target_platform=target_linux | ||
33 | CORE_SYSTEM_NAME=linux | ||
34 | ARCH="x86_64-linux" | ||
35 | @@ -601,17 +601,17 @@ case $host in | ||
36 | DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*}) | ||
37 | AC_SUBST([DEPENDS_ROOT_FOR_XCODE]) | ||
38 | ;; | ||
39 | - powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*) | ||
40 | + powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*|powerpc-*-linux-musl*) | ||
41 | target_platform=target_linux | ||
42 | CORE_SYSTEM_NAME=linux | ||
43 | ARCH="powerpc-linux" | ||
44 | ;; | ||
45 | - powerpc64*-*-linux-gnu*|powerpc64*-*-linux-uclibc*) | ||
46 | + powerpc64*-*-linux-gnu*|powerpc64*-*-linux-uclibc*|powerpc64*-*-linux-musl*) | ||
47 | target_platform=target_linux | ||
48 | CORE_SYSTEM_NAME=linux | ||
49 | ARCH="powerpc64-linux" | ||
50 | ;; | ||
51 | - arm*-*-linux-gnu*|arm*-*-linux-uclibc*) | ||
52 | + arm*-*-linux-gnu*|arm*-*-linux-uclibc*|arm*-*-linux-musl*) | ||
53 | target_platform=target_linux | ||
54 | CORE_SYSTEM_NAME=linux | ||
55 | ARCH="arm" | ||
56 | @@ -621,7 +621,7 @@ case $host in | ||
57 | use_gl=no | ||
58 | USE_STATIC_FFMPEG=1 | ||
59 | ;; | ||
60 | - aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*) | ||
61 | + aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*|aarch64*-*-linux-musl*) | ||
62 | target_platform=target_linux | ||
63 | ARCH="aarch64" | ||
64 | use_arch="aarch64" | ||
65 | diff --git a/m4/xbmc_arch.m4 b/m4/xbmc_arch.m4 | ||
66 | index d28f263..ff5dc20 100644 | ||
67 | --- a/m4/xbmc_arch.m4 | ||
68 | +++ b/m4/xbmc_arch.m4 | ||
69 | @@ -2,10 +2,10 @@ AC_DEFUN([XBMC_SETUP_ARCH_DEFINES],[ | ||
70 | |||
71 | # build detection and setup - this is the native arch | ||
72 | case $build in | ||
73 | - i*86*-linux-gnu*|i*86*-*-linux-uclibc*) | ||
74 | + i*86*-linux-gnu*|i*86*-*-linux-uclibc*|i*86*-*-linux-musl*) | ||
75 | AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") | ||
76 | ;; | ||
77 | - x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*) | ||
78 | + x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*) | ||
79 | AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") | ||
80 | ;; | ||
81 | i386-*-freebsd*) | ||
82 | @@ -17,13 +17,13 @@ case $build in | ||
83 | *86*-apple-darwin*) | ||
84 | AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX") | ||
85 | ;; | ||
86 | - powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*) | ||
87 | + powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*|powerpc-*-linux-musl*) | ||
88 | AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC") | ||
89 | ;; | ||
90 | - powerpc64-*-linux-gnu*|powerpc64-*-linux-uclibc*) | ||
91 | + powerpc64-*-linux-gnu*|powerpc64-*-linux-uclibc*|powerpc64-*-linux-musl*) | ||
92 | AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64") | ||
93 | ;; | ||
94 | - arm*-*-linux-gnu*|arm*-*-linux-uclibc*) | ||
95 | + arm*-*-linux-gnu*|arm*-*-linux-uclibc*|arm*-*-linux-musl*) | ||
96 | AC_SUBST(NATIVE_ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") | ||
97 | ;; | ||
98 | *) | ||
99 | @@ -33,10 +33,10 @@ esac | ||
100 | |||
101 | # host detection and setup - this is the target arch | ||
102 | case $host in | ||
103 | - i*86*-linux-gnu*|i*86*-*-linux-uclibc*) | ||
104 | + i*86*-linux-gnu*|i*86*-*-linux-uclibc*|i*86*-*-linux-musl*) | ||
105 | AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") | ||
106 | ;; | ||
107 | - x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*) | ||
108 | + x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*) | ||
109 | AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") | ||
110 | ;; | ||
111 | i386-*-freebsd*) | ||
112 | @@ -54,16 +54,16 @@ case $host in | ||
113 | powerpc-apple-darwin*) | ||
114 | AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX") | ||
115 | ;; | ||
116 | - powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*) | ||
117 | + powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*|powerpc-*-linux-musl*) | ||
118 | AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC") | ||
119 | ;; | ||
120 | - powerpc64*-*-linux-gnu*|powerpc64*-*-linux-uclibc*) | ||
121 | + powerpc64*-*-linux-gnu*|powerpc64*-*-linux-uclibc*|powerpc64*-*-linux-musl*) | ||
122 | AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64") | ||
123 | ;; | ||
124 | - arm*-*-linux-gnu*|arm*-*-linux-uclibc*|aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*) | ||
125 | + arm*-*-linux-gnu*|arm*-*-linux-uclibc*|arm*-*-linux-musl*|aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*|aarch64*-*-linux-musl*) | ||
126 | AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") | ||
127 | ;; | ||
128 | - mips*-*-linux-gnu*|mips*-*-linux-uclibc*) | ||
129 | + mips*-*-linux-gnu*|mips*-*-linux-uclibc*|mips*-*-linux-musl*) | ||
130 | AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX") | ||
131 | ;; | ||
132 | *-*linux-android*) | ||
133 | diff --git a/tools/depends/configure.ac b/tools/depends/configure.ac | ||
134 | index a0bc386..b96d20e 100644 | ||
135 | --- a/tools/depends/configure.ac | ||
136 | +++ b/tools/depends/configure.ac | ||
137 | @@ -120,13 +120,13 @@ platform_cc=gcc | ||
138 | platform_cxx=g++ | ||
139 | |||
140 | case $build in | ||
141 | - arm*-*-linux-gnu*|arm*-*-linux-uclibc*) | ||
142 | + arm*-*-linux-gnu*|arm*-*-linux-uclibc*|arm*-*-linux-musl*) | ||
143 | build_os="linux" | ||
144 | ;; | ||
145 | - *i686*-linux-gnu*|i*86*-*-linux-uclibc*) | ||
146 | + *i686*-linux-gnu*|i*86*-*-linux-uclibc*|i*86*-*-linux-musl*) | ||
147 | build_os="linux" | ||
148 | ;; | ||
149 | - x86_64*-linux-gnu*|x86_64-*-linux-uclibc*) | ||
150 | + x86_64*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*) | ||
151 | build_os="linux" | ||
152 | ;; | ||
153 | *darwin*) | ||
154 | @@ -186,7 +186,7 @@ case $host in | ||
155 | #android builds are always cross | ||
156 | cross_compiling="yes" | ||
157 | ;; | ||
158 | - arm*-*-linux-gnu*|arm*-*-linux-uclibc*) | ||
159 | + arm*-*-linux-gnu*|arm*-*-linux-uclibc*|arm*-*-linux-musl*) | ||
160 | if test "$use_platform" = "auto"; then | ||
161 | if test "x$use_cpu" = "xauto"; then | ||
162 | use_cpu=$host_cpu | ||
163 | @@ -210,12 +210,12 @@ case $host in | ||
164 | platform_os="linux" | ||
165 | fi | ||
166 | ;; | ||
167 | - *i686*-linux-gnu*|i*86*-*-linux-uclibc*) | ||
168 | + *i686*-linux-gnu*|i*86*-*-linux-uclibc*|i*86*-*-linux-musl*) | ||
169 | use_cpu=$host_cpu | ||
170 | use_toolchain="${use_toolchain:-/usr}" | ||
171 | platform_os="linux" | ||
172 | ;; | ||
173 | - x86_64*-linux-gnu*|x86_64-*-linux-uclibc*) | ||
174 | + x86_64*-linux-gnu*|x86_64-*-linux-uclibc*|x86_64-*-linux-musl*) | ||
175 | use_cpu=$host_cpu | ||
176 | use_toolchain="${use_toolchain:-/usr}" | ||
177 | platform_cflags="-fPIC -DPIC" | ||
178 | -- | ||
179 | 2.10.2 | ||
180 | |||
diff --git a/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0007-Remove-FILEWRAP.patch b/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0007-Remove-FILEWRAP.patch new file mode 100644 index 000000000..c2d3259e7 --- /dev/null +++ b/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0007-Remove-FILEWRAP.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | From f4c5710192256e903b253353fb018ebd68d0b651 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 6 Nov 2016 22:35:16 -0800 | ||
4 | Subject: [PATCH 7/8] Remove FILEWRAP | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | xbmc/utils/posix/PosixInterfaceForCLog.cpp | 6 +----- | ||
9 | xbmc/utils/posix/PosixInterfaceForCLog.h | 4 +--- | ||
10 | 2 files changed, 2 insertions(+), 8 deletions(-) | ||
11 | |||
12 | diff --git a/xbmc/utils/posix/PosixInterfaceForCLog.cpp b/xbmc/utils/posix/PosixInterfaceForCLog.cpp | ||
13 | index 6614487..a91d157 100644 | ||
14 | --- a/xbmc/utils/posix/PosixInterfaceForCLog.cpp | ||
15 | +++ b/xbmc/utils/posix/PosixInterfaceForCLog.cpp | ||
16 | @@ -28,10 +28,6 @@ | ||
17 | #include "platform/android/activity/XBMCApp.h" | ||
18 | #endif // TARGET_ANDROID | ||
19 | |||
20 | -struct FILEWRAP : public FILE | ||
21 | -{}; | ||
22 | - | ||
23 | - | ||
24 | CPosixInterfaceForCLog::CPosixInterfaceForCLog() : | ||
25 | m_file(NULL) | ||
26 | { } | ||
27 | @@ -51,7 +47,7 @@ bool CPosixInterfaceForCLog::OpenLogFile(const std::string &logFilename, const s | ||
28 | (void)remove(backupOldLogToFilename.c_str()); // if it's failed, try to continue | ||
29 | (void)rename(logFilename.c_str(), backupOldLogToFilename.c_str()); // if it's failed, try to continue | ||
30 | |||
31 | - m_file = (FILEWRAP*)fopen(logFilename.c_str(), "wb"); | ||
32 | + m_file = fopen(logFilename.c_str(), "wb"); | ||
33 | if (!m_file) | ||
34 | return false; // error, can't open log file | ||
35 | |||
36 | diff --git a/xbmc/utils/posix/PosixInterfaceForCLog.h b/xbmc/utils/posix/PosixInterfaceForCLog.h | ||
37 | index bb53442..2983e73 100644 | ||
38 | --- a/xbmc/utils/posix/PosixInterfaceForCLog.h | ||
39 | +++ b/xbmc/utils/posix/PosixInterfaceForCLog.h | ||
40 | @@ -21,8 +21,6 @@ | ||
41 | |||
42 | #include <string> | ||
43 | |||
44 | -struct FILEWRAP; // forward declaration, wrapper for FILE | ||
45 | - | ||
46 | class CPosixInterfaceForCLog | ||
47 | { | ||
48 | public: | ||
49 | @@ -34,5 +32,5 @@ public: | ||
50 | void PrintDebugString(const std::string& debugString); | ||
51 | static void GetCurrentLocalTime(int& hour, int& minute, int& second); | ||
52 | private: | ||
53 | - FILEWRAP* m_file; | ||
54 | + FILE * m_file; | ||
55 | }; | ||
56 | -- | ||
57 | 2.10.2 | ||
58 | |||
diff --git a/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0008-Fix-file_Emu-on-musl.patch b/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0008-Fix-file_Emu-on-musl.patch new file mode 100644 index 000000000..7598c7ac5 --- /dev/null +++ b/meta-multimedia/recipes-mediacenter/kodi/kodi-17/0008-Fix-file_Emu-on-musl.patch | |||
@@ -0,0 +1,496 @@ | |||
1 | From 3a10d9479e7c9a77c478b8b428e4309ff22e8498 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 6 Nov 2016 23:08:27 -0800 | ||
4 | Subject: [PATCH 8/8] Fix file_Emu on musl | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | xbmc/cores/DllLoader/exports/emu_msvcrt.cpp | 28 ++-- | ||
9 | xbmc/cores/DllLoader/exports/emu_msvcrt.h | 2 +- | ||
10 | .../DllLoader/exports/util/EmuFileWrapper.cpp | 172 +++++++++------------ | ||
11 | xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h | 27 ++-- | ||
12 | xbmc/cores/DllLoader/exports/wrapper.c | 4 +- | ||
13 | 5 files changed, 99 insertions(+), 134 deletions(-) | ||
14 | |||
15 | diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp | ||
16 | index ab14942..a39014a 100644 | ||
17 | --- a/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp | ||
18 | +++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.cpp | ||
19 | @@ -51,6 +51,7 @@ | ||
20 | #include <fcntl.h> | ||
21 | #include <time.h> | ||
22 | #include <signal.h> | ||
23 | +#include <paths.h> | ||
24 | #ifdef TARGET_POSIX | ||
25 | #include "PlatformDefs.h" // for __stat64 | ||
26 | #include "XFileUtils.h" | ||
27 | @@ -476,13 +477,10 @@ extern "C" | ||
28 | EmuFileObject* o = g_emuFileWrapper.GetFileObjectByDescriptor(fd); | ||
29 | if (o) | ||
30 | { | ||
31 | - if(!o->used) | ||
32 | - return NULL; | ||
33 | - | ||
34 | int nmode = convert_fmode(mode); | ||
35 | if( (o->mode & nmode) != nmode) | ||
36 | CLog::Log(LOGWARNING, "dll_fdopen - mode 0x%x differs from fd mode 0x%x", nmode, o->mode); | ||
37 | - return &o->file_emu; | ||
38 | + return g_emuFileWrapper.GetStreamByFileObject(o); | ||
39 | } | ||
40 | else if (!IS_STD_DESCRIPTOR(fd)) | ||
41 | { | ||
42 | @@ -545,7 +543,7 @@ extern "C" | ||
43 | return -1; | ||
44 | } | ||
45 | object->mode = iMode; | ||
46 | - return g_emuFileWrapper.GetDescriptorByStream(&object->file_emu); | ||
47 | + return g_emuFileWrapper.GetDescriptorByFileObject(object); | ||
48 | } | ||
49 | delete pFile; | ||
50 | return -1; | ||
51 | @@ -1214,8 +1212,8 @@ extern "C" | ||
52 | { | ||
53 | FILE* file = NULL; | ||
54 | #if defined(TARGET_LINUX) && !defined(TARGET_ANDROID) | ||
55 | - if (strcmp(filename, MOUNTED) == 0 | ||
56 | - || strcmp(filename, MNTTAB) == 0) | ||
57 | + if (strcmp(filename, _PATH_MOUNTED) == 0 | ||
58 | + || strcmp(filename, _PATH_MNTTAB) == 0) | ||
59 | { | ||
60 | CLog::Log(LOGINFO, "%s - something opened the mount file, let's hope it knows what it's doing", __FUNCTION__); | ||
61 | return fopen(filename, mode); | ||
62 | @@ -1622,7 +1620,7 @@ extern "C" | ||
63 | int ret; | ||
64 | |||
65 | ret = dll_fgetpos64(stream, &tmpPos); | ||
66 | -#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
67 | +#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
68 | *pos = (fpos_t)tmpPos; | ||
69 | #else | ||
70 | pos->__pos = (off_t)tmpPos.__pos; | ||
71 | @@ -1635,8 +1633,9 @@ extern "C" | ||
72 | CFile* pFile = g_emuFileWrapper.GetFileXbmcByStream(stream); | ||
73 | if (pFile != NULL) | ||
74 | { | ||
75 | -#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
76 | - *pos = pFile->GetPosition(); | ||
77 | +#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
78 | + uint64_t *ppos = (uint64_t *) pos; | ||
79 | + *ppos = pFile->GetPosition(); | ||
80 | #else | ||
81 | pos->__pos = pFile->GetPosition(); | ||
82 | #endif | ||
83 | @@ -1657,8 +1656,9 @@ extern "C" | ||
84 | int fd = g_emuFileWrapper.GetDescriptorByStream(stream); | ||
85 | if (fd >= 0) | ||
86 | { | ||
87 | -#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
88 | - if (dll_lseeki64(fd, *pos, SEEK_SET) >= 0) | ||
89 | +#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
90 | + const uint64_t *ppos = (const uint64_t *) pos; | ||
91 | + if (dll_lseeki64(fd, *ppos, SEEK_SET) >= 0) | ||
92 | #else | ||
93 | if (dll_lseeki64(fd, (__off64_t)pos->__pos, SEEK_SET) >= 0) | ||
94 | #endif | ||
95 | @@ -1674,7 +1674,7 @@ extern "C" | ||
96 | { | ||
97 | // it might be something else than a file, or the file is not emulated | ||
98 | // let the operating system handle it | ||
99 | -#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
100 | +#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
101 | return fsetpos(stream, pos); | ||
102 | #else | ||
103 | return fsetpos64(stream, pos); | ||
104 | @@ -1690,7 +1690,7 @@ extern "C" | ||
105 | if (fd >= 0) | ||
106 | { | ||
107 | fpos64_t tmpPos; | ||
108 | -#if !defined(TARGET_POSIX) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
109 | +#if !defined(__GLIBC__) || defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
110 | tmpPos= *pos; | ||
111 | #else | ||
112 | tmpPos.__pos = (off64_t)(pos->__pos); | ||
113 | diff --git a/xbmc/cores/DllLoader/exports/emu_msvcrt.h b/xbmc/cores/DllLoader/exports/emu_msvcrt.h | ||
114 | index 3294d9a..c7c483f 100644 | ||
115 | --- a/xbmc/cores/DllLoader/exports/emu_msvcrt.h | ||
116 | +++ b/xbmc/cores/DllLoader/exports/emu_msvcrt.h | ||
117 | @@ -24,7 +24,7 @@ | ||
118 | #define _onexit_t void* | ||
119 | #endif | ||
120 | |||
121 | -#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
122 | +#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(__GLIBC__) | ||
123 | typedef off_t __off_t; | ||
124 | typedef int64_t off64_t; | ||
125 | typedef off64_t __off64_t; | ||
126 | diff --git a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp | ||
127 | index 8927d41..e9a2ab0 100644 | ||
128 | --- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp | ||
129 | +++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.cpp | ||
130 | @@ -52,16 +52,7 @@ constexpr bool isValidFilePtr(FILE* f) | ||
131 | } | ||
132 | CEmuFileWrapper::CEmuFileWrapper() | ||
133 | { | ||
134 | - // since we always use dlls we might just initialize it directly | ||
135 | - for (int i = 0; i < MAX_EMULATED_FILES; i++) | ||
136 | - { | ||
137 | - memset(&m_files[i], 0, sizeof(EmuFileObject)); | ||
138 | - m_files[i].used = false; | ||
139 | -#if defined(TARGET_WINDOWS) && (_MSC_VER >= 1900) | ||
140 | - m_files[i].file_emu._Placeholder = new kodi_iobuf(); | ||
141 | -#endif | ||
142 | - FileDescriptor(m_files[i].file_emu)->_file = -1; | ||
143 | - } | ||
144 | + memset(m_files, 0, sizeof(m_files)); | ||
145 | } | ||
146 | |||
147 | CEmuFileWrapper::~CEmuFileWrapper() | ||
148 | @@ -73,29 +64,7 @@ void CEmuFileWrapper::CleanUp() | ||
149 | { | ||
150 | CSingleLock lock(m_criticalSection); | ||
151 | for (int i = 0; i < MAX_EMULATED_FILES; i++) | ||
152 | - { | ||
153 | - if (m_files[i].used) | ||
154 | - { | ||
155 | - m_files[i].file_xbmc->Close(); | ||
156 | - delete m_files[i].file_xbmc; | ||
157 | - | ||
158 | - if (m_files[i].file_lock) | ||
159 | - { | ||
160 | - delete m_files[i].file_lock; | ||
161 | - m_files[i].file_lock = nullptr; | ||
162 | - } | ||
163 | -#if !defined(TARGET_WINDOWS) | ||
164 | - //Don't memset on Windows as it overwrites our pointer | ||
165 | - memset(&m_files[i], 0, sizeof(EmuFileObject)); | ||
166 | -#endif | ||
167 | - m_files[i].used = false; | ||
168 | - FileDescriptor(m_files[i].file_emu)->_file = -1; | ||
169 | - } | ||
170 | -#if defined(TARGET_WINDOWS) && (_MSC_VER >= 1900) | ||
171 | - delete static_cast<kodi_iobuf*>(m_files[i].file_emu._Placeholder); | ||
172 | - m_files[i].file_emu._Placeholder = nullptr; | ||
173 | -#endif | ||
174 | - } | ||
175 | + UnRegisterFileObject(&m_files[i], true); | ||
176 | } | ||
177 | |||
178 | EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile) | ||
179 | @@ -106,13 +75,11 @@ EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile) | ||
180 | |||
181 | for (int i = 0; i < MAX_EMULATED_FILES; i++) | ||
182 | { | ||
183 | - if (!m_files[i].used) | ||
184 | + if (!m_files[i].file_xbmc) | ||
185 | { | ||
186 | // found a free location | ||
187 | object = &m_files[i]; | ||
188 | - object->used = true; | ||
189 | object->file_xbmc = pFile; | ||
190 | - FileDescriptor(object->file_emu)->_file = (i + FILE_WRAPPER_OFFSET); | ||
191 | object->file_lock = new CCriticalSection(); | ||
192 | break; | ||
193 | } | ||
194 | @@ -121,82 +88,74 @@ EmuFileObject* CEmuFileWrapper::RegisterFileObject(XFILE::CFile* pFile) | ||
195 | return object; | ||
196 | } | ||
197 | |||
198 | -void CEmuFileWrapper::UnRegisterFileObjectByDescriptor(int fd) | ||
199 | +void CEmuFileWrapper::UnRegisterFileObject(EmuFileObject *object, bool free_file) | ||
200 | + | ||
201 | { | ||
202 | - int i = fd - FILE_WRAPPER_OFFSET; | ||
203 | - if (! (i >= 0 && i < MAX_EMULATED_FILES)) | ||
204 | - return; | ||
205 | + if (object && object->file_xbmc) | ||
206 | + { | ||
207 | + if (object->file_xbmc && free_file) | ||
208 | + { | ||
209 | + object->file_xbmc->Close(); | ||
210 | + delete object->file_xbmc; | ||
211 | + } | ||
212 | + if (object->file_lock) | ||
213 | + { | ||
214 | + delete object->file_lock; | ||
215 | + } | ||
216 | |||
217 | - if (!m_files[i].used) | ||
218 | - return; | ||
219 | + memset(object, 0, sizeof(*object)); | ||
220 | + } | ||
221 | +} | ||
222 | |||
223 | +void CEmuFileWrapper::UnRegisterFileObjectByDescriptor(int fd) | ||
224 | +{ | ||
225 | CSingleLock lock(m_criticalSection); | ||
226 | - | ||
227 | - // we assume the emulated function alreay deleted the CFile object | ||
228 | - if (m_files[i].file_lock) | ||
229 | - { | ||
230 | - delete m_files[i].file_lock; | ||
231 | - m_files[i].file_lock = nullptr; | ||
232 | - } | ||
233 | -#if !defined(TARGET_WINDOWS) | ||
234 | - //Don't memset on Windows as it overwrites our pointer | ||
235 | - memset(&m_files[i], 0, sizeof(EmuFileObject)); | ||
236 | -#endif | ||
237 | - m_files[i].used = false; | ||
238 | - FileDescriptor(m_files[i].file_emu)->_file = -1; | ||
239 | + UnRegisterFileObject(GetFileObjectByDescriptor(fd), false); | ||
240 | } | ||
241 | |||
242 | void CEmuFileWrapper::UnRegisterFileObjectByStream(FILE* stream) | ||
243 | { | ||
244 | if (isValidFilePtr(stream)) | ||
245 | { | ||
246 | - return UnRegisterFileObjectByDescriptor(FileDescriptor(*stream)->_file); | ||
247 | + CSingleLock lock(m_criticalSection); | ||
248 | + UnRegisterFileObject(GetFileObjectByStream(stream), false); | ||
249 | } | ||
250 | } | ||
251 | |||
252 | void CEmuFileWrapper::LockFileObjectByDescriptor(int fd) | ||
253 | { | ||
254 | - int i = fd - FILE_WRAPPER_OFFSET; | ||
255 | - if (i >= 0 && i < MAX_EMULATED_FILES) | ||
256 | + EmuFileObject* object = GetFileObjectByDescriptor(fd); | ||
257 | + if (object && object->file_xbmc) | ||
258 | { | ||
259 | - if (m_files[i].used) | ||
260 | - { | ||
261 | - m_files[i].file_lock->lock(); | ||
262 | - } | ||
263 | + object->file_lock->lock(); | ||
264 | } | ||
265 | } | ||
266 | |||
267 | bool CEmuFileWrapper::TryLockFileObjectByDescriptor(int fd) | ||
268 | { | ||
269 | - int i = fd - FILE_WRAPPER_OFFSET; | ||
270 | - if (i >= 0 && i < MAX_EMULATED_FILES) | ||
271 | + EmuFileObject* object = GetFileObjectByDescriptor(fd); | ||
272 | + if (object && object->file_xbmc) | ||
273 | { | ||
274 | - if (m_files[i].used) | ||
275 | - { | ||
276 | - return m_files[i].file_lock->try_lock(); | ||
277 | - } | ||
278 | + return object->file_lock->try_lock(); | ||
279 | } | ||
280 | return false; | ||
281 | } | ||
282 | |||
283 | void CEmuFileWrapper::UnlockFileObjectByDescriptor(int fd) | ||
284 | { | ||
285 | - int i = fd - FILE_WRAPPER_OFFSET; | ||
286 | - if (i >= 0 && i < MAX_EMULATED_FILES) | ||
287 | + EmuFileObject* object = GetFileObjectByDescriptor(fd); | ||
288 | + if (object && object->file_xbmc) | ||
289 | { | ||
290 | - if (m_files[i].used) | ||
291 | - { | ||
292 | - m_files[i].file_lock->unlock(); | ||
293 | - } | ||
294 | + object->file_lock->unlock(); | ||
295 | } | ||
296 | } | ||
297 | |||
298 | EmuFileObject* CEmuFileWrapper::GetFileObjectByDescriptor(int fd) | ||
299 | { | ||
300 | - int i = fd - FILE_WRAPPER_OFFSET; | ||
301 | + int i = fd - 0x7000000; | ||
302 | if (i >= 0 && i < MAX_EMULATED_FILES) | ||
303 | { | ||
304 | - if (m_files[i].used) | ||
305 | + if (m_files[i].file_xbmc) | ||
306 | { | ||
307 | return &m_files[i]; | ||
308 | } | ||
309 | @@ -204,20 +163,39 @@ EmuFileObject* CEmuFileWrapper::GetFileObjectByDescriptor(int fd) | ||
310 | return nullptr; | ||
311 | } | ||
312 | |||
313 | +int CEmuFileWrapper::GetDescriptorByFileObject(EmuFileObject *object) | ||
314 | +{ | ||
315 | + int i = object - m_files; | ||
316 | + if (i >= 0 && i < MAX_EMULATED_FILES) | ||
317 | + { | ||
318 | + return 0x7000000 + i; | ||
319 | + } | ||
320 | + | ||
321 | + return -1; | ||
322 | +} | ||
323 | + | ||
324 | EmuFileObject* CEmuFileWrapper::GetFileObjectByStream(FILE* stream) | ||
325 | { | ||
326 | - if (isValidFilePtr(stream)) | ||
327 | + EmuFileObject *object = (EmuFileObject*) stream; | ||
328 | + if (object >= &m_files[0] || object < &m_files[MAX_EMULATED_FILES]) | ||
329 | { | ||
330 | - return GetFileObjectByDescriptor(FileDescriptor(*stream)->_file); | ||
331 | + if (object->file_xbmc) | ||
332 | + { | ||
333 | + return object; | ||
334 | + } | ||
335 | } | ||
336 | + return NULL; | ||
337 | +} | ||
338 | |||
339 | - return nullptr; | ||
340 | +FILE* CEmuFileWrapper::GetStreamByFileObject(EmuFileObject *object) | ||
341 | +{ | ||
342 | + return (FILE*) object; | ||
343 | } | ||
344 | |||
345 | XFILE::CFile* CEmuFileWrapper::GetFileXbmcByDescriptor(int fd) | ||
346 | { | ||
347 | auto object = GetFileObjectByDescriptor(fd); | ||
348 | - if (object != nullptr && object->used) | ||
349 | + if (object != nullptr) | ||
350 | { | ||
351 | return object->file_xbmc; | ||
352 | } | ||
353 | @@ -228,8 +206,9 @@ XFILE::CFile* CEmuFileWrapper::GetFileXbmcByStream(FILE* stream) | ||
354 | { | ||
355 | if (isValidFilePtr(stream)) | ||
356 | { | ||
357 | - auto object = GetFileObjectByDescriptor(FileDescriptor(*stream)->_file); | ||
358 | - if (object != nullptr && object->used) | ||
359 | + EmuFileObject* object = GetFileObjectByStream(stream); | ||
360 | + if (object != NULL) | ||
361 | + | ||
362 | { | ||
363 | return object->file_xbmc; | ||
364 | } | ||
365 | @@ -239,32 +218,21 @@ XFILE::CFile* CEmuFileWrapper::GetFileXbmcByStream(FILE* stream) | ||
366 | |||
367 | int CEmuFileWrapper::GetDescriptorByStream(FILE* stream) | ||
368 | { | ||
369 | - if (isValidFilePtr(stream)) | ||
370 | - { | ||
371 | - int i = FileDescriptor(*stream)->_file - FILE_WRAPPER_OFFSET; | ||
372 | - if (i >= 0 && i < MAX_EMULATED_FILES) | ||
373 | - { | ||
374 | - return i + FILE_WRAPPER_OFFSET; | ||
375 | - } | ||
376 | - } | ||
377 | - return -1; | ||
378 | + return GetDescriptorByFileObject(GetFileObjectByStream(stream)); | ||
379 | } | ||
380 | |||
381 | FILE* CEmuFileWrapper::GetStreamByDescriptor(int fd) | ||
382 | { | ||
383 | - auto object = GetFileObjectByDescriptor(fd); | ||
384 | - if (object != nullptr && object->used) | ||
385 | - { | ||
386 | - return &object->file_emu; | ||
387 | - } | ||
388 | - return nullptr; | ||
389 | + return GetStreamByFileObject(GetFileObjectByDescriptor(fd)); | ||
390 | +} | ||
391 | + | ||
392 | +bool CEmuFileWrapper::DescriptorIsEmulatedFile(int fd) | ||
393 | +{ | ||
394 | + return GetFileObjectByDescriptor(fd) != NULL; | ||
395 | } | ||
396 | |||
397 | bool CEmuFileWrapper::StreamIsEmulatedFile(FILE* stream) | ||
398 | { | ||
399 | - if (isValidFilePtr(stream)) | ||
400 | - { | ||
401 | - return DescriptorIsEmulatedFile(FileDescriptor(*stream)->_file); | ||
402 | - } | ||
403 | - return false; | ||
404 | + return GetFileObjectByStream(stream) != NULL; | ||
405 | } | ||
406 | + | ||
407 | diff --git a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h | ||
408 | index 786fa85..311a5cf 100644 | ||
409 | --- a/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h | ||
410 | +++ b/xbmc/cores/DllLoader/exports/util/EmuFileWrapper.h | ||
411 | @@ -25,14 +25,14 @@ | ||
412 | #include "system.h" | ||
413 | #include "threads/CriticalSection.h" | ||
414 | |||
415 | -#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_ANDROID) && !defined(__UCLIBC__) | ||
416 | -#define _file _fileno | ||
417 | -#elif defined(__UCLIBC__) | ||
418 | -#define _file __filedes | ||
419 | -#endif | ||
420 | +//#if defined(TARGET_POSIX) && !defined(TARGET_DARWIN) && !defined(TARGET_FREEBSD) && !defined(TARGET_ANDROID) && !defined(__UCLIBC__) | ||
421 | +//#define _file _fileno | ||
422 | +//#elif defined(__UCLIBC__) | ||
423 | +//#define _file __filedes | ||
424 | +//#endif | ||
425 | |||
426 | #define MAX_EMULATED_FILES 50 | ||
427 | -#define FILE_WRAPPER_OFFSET 0x00000200 | ||
428 | +//#define FILE_WRAPPER_OFFSET 0x00000200 | ||
429 | |||
430 | namespace XFILE | ||
431 | { | ||
432 | @@ -47,12 +47,9 @@ struct kodi_iobuf { | ||
433 | |||
434 | typedef struct stEmuFileObject | ||
435 | { | ||
436 | - FILE file_emu; | ||
437 | XFILE::CFile* file_xbmc; | ||
438 | CCriticalSection *file_lock; | ||
439 | int mode; | ||
440 | - //Stick this last to avoid 3-7 bytes of padding | ||
441 | - bool used; | ||
442 | } EmuFileObject; | ||
443 | |||
444 | class CEmuFileWrapper | ||
445 | @@ -67,22 +64,22 @@ public: | ||
446 | void CleanUp(); | ||
447 | |||
448 | EmuFileObject* RegisterFileObject(XFILE::CFile* pFile); | ||
449 | + void UnRegisterFileObject(EmuFileObject*, bool free_file); | ||
450 | void UnRegisterFileObjectByDescriptor(int fd); | ||
451 | void UnRegisterFileObjectByStream(FILE* stream); | ||
452 | void LockFileObjectByDescriptor(int fd); | ||
453 | bool TryLockFileObjectByDescriptor(int fd); | ||
454 | void UnlockFileObjectByDescriptor(int fd); | ||
455 | EmuFileObject* GetFileObjectByDescriptor(int fd); | ||
456 | + int GetDescriptorByFileObject(EmuFileObject*); | ||
457 | EmuFileObject* GetFileObjectByStream(FILE* stream); | ||
458 | + FILE* GetStreamByFileObject(EmuFileObject*); | ||
459 | XFILE::CFile* GetFileXbmcByDescriptor(int fd); | ||
460 | XFILE::CFile* GetFileXbmcByStream(FILE* stream); | ||
461 | - static int GetDescriptorByStream(FILE* stream); | ||
462 | + int GetDescriptorByStream(FILE* stream); | ||
463 | FILE* GetStreamByDescriptor(int fd); | ||
464 | - static constexpr bool DescriptorIsEmulatedFile(int fd) | ||
465 | - { | ||
466 | - return fd >= FILE_WRAPPER_OFFSET && fd < FILE_WRAPPER_OFFSET + MAX_EMULATED_FILES; | ||
467 | - } | ||
468 | - static bool StreamIsEmulatedFile(FILE* stream); | ||
469 | + bool DescriptorIsEmulatedFile(int fd); | ||
470 | + bool StreamIsEmulatedFile(FILE* stream); | ||
471 | private: | ||
472 | EmuFileObject m_files[MAX_EMULATED_FILES]; | ||
473 | CCriticalSection m_criticalSection; | ||
474 | diff --git a/xbmc/cores/DllLoader/exports/wrapper.c b/xbmc/cores/DllLoader/exports/wrapper.c | ||
475 | index e363662..07825f3 100644 | ||
476 | --- a/xbmc/cores/DllLoader/exports/wrapper.c | ||
477 | +++ b/xbmc/cores/DllLoader/exports/wrapper.c | ||
478 | @@ -39,13 +39,13 @@ | ||
479 | #endif | ||
480 | #include <dlfcn.h> | ||
481 | |||
482 | -#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) | ||
483 | +#if defined(TARGET_DARWIN) || defined(TARGET_FREEBSD) || defined(TARGET_ANDROID) || !defined(__GLIBC__) | ||
484 | typedef off_t __off_t; | ||
485 | typedef int64_t off64_t; | ||
486 | typedef off64_t __off64_t; | ||
487 | typedef fpos_t fpos64_t; | ||
488 | #define stat64 stat | ||
489 | -#if defined(TARGET_DARWIN) || defined(TARGET_ANDROID) | ||
490 | +#if defined(TARGET_DARWIN) || defined(TARGET_ANDROID) || !defined(__GLIBC__) | ||
491 | #define _G_va_list va_list | ||
492 | #endif | ||
493 | #endif | ||
494 | -- | ||
495 | 2.10.2 | ||
496 | |||
diff --git a/meta-multimedia/recipes-mediacenter/kodi/kodi_17.bb b/meta-multimedia/recipes-mediacenter/kodi/kodi_17.bb index 0fd104a8d..8cb9dacbc 100644 --- a/meta-multimedia/recipes-mediacenter/kodi/kodi_17.bb +++ b/meta-multimedia/recipes-mediacenter/kodi/kodi_17.bb | |||
@@ -71,6 +71,12 @@ SRC_URI = "git://github.com/xbmc/xbmc.git;branch=master \ | |||
71 | file://0003-add-support-to-read-frequency-output-if-using-intel-.patch \ | 71 | file://0003-add-support-to-read-frequency-output-if-using-intel-.patch \ |
72 | file://0004-Disable-DVD-support.patch \ | 72 | file://0004-Disable-DVD-support.patch \ |
73 | file://0005-Always-compile-libcpluff-as-PIC.patch \ | 73 | file://0005-Always-compile-libcpluff-as-PIC.patch \ |
74 | file://0006-build-Add-support-for-musl-triplets.patch \ | ||
75 | " | ||
76 | |||
77 | SRC_URI_append_libc-musl = " \ | ||
78 | file://0007-Remove-FILEWRAP.patch \ | ||
79 | file://0008-Fix-file_Emu-on-musl.patch \ | ||
74 | " | 80 | " |
75 | 81 | ||
76 | inherit autotools-brokensep gettext pythonnative | 82 | inherit autotools-brokensep gettext pythonnative |