Global (Android): fixes building on old API level

This commit is contained in:
Carter Li
2026-10-07 00:58:45 +08:00
parent 04a5c2d9d3
commit 10ca4f171e
5 changed files with 40 additions and 10 deletions
+1 -1
View File
@@ -598,7 +598,7 @@ const char* ffDexStaticInts(const char* jarPath, const FFDexStaticIntRequest* re
[[gnu::cleanup(wrapDexMapping)]] FFDexMapping mapping = {};
{
FF_AUTO_CLOSE_FD const int fd = open(jarPath, O_RDONLY | O_CLOEXEC);
FF_AUTO_CLOSE_FD int fd = open(jarPath, O_RDONLY | O_CLOEXEC);
if (fd < 0) {
FF_DEBUG("open(%s) failed: %s", jarPath, strerror(errno));
return "open(jar) failed";
+6 -2
View File
@@ -17,7 +17,7 @@
#if FF_HAVE_WORDEXP
#include <wordexp.h>
#else
#elif FF_HAVE_GLOB
#include <glob.h>
#endif
@@ -112,7 +112,7 @@ bool ffPathExpandEnv(const char* in, FFstrbuf* out) {
wordfree(&exp);
#else
#elif FF_HAVE_GLOB
glob_t gb;
if (glob(in, GLOB_NOSORT
@@ -134,6 +134,10 @@ bool ffPathExpandEnv(const char* in, FFstrbuf* out) {
globfree(&gb);
#else
FF_UNUSED(in, out)
#endif
return result;
+5 -2
View File
@@ -6,8 +6,11 @@
#include <string.h>
#if __ANDROID__ && !defined(FF_HAVE_EGL)
// On Android, installing OpenGL headers is enough (mesa-dev)
#if __has_include(<EGL/egl.h>)
// On Android the EGL headers ship with the NDK, but the desktop GL ones only come from mesa-dev,
// which a plain NDK build does not have. The block below includes <GL/gl.h>, so that is the
// header to probe: probing <EGL/egl.h> turns this on for every NDK build and then fails to
// compile. Termux installs mesa-dev, so it still gets the EGL path.
#if __has_include(<EGL/egl.h>) && __has_include(<GL/gl.h>)
#define FF_HAVE_EGL 1
#endif
#endif