Fix SDL2 building under Termux

This is pretty much a hack.

1. Updated config.guess and config.sub for SDLnet to the latest version, making SDLnet building work.
2. Code patches mostly are about NDK and toolchain (mine is clang) oddities.

Running build-debug-sdl2 without parameters now succeed.
src/dosbox-x runs.
This may break building for other platforms, so please check.

Signed-off-by: Liu Wenyuan <15816141883@163.com>
This commit is contained in:
Dobby233Liu
2021-07-11 14:12:42 +08:00
parent 045afcf821
commit ff53b42982
7 changed files with 2584 additions and 2145 deletions

View File

@@ -4,7 +4,7 @@
/* Define temporary pagesize so the MPROTECT case and the regular case share as much code as possible */
#if (C_HAVE_MPROTECT)
#define PAGESIZE_TEMP PAGESIZE
#else
#else
#define PAGESIZE_TEMP 4096
#endif
@@ -74,7 +74,8 @@ static void cache_dynamic_common_alloc(Bitu allocsz) {
else cache_code_start_ptr = NULL; /* MAP_FAILED is NOT NULL (or at least we cannot assume that) */
}
#endif
#if defined(C_HAVE_MEMFD_CREATE) /* Try a Linux memfd which we can mmap twice, one read/write, one read/execute */
#if defined(C_HAVE_MEMFD_CREATE) && !defined(__ANDROID__) /* Try a Linux memfd which we can mmap twice, one read/write, one read/execute */
/** NTS: Android NDK doesn't really have memfd_create, but automake claims so? **/
if (cache_code_start_ptr == NULL) {
assert(cache_fd < 0);
cache_fd = memfd_create("dosbox-dynamic-core-cache",MFD_CLOEXEC);

View File

@@ -6446,7 +6446,7 @@ bool AUTOTYPE::ReadDoubleArg(const std::string &name,
if (cmd->FindString(flag, str_value, true)) {
// Can the user's value be parsed?
const double user_value = to_finite<double>(str_value);
#if defined(MACOSX) || defined(EMSCRIPTEN)
#if defined(MACOSX) || defined(EMSCRIPTEN) || (defined(__ANDROID__) && defined(__clang__))
if (isfinite(user_value)) { /* *sigh* Really, clang, really? */
#else
if (std::isfinite(user_value)) {

View File

@@ -22,7 +22,7 @@
#ifdef __GNUC__
# if defined(__MINGW32__) || (defined(MACOSX) && !defined(__arm64__))
# include "fpu_control_x86.h"
# elif (defined(MACOSX) && defined(__arm64__)) || defined(EMSCRIPTEN)
# elif defined(__ANDROID__) || (defined(MACOSX) && defined(__arm64__)) || defined(EMSCRIPTEN)
/* ? */
# define _FPU_SETCW(x) /* dummy */
# else

View File

@@ -582,6 +582,11 @@ void CONFIG::Run(void) {
"-get", "-set", "-setf",
"-writelang", "-wl", "-langname", "-ln",
"-securemode", "-setup", "-all", "-mod", "-norem", "-errtest", "-gui", NULL };
/* HACK: P_ALL is in linux/wait.h */
#if defined(P_ALL)
#define __P_ALL P_ALL
#undef P_ALL
#endif
enum prs {
P_NOMATCH, P_NOPARAMS, // fixed return values for GetParameterFromList
P_RESTART,
@@ -617,6 +622,9 @@ void CONFIG::Run(void) {
case P_ALL:
if (all<1) all = 1;
break;
#if defined(__P_ALL)
#define P_ALL __P_ALL
#endif
case P_MOD:
if (all==-1) all = 0;

View File

@@ -22,7 +22,10 @@
#include "regionalloctracking.h"
#include "parport.h"
#include <time.h>
#if !defined(__ANDROID__)
/* NDK doesn't have this */
#include <sys/timeb.h>
#endif
/* Really, Microsoft, Really?? You're the only compiler I know that doesn't understand ssize_t! */
#if defined(_MSC_VER)

File diff suppressed because it is too large Load Diff

2903
vs2015/sdlnet/config.sub vendored

File diff suppressed because it is too large Load Diff