SDL: Compatibility with Android 4.4, when compiled with Android 5.0 platform headers

This commit is contained in:
pelya
2016-10-23 01:06:21 +03:00
parent bfb186a335
commit 2f0b2b5d65
6 changed files with 52 additions and 7 deletions

View File

@@ -3,9 +3,9 @@
# Internal compiler things like '__aeabi_ddiv' or '___Unwind_Resume' may be safely ignored
rm -f exports.txt libapplication.txt
cat exports-eclair.txt > exports.txt
nm -g -p --undefined-only project/obj/local/armeabi/libapplication.so | cut -b 12- | sort > libapplication.txt
for f in project/obj/local/armeabi/*.so; do
if [ "$f" = "project/obj/local/armeabi/libapplication.so" ]; then
nm -g -p --undefined-only project/obj/local/armeabi-v7a/libapplication.so | cut -b 12- | sort > libapplication.txt
for f in project/obj/local/armeabi-v7a/*.so; do
if [ "$f" = "project/obj/local/armeabi-v7a/libapplication.so" ]; then
continue
fi
nm -g -p --defined-only $f 2>/dev/null | cut -b 12- >> exports.txt

View File

@@ -7,10 +7,10 @@ AppName="Ninslash"
AppFullName=ninslash.com
# Application version code (integer)
AppVersionCode=01908
AppVersionCode=01909
# Application user-visible version name (string)
AppVersionName="0.1.9.08 pre-alpha early access"
AppVersionName="0.1.9.09 pre-alpha early access"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu

View File

@@ -87,7 +87,12 @@
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#undef HAVE_ICONV_H
#define HAVE_SIGNAL_H 1
/* Android 4.4 has bsd_signal() libc symbol and an inline signal() function in headers,
Android 5.0 introduces signal() symbol in libc,
which means that libsdl.so compiled for Android 5.0 will crash on Andorid 4.4 and below,
furthermore, signal handlers will do nothing good and will block the native stack trace collector on Android,
so it's better to disable signals altogether. */
#undef HAVE_SIGNAL_H
#undef HAVE_ALTIVEC_H
#define HAVE_MALLOC 1

View File

@@ -76,6 +76,26 @@ int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
return(0);
}
#if defined(__ANDROID__) && !defined(__LP64__)
/* Compatibility to Android 4.4 */
static __inline__ int ___SDL_sigaddset(sigset_t *set, int signum)
{
unsigned long *local_set = (unsigned long *)set;
signum--;
local_set[signum/LONG_BIT] |= 1UL << (signum%LONG_BIT);
return 0;
}
static __inline__ int ___SDL_sigemptyset(sigset_t *set)
{
memset(set, 0, sizeof *set);
return 0;
}
#define sigaddset ___SDL_sigaddset
#define sigemptyset ___SDL_sigemptyset
#endif
void SDL_SYS_SetupThread(void)
{
int i;

View File

@@ -148,6 +148,26 @@ static void HandleAlarm(int sig)
}
}
#if defined(__ANDROID__) && !defined(__LP64__)
/* Compatibility to Android 4.4 */
static __inline__ int ___SDL_sigaddset(sigset_t *set, int signum)
{
unsigned long *local_set = (unsigned long *)set;
signum--;
local_set[signum/LONG_BIT] |= 1UL << (signum%LONG_BIT);
return 0;
}
static __inline__ int ___SDL_sigemptyset(sigset_t *set)
{
memset(set, 0, sizeof *set);
return 0;
}
#define sigaddset ___SDL_sigaddset
#define sigemptyset ___SDL_sigemptyset
#endif
int SDL_SYS_TimerInit(void)
{
struct sigaction action;