diff --git a/x11-packages/luanti/0001-enable-egl-without-sdl2.patch b/x11-packages/luanti/0001-enable-egl-without-sdl2.patch new file mode 100644 index 00000000000000..5252d7f71a4d18 --- /dev/null +++ b/x11-packages/luanti/0001-enable-egl-without-sdl2.patch @@ -0,0 +1,475 @@ +diff --git a/irr/src/CIrrDeviceLinux.cpp b/irr/src/CIrrDeviceLinux.cpp +index f20be36f787c..e889029363fc 100644 +--- a/irr/src/CIrrDeviceLinux.cpp ++++ b/irr/src/CIrrDeviceLinux.cpp +@@ -38,7 +38,7 @@ + #include "CEGLManager.h" + #endif + +-#if defined(_IRR_COMPILE_WITH_OPENGL_) ++#if defined(_IRR_COMPILE_WITH_GLX_MANAGER_) + #include "CGLXManager.h" + #endif + +@@ -69,24 +69,6 @@ + + #endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ + +-namespace irr +-{ +-namespace video +-{ +-#ifdef _IRR_COMPILE_WITH_OPENGL_ +-IVideoDriver *createOpenGLDriver(const irr::SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#endif +- +-#ifdef _IRR_COMPILE_WITH_OGLES2_ +-IVideoDriver *createOGLES2Driver(const irr::SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#endif +- +-#ifdef _IRR_COMPILE_WITH_WEBGL1_ +-IVideoDriver *createWebGL1Driver(const irr::SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#endif +-} +-} // end namespace irr +- + namespace + { + Atom X_ATOM_CLIPBOARD; +@@ -397,10 +379,11 @@ bool CIrrDeviceLinux::createWindow() + if (WMCheck != None) + HasNetWM = true; + +-#if defined(_IRR_COMPILE_WITH_OPENGL_) ++#if defined(_IRR_COMPILE_WITH_GLX_MANAGER_) + // don't use the XVisual with OpenGL, because it ignores all requested + // properties of the CreationParams +- if (CreationParams.DriverType == video::EDT_OPENGL) { ++ if (CreationParams.DriverType == video::EDT_OPENGL ++ || CreationParams.DriverType == video::EDT_OPENGL3) { + video::SExposedVideoData data; + data.OpenGLLinux.X11Display = XDisplay; + ContextManager = new video::CGLXManager(CreationParams, data, Screennr); +@@ -539,51 +522,54 @@ void CIrrDeviceLinux::createDriver() + switch (CreationParams.DriverType) { + #ifdef _IRR_COMPILE_WITH_X11_ + case video::EDT_OPENGL: +-#ifdef _IRR_COMPILE_WITH_OPENGL_ + { ++#ifdef _IRR_COMPILE_WITH_OPENGL_ + video::SExposedVideoData data; + data.OpenGLLinux.X11Window = XWindow; + data.OpenGLLinux.X11Display = XDisplay; + + ContextManager->initialize(CreationParams, data); +- ++#endif + VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager); + } +-#else +- os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); ++ break; ++ case video::EDT_OPENGL3: ++ { ++#ifdef ENABLE_OPENGL3 ++ video::SExposedVideoData data; ++ data.OpenGLLinux.X11Window = XWindow; ++ data.OpenGLLinux.X11Display = XDisplay; ++ ++ ContextManager->initialize(CreationParams, data); + #endif ++ VideoDriver = video::createOpenGL3Driver(CreationParams, FileSystem, ContextManager); ++ } + break; + case video::EDT_OGLES2: +-#ifdef _IRR_COMPILE_WITH_OGLES2_ + { ++#ifdef _IRR_COMPILE_WITH_OGLES2_ + video::SExposedVideoData data; + data.OpenGLLinux.X11Window = XWindow; + data.OpenGLLinux.X11Display = XDisplay; + + ContextManager = new video::CEGLManager(); + ContextManager->initialize(CreationParams, data); +- ++#endif + VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager); + } +-#else +- os::Printer::log("No OpenGL-ES2 support compiled in.", ELL_ERROR); +-#endif + break; + case video::EDT_WEBGL1: +-#ifdef _IRR_COMPILE_WITH_WEBGL1_ + { ++#ifdef _IRR_COMPILE_WITH_WEBGL1_ + video::SExposedVideoData data; + data.OpenGLLinux.X11Window = XWindow; + data.OpenGLLinux.X11Display = XDisplay; + + ContextManager = new video::CEGLManager(); + ContextManager->initialize(CreationParams, data); +- ++#endif + VideoDriver = video::createWebGL1Driver(CreationParams, FileSystem, ContextManager); + } +-#else +- os::Printer::log("No WebGL1 support compiled in.", ELL_ERROR); +-#endif + break; + case video::EDT_NULL: + VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize); +@@ -591,7 +577,7 @@ void CIrrDeviceLinux::createDriver() + default: + os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR); + break; +-#else ++#else // no X11 + case video::EDT_NULL: + VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize); + break; +diff --git a/irr/src/CIrrDeviceOSX.mm b/irr/src/CIrrDeviceOSX.mm +index 43c1c81b62e4..4b46e5e29510 100644 +--- a/irr/src/CIrrDeviceOSX.mm ++++ b/irr/src/CIrrDeviceOSX.mm +@@ -433,14 +433,6 @@ long GetDictionaryLong(CFDictionaryRef theDict, const void *key) + return value; + } + +-namespace irr +-{ +-namespace video +-{ +-IVideoDriver *createOpenGLDriver(const SIrrlichtCreationParameters ¶m, io::IFileSystem *io, IContextManager *contextManager); +-} +-} // end namespace irr +- + static bool firstLaunch = true; + + @implementation CIrrDelegateOSX { +@@ -721,6 +713,7 @@ - (BOOL)isQuit + #endif + break; + ++ case video::EDT_OPENGL3: + case video::EDT_OGLES2: + os::Printer::log("This driver is not available on OSX.", ELL_ERROR); + break; +diff --git a/irr/src/CIrrDeviceSDL.cpp b/irr/src/CIrrDeviceSDL.cpp +index 408027761b62..543bea63e2d6 100644 +--- a/irr/src/CIrrDeviceSDL.cpp ++++ b/irr/src/CIrrDeviceSDL.cpp +@@ -29,53 +29,6 @@ + + static int SDLDeviceInstances = 0; + +-namespace irr +-{ +-namespace video +-{ +-#ifdef _IRR_COMPILE_WITH_OPENGL_ +-IVideoDriver *createOpenGLDriver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#else +-static IVideoDriver *createOpenGLDriver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) +-{ +- os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); +- return nullptr; +-} +-#endif +- +-#ifdef ENABLE_OPENGL3 +-IVideoDriver *createOpenGL3Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#else +-static IVideoDriver *createOpenGL3Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) +-{ +- os::Printer::log("No OpenGL 3 support compiled in.", ELL_ERROR); +- return nullptr; +-} +-#endif +- +-#ifdef _IRR_COMPILE_WITH_OGLES2_ +-IVideoDriver *createOGLES2Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#else +-static IVideoDriver *createOGLES2Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) +-{ +- os::Printer::log("No OpenGL ES 2 support compiled in.", ELL_ERROR); +- return nullptr; +-} +-#endif +- +-#ifdef _IRR_COMPILE_WITH_WEBGL1_ +-IVideoDriver *createWebGL1Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#else +-static IVideoDriver *createWebGL1Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) +-{ +- os::Printer::log("No WebGL 1 support compiled in.", ELL_ERROR); +- return nullptr; +-} +-#endif +-} // end namespace video +- +-} // end namespace irr +- + namespace irr + { + #ifdef _IRR_EMSCRIPTEN_PLATFORM_ +diff --git a/irr/src/CIrrDeviceStub.cpp b/irr/src/CIrrDeviceStub.cpp +index fd8e458c84d6..2bd0fb1d0f56 100644 +--- a/irr/src/CIrrDeviceStub.cpp ++++ b/irr/src/CIrrDeviceStub.cpp +@@ -17,6 +17,42 @@ + + namespace irr + { ++namespace video ++{ ++#ifndef _IRR_COMPILE_WITH_OPENGL_ ++IVideoDriver *createOpenGLDriver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) ++{ ++ os::Printer::log("No OpenGL support compiled in.", ELL_ERROR); ++ return nullptr; ++} ++#endif ++ ++#ifndef ENABLE_OPENGL3 ++IVideoDriver *createOpenGL3Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) ++{ ++ os::Printer::log("No OpenGL 3 support compiled in.", ELL_ERROR); ++ return nullptr; ++} ++#endif ++ ++#ifndef _IRR_COMPILE_WITH_OGLES2_ ++IVideoDriver *createOGLES2Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) ++{ ++ os::Printer::log("No OpenGL ES 2 support compiled in.", ELL_ERROR); ++ return nullptr; ++} ++#endif ++ ++#ifndef _IRR_COMPILE_WITH_WEBGL1_ ++IVideoDriver *createWebGL1Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) ++{ ++ os::Printer::log("No WebGL 1 support compiled in.", ELL_ERROR); ++ return nullptr; ++} ++#endif ++} ++ ++ + //! constructor + CIrrDeviceStub::CIrrDeviceStub(const SIrrlichtCreationParameters ¶ms) : + IrrlichtDevice(), VideoDriver(0), GUIEnvironment(0), SceneManager(0), +diff --git a/irr/src/CIrrDeviceStub.h b/irr/src/CIrrDeviceStub.h +index 9a1966f01532..c46fd64fcb38 100644 +--- a/irr/src/CIrrDeviceStub.h ++++ b/irr/src/CIrrDeviceStub.h +@@ -33,7 +33,15 @@ IFileSystem *createFileSystem(); + + namespace video + { +-IVideoDriver *createNullDriver(io::IFileSystem *io, const core::dimension2d &screenSize); ++ IVideoDriver *createNullDriver(io::IFileSystem *io, const core::dimension2d &screenSize); ++ ++ IVideoDriver *createOpenGLDriver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); ++ ++ IVideoDriver *createOpenGL3Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); ++ ++ IVideoDriver *createOGLES2Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); ++ ++ IVideoDriver *createWebGL1Driver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); + } + + //! Stub for an Irrlicht Device implementation +diff --git a/irr/src/CIrrDeviceWin32.cpp b/irr/src/CIrrDeviceWin32.cpp +index 366be80131c7..4176945174b7 100644 +--- a/irr/src/CIrrDeviceWin32.cpp ++++ b/irr/src/CIrrDeviceWin32.cpp +@@ -34,24 +34,10 @@ + #include "CEGLManager.h" + #endif + +-#if defined(_IRR_COMPILE_WITH_OPENGL_) ++#if defined(_IRR_COMPILE_WITH_WGL_MANAGER_) + #include "CWGLManager.h" + #endif + +-namespace irr +-{ +-namespace video +-{ +-#ifdef _IRR_COMPILE_WITH_OPENGL_ +-IVideoDriver *createOpenGLDriver(const irr::SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#endif +- +-#ifdef _IRR_COMPILE_WITH_OGLES2_ +-IVideoDriver *createOGLES2Driver(const irr::SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager); +-#endif +-} +-} // end namespace irr +- + namespace irr + { + struct SJoystickWin32Control +@@ -880,14 +866,23 @@ void CIrrDeviceWin32::createDriver() + + ContextManager = new video::CWGLManager(); + ContextManager->initialize(CreationParams, video::SExposedVideoData(HWnd)); +- ++#endif + VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager); + + if (!VideoDriver) + os::Printer::log("Could not create OpenGL driver.", ELL_ERROR); +-#else +- os::Printer::log("OpenGL driver was not compiled in.", ELL_ERROR); ++ break; ++ case video::EDT_OPENGL3: ++#ifdef ENABLE_OPENGL3 ++ switchToFullScreen(); ++ ++ ContextManager = new video::CWGLManager(); ++ ContextManager->initialize(CreationParams, video::SExposedVideoData(HWnd)); + #endif ++ VideoDriver = video::createOpenGL3Driver(CreationParams, FileSystem, ContextManager); ++ ++ if (!VideoDriver) ++ os::Printer::log("Could not create OpenGL 3 driver.", ELL_ERROR); + break; + case video::EDT_OGLES2: + #ifdef _IRR_COMPILE_WITH_OGLES2_ +@@ -895,14 +890,11 @@ void CIrrDeviceWin32::createDriver() + + ContextManager = new video::CEGLManager(); + ContextManager->initialize(CreationParams, video::SExposedVideoData(HWnd)); +- ++#endif + VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager); + + if (!VideoDriver) + os::Printer::log("Could not create OpenGL-ES2 driver.", ELL_ERROR); +-#else +- os::Printer::log("OpenGL-ES2 driver was not compiled in.", ELL_ERROR); +-#endif + break; + case video::EDT_WEBGL1: + os::Printer::log("WebGL1 driver not supported on Win32 device.", ELL_ERROR); +diff --git a/irr/src/CMakeLists.txt b/irr/src/CMakeLists.txt +index 3b578d699d2b..b95c3ef73f8b 100644 +--- a/irr/src/CMakeLists.txt ++++ b/irr/src/CMakeLists.txt +@@ -123,10 +123,10 @@ if(USE_SDL2) + if(NOT ANDROID) + set(DEFAULT_OPENGL3 TRUE) + endif() +- option(ENABLE_OPENGL3 "Enable OpenGL 3+" ${DEFAULT_OPENGL3}) + else() +- set(ENABLE_OPENGL3 FALSE) ++ set(DEFAULT_OPENGL3 FALSE) + endif() ++option(ENABLE_OPENGL3 "Enable OpenGL 3+" ${DEFAULT_OPENGL3}) + + if(ANDROID OR EMSCRIPTEN) + set(ENABLE_OPENGL FALSE) +@@ -152,9 +152,11 @@ else() + endif() + endif() + +-if(ENABLE_OPENGL) +- add_definitions(-D_IRR_COMPILE_WITH_OPENGL_) +- set(OPENGL_DIRECT_LINK TRUE) # driver relies on this ++if(ENABLE_OPENGL OR (ENABLE_OPENGL3 AND NOT USE_SDL2)) ++ if(ENABLE_OPENGL) ++ add_definitions(-D_IRR_COMPILE_WITH_OPENGL_) ++ set(OPENGL_DIRECT_LINK TRUE) # driver relies on this ++ endif() + if(DEVICE STREQUAL "WINDOWS") + add_definitions(-D_IRR_COMPILE_WITH_WGL_MANAGER_) + elseif(DEVICE STREQUAL "X11") +@@ -165,7 +167,11 @@ if(ENABLE_OPENGL) + endif() + + if(ENABLE_OPENGL3) +- if (NOT USE_SDL2) ++ if(DEVICE STREQUAL "WINDOWS") ++ # supported ++ elseif(DEVICE STREQUAL "X11") ++ # supported ++ elseif (NOT USE_SDL2) + message(FATAL_ERROR "OpenGL 3 driver requires SDL2") + endif() + endif() +diff --git a/irr/src/COpenGLDriver.cpp b/irr/src/COpenGLDriver.cpp +index ee63fc84583b..2cbf6d8e6717 100644 +--- a/irr/src/COpenGLDriver.cpp ++++ b/irr/src/COpenGLDriver.cpp +@@ -3239,19 +3239,9 @@ COpenGLCacheHandler *COpenGLDriver::getCacheHandler() const + return CacheHandler; + } + +-} // end namespace +-} // end namespace +- +-#endif // _IRR_COMPILE_WITH_OPENGL_ +- +-namespace irr +-{ +-namespace video +-{ + + IVideoDriver *createOpenGLDriver(const SIrrlichtCreationParameters ¶ms, io::IFileSystem *io, IContextManager *contextManager) + { +-#ifdef _IRR_COMPILE_WITH_OPENGL_ + COpenGLDriver *ogl = new COpenGLDriver(params, io, contextManager); + + if (!ogl->initDriver()) { +@@ -3260,10 +3250,8 @@ IVideoDriver *createOpenGLDriver(const SIrrlichtCreationParameters ¶ms, io:: + } + + return ogl; +-#else +- return 0; +-#endif + } + +-} // end namespace +-} // end namespace ++} // end namespace video ++} // end namespace irr ++#endif // opengl +diff --git a/irr/src/OpenGL/Driver.cpp b/irr/src/OpenGL/Driver.cpp +index fe9a24758230..4f3ac627a456 100644 +--- a/irr/src/OpenGL/Driver.cpp ++++ b/irr/src/OpenGL/Driver.cpp +@@ -226,8 +226,8 @@ void COpenGL3DriverBase::initVersion() + printVersion(); + + // print renderer information +- VendorName = GL.GetString(GL_VENDOR); +- os::Printer::log("Vendor", VendorName.c_str(), ELL_INFORMATION); ++ VendorName = GL.GetString(GL_RENDERER); ++ os::Printer::log("Renderer", VendorName.c_str(), ELL_INFORMATION); + + Version = getVersionFromOpenGL(); + } +diff --git a/irr/src/OpenGL3/Driver.cpp b/irr/src/OpenGL3/Driver.cpp +index fd018b91d94d..53cb8c7ed86b 100644 +--- a/irr/src/OpenGL3/Driver.cpp ++++ b/irr/src/OpenGL3/Driver.cpp +@@ -34,8 +34,14 @@ OpenGLVersion COpenGL3Driver::getVersionFromOpenGL() const + + void COpenGL3Driver::initFeatures() + { +- assert(Version.Spec == OpenGLSpec::Compat); +- assert(isVersionAtLeast(3, 2)); ++ if (Version.Spec != OpenGLSpec::Compat) { ++ os::Printer::log("OpenGL 3 driver requires Compatibility Mode", ELL_ERROR); ++ throw std::exception(); ++ } ++ if (!isVersionAtLeast(3, 2)) { ++ os::Printer::log("OpenGL 3 driver requires OpenGL >= 3.2 ", ELL_ERROR); ++ throw std::exception(); ++ } + initExtensions(); + + TextureFormats[ECF_A1R5G5B5] = {GL_RGB5_A1, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV}; // WARNING: may not be renderable diff --git a/x11-packages/luanti/0002-fix-elf-directory-for-cross-compiling.patch b/x11-packages/luanti/0002-fix-elf-directory-for-cross-compiling.patch new file mode 100644 index 00000000000000..2d4c911bd0a1bb --- /dev/null +++ b/x11-packages/luanti/0002-fix-elf-directory-for-cross-compiling.patch @@ -0,0 +1,14 @@ +Luanti seems to not have previously been exposed to cross-compiling executables +for platforms other than SurfaceFlinger. This prevents the error +"CMake Error: failed to create symbolic link '/minetest': Permission denied" +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -569,7 +569,7 @@ endif() + + # When cross-compiling assume the user doesn't want to run the executable anyway, + # otherwise place it in /bin/ since Luanti can only run from there. +-if(NOT CMAKE_CROSSCOMPILING) ++if(NOT THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin") + endif() + diff --git a/x11-packages/luanti/0003-bionic-libc-x11-wsi-opengl-es-2.patch b/x11-packages/luanti/0003-bionic-libc-x11-wsi-opengl-es-2.patch new file mode 100644 index 00000000000000..b6c42772b0b315 --- /dev/null +++ b/x11-packages/luanti/0003-bionic-libc-x11-wsi-opengl-es-2.patch @@ -0,0 +1,695 @@ +I created this patch quickly and I might not have time to update it often, +but if you have questions about how this works, you can ask robertkirkman on +github or owokitty on discord. + +The basic idea is, this is Android but I disable everything I know is designed +for SurfaceFlinger display server and replace it with everything that I know +is for the X11 display server, while keeping everything else the same. + + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -89,13 +89,6 @@ set(ENABLE_UPDATE_CHECKER (NOT ${DEVELOPMENT_BUILD}) CACHE BOOL + # Included stuff + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + +-# Load default options for Android +-if(ANDROID) +- cmake_minimum_required(VERSION 3.20) +- include(AndroidLibs) +-endif() +- +- + if(TRUE) + message(STATUS "Using imported IrrlichtMt at subdirectory 'irr'") + if(BUILD_CLIENT) +--- a/irr/src/CIrrDeviceSDL.cpp ++++ b/irr/src/CIrrDeviceSDL.cpp +@@ -305,7 +305,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters ¶m) : + #endif + + if (++SDLDeviceInstances == 1) { +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + // Blocking on pause causes problems with multiplayer. + // See https://github.com/minetest/minetest/issues/10842. + SDL_SetHint(SDL_HINT_ANDROID_BLOCK_ON_PAUSE, "0"); +@@ -794,7 +794,7 @@ bool CIrrDeviceSDL::run() + #endif + + auto button = SDL_event.button.button; +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + // Android likes to send the right mouse button as the back button. + // According to some web searches I did, this is probably + // vendor/device-specific. +--- a/irr/src/CIrrDeviceSDL.h ++++ b/irr/src/CIrrDeviceSDL.h +@@ -161,7 +161,7 @@ class CIrrDeviceSDL : public CIrrDeviceStub + //! Sets the new position of the cursor. + void setPosition(s32 x, s32 y) override + { +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + // On Android, this somehow results in a camera jump when enabling + // relative mouse mode and it isn't supported anyway. + SDL_WarpMouseInWindow(Device->Window, +--- a/irr/src/CMakeLists.txt ++++ b/irr/src/CMakeLists.txt +@@ -61,11 +61,6 @@ if(WIN32) + elseif(APPLE) + add_definitions(-D_IRR_OSX_PLATFORM_) + set(DEVICE "OSX") +-elseif(ANDROID) +- add_definitions(-D_IRR_ANDROID_PLATFORM_) +- if(NOT USE_SDL2) +- message(FATAL_ERROR "The Android build requires SDL2") +- endif() + elseif(EMSCRIPTEN) + add_definitions(-D_IRR_EMSCRIPTEN_PLATFORM_ -D_IRR_COMPILE_WITH_EGL_MANAGER_) + set(LINUX_PLATFORM TRUE) +@@ -216,11 +211,7 @@ if(ENABLE_OPENGL) + find_package(OpenGL REQUIRED) + endif() + if(USE_SDL2) +- if(NOT ANDROID) +- find_package(SDL2 REQUIRED) +- else() +- # provided by AndroidLibs.cmake +- endif() ++ find_package(SDL2 REQUIRED) + message(STATUS "Found SDL2: ${SDL2_LIBRARIES}") + + # unfortunately older SDL does not provide its version to cmake, so check header. +@@ -263,7 +254,7 @@ endif() + + # Platform-specific libs + +-if(ANDROID) ++if(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + enable_language(C) + elseif(APPLE) + find_library(COCOA_LIB Cocoa REQUIRED) +@@ -497,8 +488,6 @@ target_link_libraries(IrrlichtMt PRIVATE + "$<$:${OPENGL_LIBRARIES}>" + ${EGL_LIBRARY} + +- # incl. transitive SDL2 dependencies for static linking +- "$<$:-landroid -llog -lGLESv2 -lGLESv1_CM -lOpenSLES>" + ${COCOA_LIB} + ${IOKIT_LIB} + "$<$:gdi32>" +@@ -513,6 +502,3 @@ endif() + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + target_compile_definitions(IrrlichtMt INTERFACE _DEBUG) # same + endif() +-if(APPLE OR ANDROID OR EMSCRIPTEN) +- target_compile_definitions(IrrlichtMt PUBLIC IRR_MOBILE_PATHS) +-endif() +--- a/lib/catch2/catch_amalgamated.hpp ++++ b/lib/catch2/catch_amalgamated.hpp +@@ -9046,7 +9046,7 @@ namespace Catch { + #define CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED + + +-#if defined(__ANDROID__) ++#if defined(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + # define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE + #endif + +--- a/lib/lua/src/llex.c ++++ b/lib/lua/src/llex.c +@@ -178,11 +178,11 @@ static void buffreplace (LexState *ls, char from, char to) { + + static void trydecpoint (LexState *ls, SemInfo *seminfo) { + /* format error: try to update decimal point separator */ +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + struct lconv *cv = localeconv(); + #endif + char old = ls->decpoint; +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + ls->decpoint = (cv ? cv->decimal_point[0] : '.'); + #else + ls->decpoint = '.'; +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -329,9 +329,6 @@ else() + set(PLATFORM_LIBS ${PLATFORM_LIBS} network) + endif() + +- if (ANDROID) +- set(PLATFORM_LIBS ${PLATFORM_LIBS} android log) +- endif() + endif() + + # On clang and gcc, some functionalities of std::atomic require -latomic. +@@ -467,10 +464,6 @@ set(common_SRCS + ${server_network_SRCS} + ) + +-if(ANDROID) +- set(common_SRCS ${common_SRCS} porting_android.cpp) +-endif() +- + if(BUILD_UNITTESTS) + add_subdirectory(unittest) + set(common_SRCS ${common_SRCS} ${UNITTEST_SRCS}) +@@ -556,9 +549,6 @@ include_directories(SYSTEM + ${GMP_INCLUDE_DIR} + ${JSON_INCLUDE_DIR} + ${LUA_BIT_INCLUDE_DIR} +- # on Android, Luanti depends on SDL2 directly +- # on other platforms, only IrrlichtMt depends on SDL2 +- "$<$:${SDL2_INCLUDE_DIRS}>" + ) + + if(USE_GETTEXT) +@@ -600,7 +590,7 @@ endif() + + if(BUILD_CLIENT) + # client target +- if(ANDROID) ++ if(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + add_library(${PROJECT_NAME} SHARED) + else() + add_executable(${PROJECT_NAME}) +@@ -993,7 +983,7 @@ macro(CreateLegacyAlias _cmake_target _old_path _new_name) + install(PROGRAMS "${_old_path}" DESTINATION ${BINDIR}) + endmacro() + +-if(BUILD_CLIENT AND NOT ANDROID) ++if(BUILD_CLIENT AND NOT THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION ${BINDIR} + LIBRARY DESTINATION ${BINDIR} +@@ -1031,7 +1021,7 @@ if(BUILD_SERVER) + endif() + endif() + +-if (ANDROID) ++if (THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + # Android does this manually in app/build.gradle -> prepareAssets + # for now! + elseif (USE_GETTEXT) +--- a/src/client/game.cpp ++++ b/src/client/game.cpp +@@ -151,7 +151,7 @@ struct LocalFormspecHandler : public TextDest + + if (fields.find("btn_exit_os") != fields.end()) { + g_gamecallback->exitToOS(); +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + RenderingEngine::get_raw_device()->closeDevice(); + #endif + return; +@@ -800,7 +800,7 @@ class Game { + return input->wasKeyReleased(k); + } + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + void handleAndroidChatInput(); + #endif + +@@ -944,7 +944,7 @@ class Game { + inline bool isTouchCrosshairDisabled() { + return !m_touch_use_crosshair && camera->getCameraMode() == CAMERA_MODE_FIRST; + } +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + bool m_android_chat_open; + #endif + +@@ -2032,7 +2032,7 @@ void Game::processUserInput(f32 dtime) + // Input handler step() (used by the random input generator) + input->step(dtime); + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + auto formspec = m_game_ui->getFormspecGUI(); + if (formspec) + formspec->getAndroidUIInput(); +@@ -2063,7 +2063,7 @@ void Game::processKeyInput() + } else if (wasKeyDown(KeyType::INVENTORY)) { + openInventory(); + } else if (input->cancelPressed()) { +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + m_android_chat_open = false; + #endif + if (!gui_chat_console->isOpenInhibited()) { +@@ -2278,7 +2278,7 @@ void Game::openConsole(float scale, const wchar_t *line) + { + assert(scale > 0.0f && scale <= 1.0f); + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + if (!porting::hasPhysicalKeyboardAndroid()) { + porting::showTextInputDialog("", "", 2); + m_android_chat_open = true; +@@ -2291,12 +2291,12 @@ void Game::openConsole(float scale, const wchar_t *line) + gui_chat_console->setCloseOnEnter(true); + gui_chat_console->replaceAndAddToHistory(line); + } +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + } // else + #endif + } + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + void Game::handleAndroidChatInput() + { + // It has to be a text input +@@ -4504,7 +4504,7 @@ void Game::showPauseMenu() + os << "field[4.95,0;5,1.5;;" << strgettext("Game paused") << ";]"; + } + +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + #if USE_SOUND + if (g_settings->getBool("enable_sound")) { + os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;" +--- a/src/client/hud.cpp ++++ b/src/client/hud.cpp +@@ -393,7 +393,7 @@ void Hud::drawLuaElements(const v3s16 &camera_offset) + if (e->size.X > 0) + font_size *= e->size.X; + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + // The text size on Android is not proportional with the actual scaling + // FIXME: why do we have such a weird unportable hack?? + if (font_size > 3 && e->offset.X < -20) +--- a/src/client/renderingengine.cpp ++++ b/src/client/renderingengine.cpp +@@ -163,7 +163,7 @@ RenderingEngine::RenderingEngine(MyEventReceiver *receiver) + + // Resolution selection + bool fullscreen = g_settings->getBool("fullscreen"); +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + u16 screen_w = 0, screen_h = 0; + bool window_maximized = false; + #else +@@ -328,7 +328,7 @@ void RenderingEngine::draw_load_screen(const std::wstring &text, + tsrc->getTexture("progress_bar_bg.png"); + + if (progress_img && progress_img_bg) { +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + const core::dimension2d &img_size = + progress_img_bg->getSize(); + float density = g_settings->getFloat("gui_scaling", 0.5f, 20.0f) * +@@ -419,14 +419,14 @@ const VideoDriverInfo &RenderingEngine::getVideoDriverInfo(irr::video::E_DRIVER_ + float RenderingEngine::getDisplayDensity() + { + float user_factor = g_settings->getFloat("display_density_factor", 0.5f, 5.0f); +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + float dpi = get_raw_device()->getDisplayDensity(); + if (dpi == 0.0f) + dpi = 96.0f; + return std::max(dpi / 96.0f * user_factor, 0.5f); +-#else // __ANDROID__ ++#else // THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + return porting::getDisplayDensity() * user_factor; +-#endif // __ANDROID__ ++#endif // THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + } + + void RenderingEngine::autosaveScreensizeAndCo( +--- a/src/defaultsettings.cpp ++++ b/src/defaultsettings.cpp +@@ -401,7 +401,7 @@ void set_default_settings() + settings->setDefault("contentdb_enable_updates_indicator", "true"); + settings->setDefault("contentdb_max_concurrent_downloads", "3"); + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + settings->setDefault("contentdb_flag_blacklist", "nonfree, android_default"); + #else + settings->setDefault("contentdb_flag_blacklist", "nonfree, desktop_default"); +@@ -553,9 +553,6 @@ void set_default_settings() + settings->setDefault("touch_punch_gesture", "short_tap"); + settings->setDefault("clickable_chat_weblinks", "true"); + // Altered settings for Android +-#ifdef __ANDROID__ +- settings->setDefault("screen_w", "0"); +- settings->setDefault("screen_h", "0"); + settings->setDefault("performance_tradeoffs", "true"); + settings->setDefault("max_simultaneous_block_sends_per_client", "10"); + settings->setDefault("emergequeue_limit_diskonly", "16"); +@@ -570,6 +567,9 @@ void set_default_settings() + settings->setDefault("enable_post_processing", "false"); + settings->setDefault("debanding", "false"); + settings->setDefault("curl_verify_cert", "false"); ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION ++ settings->setDefault("screen_w", "0"); ++ settings->setDefault("screen_h", "0"); + + // Apply settings according to screen size + float x_inches = (float) porting::getDisplaySize().X / +--- a/src/filesys.cpp ++++ b/src/filesys.cpp +@@ -436,7 +436,7 @@ std::string TempPath() + configuration hardcodes mkstemp("/tmp/lua_XXXXXX"). + */ + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + return porting::path_cache; + #else + return DIR_DELIM "tmp"; +--- a/src/gui/guiEngine.cpp ++++ b/src/gui/guiEngine.cpp +@@ -375,7 +375,7 @@ void GUIEngine::run() + sound_volume_control(m_sound_manager.get(), device->isWindowActive()); + m_sound_manager->step(dtime); + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + m_menu->getAndroidUIInput(); + #endif + } +--- a/src/gui/guiFormSpecMenu.cpp ++++ b/src/gui/guiFormSpecMenu.cpp +@@ -3326,7 +3326,7 @@ void GUIFormSpecMenu::legacySortElements(std::list::iterator from + reorderChildren(from, to, elements); + } + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + void GUIFormSpecMenu::getAndroidUIInput() + { + porting::AndroidDialogState dialogState = getAndroidUIInputState(); +--- a/src/gui/guiFormSpecMenu.h ++++ b/src/gui/guiFormSpecMenu.h +@@ -277,7 +277,7 @@ class GUIFormSpecMenu : public GUIModalMenu + // This will only return a meaningful value if called after drawMenu(). + core::rect getAbsoluteRect(); + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + void getAndroidUIInput(); + #endif + +--- a/src/gui/guiOpenURL.cpp ++++ b/src/gui/guiOpenURL.cpp +@@ -153,7 +153,7 @@ void GUIOpenURLMenu::drawMenu() + driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect); + + gui::IGUIElement::draw(); +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + getAndroidUIInput(); + #endif + } +--- a/src/gui/guiPasswordChange.cpp ++++ b/src/gui/guiPasswordChange.cpp +@@ -154,7 +154,7 @@ void GUIPasswordChange::drawMenu() + driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect); + + gui::IGUIElement::draw(); +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + getAndroidUIInput(); + #endif + } +@@ -250,7 +250,7 @@ std::string GUIPasswordChange::getNameByID(s32 id) + return ""; + } + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + void GUIPasswordChange::getAndroidUIInput() + { + porting::AndroidDialogState dialogState = getAndroidUIInputState(); +--- a/src/gui/guiPasswordChange.h ++++ b/src/gui/guiPasswordChange.h +@@ -44,7 +44,7 @@ class GUIPasswordChange : public GUIModalMenu + bool processInput(); + + bool OnEvent(const SEvent &event); +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + void getAndroidUIInput(); + #endif + +--- a/src/gui/modalMenu.cpp ++++ b/src/gui/modalMenu.cpp +@@ -38,7 +38,7 @@ GUIModalMenu::GUIModalMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, + s32 id, IMenuManager *menumgr, bool remap_click_outside) : + IGUIElement(gui::EGUIET_ELEMENT, env, parent, id, + core::rect(0, 0, 100, 100)), +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + m_jni_field_name(""), + #endif + m_menumgr(menumgr), +@@ -242,7 +242,7 @@ void GUIModalMenu::leave() + + bool GUIModalMenu::preprocessEvent(const SEvent &event) + { +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + // display software keyboard when clicking edit boxes + if (event.EventType == EET_MOUSE_INPUT_EVENT && + event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN && +@@ -369,7 +369,7 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event) + return false; + } + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + porting::AndroidDialogState GUIModalMenu::getAndroidUIInputState() + { + // No dialog is shown +--- a/src/gui/modalMenu.h ++++ b/src/gui/modalMenu.h +@@ -7,7 +7,7 @@ + #include "irrlichttypes_extrabloated.h" + #include "irr_ptr.h" + #include "util/string.h" +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + #include + #endif + +@@ -49,7 +49,7 @@ class GUIModalMenu : public gui::IGUIElement + virtual bool preprocessEvent(const SEvent &event); + virtual bool OnEvent(const SEvent &event) { return false; }; + virtual bool pausesGame() { return false; } // Used for pause menu +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + virtual void getAndroidUIInput() {}; + porting::AndroidDialogState getAndroidUIInputState(); + #endif +@@ -66,7 +66,7 @@ class GUIModalMenu : public gui::IGUIElement + + v2u32 m_screensize_old; + float m_gui_scale; +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + std::string m_jni_field_name; + #endif + +--- a/src/log.cpp ++++ b/src/log.cpp +@@ -14,7 +14,7 @@ + #include "util/numeric.h" + #include "filesys.h" + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + #include + #endif + +@@ -59,7 +59,7 @@ class LevelTarget : public LogTarget { + + Logger g_logger; + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + AndroidLogOutput stdout_output; + AndroidLogOutput stderr_output; + #else +@@ -88,7 +88,7 @@ thread_local LogStream derr_con(verbose_target); + thread_local LogStream dout_con(trace_target); + + // Android +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + + constexpr static unsigned int g_level_to_android[] = { + ANDROID_LOG_INFO, // LL_NONE +--- a/src/log_internal.h ++++ b/src/log_internal.h +@@ -186,14 +186,14 @@ class CaptureLogOutput : public ILogOutput { + }; + + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + class AndroidLogOutput : public ICombinedLogOutput { + public: + void logRaw(LogLevel lev, std::string_view line); + }; + #endif + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + extern AndroidLogOutput stdout_output; + extern AndroidLogOutput stderr_output; + #else +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -543,7 +543,7 @@ static bool create_userdata_path() + { + bool success; + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + if (!fs::PathExists(porting::path_user)) { + success = fs::CreateDir(porting::path_user); + } else { +@@ -596,7 +596,7 @@ namespace { + + static bool use_debugger(int argc, char *argv[]) + { +-#if defined(__ANDROID__) ++#if defined(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + return false; + #else + #ifdef _WIN32 +--- a/src/porting.cpp ++++ b/src/porting.cpp +@@ -25,7 +25,7 @@ + #if !defined(_WIN32) + #include + #include +- #if !defined(__ANDROID__) ++ #if !defined(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + #include + #endif + #endif +@@ -33,7 +33,7 @@ + #define _PSTAT64 + #include + #endif +-#if defined(__ANDROID__) ++#if defined(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + #include "porting_android.h" + #include + #endif +@@ -241,7 +241,7 @@ static std::string detectSystemInfo() + delete[] filePath; + + return oss.str(); +-#elif defined(__ANDROID__) ++#elif defined(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + std::ostringstream oss; + struct utsname osinfo; + uname(&osinfo); +@@ -461,7 +461,7 @@ bool setSystemPaths() + + //// Android + +-#elif defined(__ANDROID__) ++#elif defined(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + + extern bool setSystemPaths(); // defined in porting_android.cpp + +@@ -661,7 +661,7 @@ void initializePaths() + if (!setSystemPaths()) + errorstream << "Failed to get one or more system-wide path" << std::endl; + +-# ifdef __ANDROID__ ++# ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + sanity_check(!path_cache.empty()); + # elif defined(_WIN32) + path_cache = path_user + DIR_DELIM + "cache"; +@@ -761,7 +761,7 @@ bool secure_rand_fill_buf(void *buf, size_t len) + + #endif + +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + + void osSpecificInit() + { +@@ -860,7 +860,7 @@ int mt_snprintf(char *buf, const size_t buf_size, const char *fmt, ...) + return c; + } + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + // defined in porting_android.cpp + extern void openURIAndroid(const char *url); + #endif +@@ -874,7 +874,7 @@ static bool open_uri(const std::string &uri) + + #if defined(_WIN32) + return (intptr_t)ShellExecuteA(NULL, NULL, uri.c_str(), NULL, NULL, SW_SHOWNORMAL) > 32; +-#elif defined(__ANDROID__) ++#elif defined(THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION) + openURIAndroid(uri.c_str()); + return true; + #elif defined(__APPLE__) +--- a/src/porting.h ++++ b/src/porting.h +@@ -326,6 +326,6 @@ bool open_directory(const std::string &path); + + } // namespace porting + +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + #include "porting_android.h" + #endif +--- a/src/porting_android.cpp ++++ b/src/porting_android.cpp +@@ -2,7 +2,7 @@ + // SPDX-License-Identifier: LGPL-2.1-or-later + // Copyright (C) 2014 celeron55, Perttu Ahola + +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + #error This file may only be compiled for android! + #endif + +--- a/src/porting_android.h ++++ b/src/porting_android.h +@@ -4,7 +4,7 @@ + + #pragma once + +-#ifndef __ANDROID__ ++#ifndef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + #error This header has to be included on Android port only! + #endif + +--- a/src/script/lua_api/l_mainmenu.cpp ++++ b/src/script/lua_api/l_mainmenu.cpp +@@ -1076,7 +1076,7 @@ int ModApiMainMenu::l_open_dir(lua_State *L) + /******************************************************************************/ + int ModApiMainMenu::l_share_file(lua_State *L) + { +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + std::string path = luaL_checkstring(L, 1); + porting::shareFileAndroid(path); + lua_pushboolean(L, true); +--- a/src/server.cpp ++++ b/src/server.cpp +@@ -3101,7 +3101,7 @@ std::wstring Server::handleChat(const std::string &name, + Workaround for fixing chat on Android. Lua doesn't handle + the Cyrillic alphabet and some characters on older Android devices + */ +-#ifdef __ANDROID__ ++#ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + line += L"<" + utf8_to_wide(name) + L"> " + wmessage; + #else + line += utf8_to_wide(m_script->formatChatMessage(name, message)); diff --git a/x11-packages/luanti/0004-prepend-termux-prefix-to-tmp-path.patch b/x11-packages/luanti/0004-prepend-termux-prefix-to-tmp-path.patch new file mode 100644 index 00000000000000..24e114db8df114 --- /dev/null +++ b/x11-packages/luanti/0004-prepend-termux-prefix-to-tmp-path.patch @@ -0,0 +1,30 @@ +Fixes "An error occurred: Failed to download 'Minetest Game'" +when trying to download any gamemode through the builtin browser, +as described here: https://github.com/termux-user-repository/tur/issues/1325 + +Lua portion adapted from https://github.com/termux/termux-packages/blob/master/packages/liblua52/lua-5.2.4_src_loslib.c.patch +--- a/lib/lua/src/luaconf.h ++++ b/lib/lua/src/luaconf.h +@@ -653,9 +653,9 @@ union luai_Cast { double l_d; long l_l; }; + + #if defined(LUA_USE_MKSTEMP) + #include +-#define LUA_TMPNAMBUFSIZE 32 ++#define LUA_TMPNAMBUFSIZE 512 + #define lua_tmpnam(b,e) { \ +- strcpy(b, "/tmp/lua_XXXXXX"); \ ++ strcpy(b, "@TERMUX_PREFIX@/tmp/lua_XXXXXX"); \ + e = mkstemp(b); \ + if (e != -1) close(e); \ + e = (e == -1); } +--- a/src/filesys.cpp ++++ b/src/filesys.cpp +@@ -439,7 +439,7 @@ std::string TempPath() + #ifdef THIS_IS_FOR_SURFACEFLINGER_IN_OWOKITTYS_OPINION + return porting::path_cache; + #else +- return DIR_DELIM "tmp"; ++ return "@TERMUX_PREFIX@" DIR_DELIM "tmp"; + #endif + } + diff --git a/x11-packages/luanti/0005-toggle-on-the-recent-upstream-migration-away-from-sdl2.patch b/x11-packages/luanti/0005-toggle-on-the-recent-upstream-migration-away-from-sdl2.patch new file mode 100644 index 00000000000000..5ad98a7744c068 --- /dev/null +++ b/x11-packages/luanti/0005-toggle-on-the-recent-upstream-migration-away-from-sdl2.patch @@ -0,0 +1,16 @@ +This is https://github.com/minetest/minetest/pull/15284 +but for Termux +--- a/irr/src/CMakeLists.txt ++++ b/irr/src/CMakeLists.txt +@@ -1,6 +1,10 @@ + # When enabling SDL2 by default on macOS, don't forget to change + # "NSHighResolutionCapable" to true in "Info.plist". +-if(ANDROID) ++# luanti has migrated to make SDL2 an optional dependency ++# on all platforms that are not using system APIs that directly interface with ++# normal Android/SurfaceFlinger/ANativeWindow/JNI/ART/DEX/Android SDK/Android without Termux ++# with possibly subtly-different behavior between the mode with SDL2 and the mode without it. ++if(THIS_IS_OPTIONAL) + set(DEFAULT_SDL2 ON) + endif() + diff --git a/x11-packages/luanti/0006-fix-incompatible-type-ekey-code.patch b/x11-packages/luanti/0006-fix-incompatible-type-ekey-code.patch new file mode 100644 index 00000000000000..f2cc6cc2f36295 --- /dev/null +++ b/x11-packages/luanti/0006-fix-incompatible-type-ekey-code.patch @@ -0,0 +1,11 @@ +--- a/irr/src/CIrrDeviceLinux.cpp ++++ b/irr/src/CIrrDeviceLinux.cpp +@@ -693,7 +693,7 @@ EKEY_CODE CIrrDeviceLinux::getKeyCode(XEvent &event) + keyCode = (EKEY_CODE)KeyMap[idx].Win32Key; + } + if (keyCode == 0) { +- keyCode = KEY_UNKNOWN; ++ keyCode = (EKEY_CODE)KEY_UNKNOWN; + if (!mp.X11Key) { + os::Printer::log("No such X11Key, event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION); + } else if (idx == -1) { diff --git a/x11-packages/luanti/build.sh b/x11-packages/luanti/build.sh new file mode 100644 index 00000000000000..302223d6c4f279 --- /dev/null +++ b/x11-packages/luanti/build.sh @@ -0,0 +1,14 @@ +TERMUX_PKG_HOMEPAGE=https://www.luanti.org +TERMUX_PKG_DESCRIPTION="An open source voxel game engine." +TERMUX_PKG_LICENSE="LGPL-2.1" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1:5.10.0 +TERMUX_PKG_REVISION=4 +TERMUX_PKG_SRCURL=https://github.com/minetest/minetest/archive/refs/tags/${TERMUX_PKG_VERSION:2}.zip +TERMUX_PKG_SHA256=e74e994c0f1b188d60969477f553ad83b8ce20ee1e0e2dcd068120189cb0f56c +TERMUX_PKG_AUTO_UPDATE=true +TERMUX_PKG_DEPENDS="freetype, jsoncpp, libandroid-spawn, libc++, libcurl, libglvnd-dev, libgmp, libjpeg-turbo, libiconv, libpng, libsqlite, libvorbis, libxi, luajit, openal-soft, zstd" + +termux_step_pre_configure() { + export LDFLAGS+=" -landroid-spawn" +}