Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ else {

android {
namespace 'org.tuxpaint'
compileSdkVersion 34
compileSdkVersion 35
defaultConfig {
minSdkVersion 21
targetSdkVersion 34
targetSdkVersion 35
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-21"
abiFilters 'arm64-v8a'
// Add 16KB page size alignment support - use ldFlags instead of cFlags
arguments "APP_LDFLAGS+=-Wl,-z,max-page-size=16384"
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
APP_ABI := arm64-v8a
APP_PLATFORM := android-16
APP_CFLAGS += -Wno-error=format-security
APP_CFLAGS += -Wno-error=format-security -Wno-error=cast-function-type-strict -Wno-error
APP_STL := c++_shared
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -fexceptions -Wno-error=cast-function-type-strict -Wno-error
APP_CXXFLAGS += -Wno-error=cast-function-type-strict -Wno-error
APP_ALLOW_MISSING_DEPS := true
# Add 16KB page size alignment support for Google Play Store 2025 requirements
APP_LDFLAGS += -Wl,-z,max-page-size=16384

Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
ASensorEvent event;
struct android_poll_source *source;

if (ALooper_pollAll(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
if (ALooper_pollOnce(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
SDL_zero(event);
while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) {
SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data));
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/jni/SDL2_ttf/external/harfbuzz/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ LOCAL_C_INCLUDES = \
LOCAL_STATIC_LIBRARIES += freetype

#LOCAL_CFLAGS += -DHB_NO_MT -DHAVE_OT -DHAVE_UCDN -fPIC
LOCAL_CFLAGS += -DHAVE_CONFIG_H -fPIC
LOCAL_CFLAGS += -DHAVE_CONFIG_H -fPIC -Wno-cast-function-type-strict -Wno-error -Wno-cast-function-type -w
LOCAL_CXXFLAGS += -Wno-cast-function-type-strict -Wno-error -Wno-cast-function-type -Wno-cast-function-type-strict -w
LOCAL_CPPFLAGS += -Wno-cast-function-type-strict -Wno-error -Wno-cast-function-type -w

LOCAL_EXPORT_C_INCLUDES = $(LOCAL_PATH)/src/

Expand Down
1 change: 1 addition & 0 deletions app/src/main/jni/cairo-1.14.0/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ LOCAL_CFLAGS := \
-D_REENTRANT \
-DCAIRO_NO_MUTEX=1 \
-Wno-attributes \
-Wno-error=int-conversion \
$(NULL)

LOCAL_C_INCLUDES := \
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/jni/glib-2.77.0/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,9 @@ LOCAL_CFLAGS := \
-DGIO_COMPILATION \
-DGIO_MODULE_DIR=\"/mnt/sdcard/Android/data/org.tuxpaint/files/glib\" \
-DXDG_PREFIX=_gio_xdg \
-marm \
-UHAVE_STRERROR_R \
-USTRERROR_R_CHAR_P \
-Wno-error=int-conversion \
$(NULL)

LOCAL_SHARED_LIBRARIES := \
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/jni/tuxpaint/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ MY_DEFS := \
-DHAVE_STRCASESTR \
$(MY_NOSOUNDFLAG) $(MY_NOSVGFLAG) $(MY_NOPANGOFLAG)

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../SDL2/src/events \
$(LOCAL_PATH)/../libimagequant \
$(LOCAL_PATH)/src/mouse \
$(LOCAL_PATH)/../fribidi-1.0.13 \
$(NULL)

LOCAL_CFLAGS := \
$(MY_CFLAGS) \
$(MY_DEFS)
Expand All @@ -86,6 +93,11 @@ LOCAL_LDLIBS := \
-lz -llog -lGLESv1_CM -lGLESv2 -landroid \
$(NULL)

# Add 16KB page size alignment support for Google Play Store 2025 requirements
LOCAL_LDFLAGS := \
-Wl,-z,max-page-size=16384 \
$(NULL)

LOCAL_SHARED_LIBRARIES := SDL2 SDL2_image SDL2_mixer SDL2_ttf SDL2_Pango tuxpaint_intl tuxpaint_fribidi tuxpaint_png tuxpaint_rsvg tuxpaint_cairo tp_android_assets_fopen libimagequant SDL2_gfx tuxpaint_pango tuxpaint_fontconfig tuxpaint_glib tuxpaint_xml2

include $(BUILD_SHARED_LIBRARY)
Expand All @@ -98,6 +110,8 @@ $(foreach _magic, $(MAGIC_NAMES),\
$(eval LOCAL_MODULE := $(_magic))\
$(eval LOCAL_C_INCLUDES := $(LOCAL_PATH)/src $(LOCAL_PATH)/../SDL2_gfx-1.0.4/)\
$(eval MAGIC_CFLAGS:=-g3 -O2 -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall)\
$(eval LOCAL_CFLAGS := $(MAGIC_CFLAGS))\
$(eval LOCAL_LDFLAGS := -Wl,-z,max-page-size=16384)\
$(eval LOCAL_SRC_FILES := magic/src/$(_magic).c)\
$(eval LOCAL_SHARED_LIBRARIES := SDL2 SDL2_image SDL2_mixer SDL2_ttf tuxpaint_intl SDL2_gfx)\
$(eval include $(BUILD_SHARED_LIBRARY))\
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/jni/tuxpaint/src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@
*
* Verbose logging adds metadata to printf, including the source file location
* from where printf was called and the time it was called at runtime.
*
* Note: On Android, we use __android_log_print instead to avoid infinite recursion
* and to properly log to the Android logcat system.
*/
#if defined(DEBUG) && defined(VERBOSE) && defined(__GNUC__)
#if defined(DEBUG) && defined(VERBOSE) && defined(__GNUC__) && !defined(__ANDROID__)
#include <stdio.h>
#include <time.h>

#define printf(args...) do { \
time_t now = time(NULL); \
printf("\n### %s, line %d in %s() @ %s", __FILE__, __LINE__, __FUNCTION__, ctime(&now)); \
printf(args); \
fprintf(stderr, "\n### %s, line %d in %s() @ %s", __FILE__, __LINE__, __FUNCTION__, ctime(&now)); \
fprintf(stderr, args); \
} while(0)
#endif

Expand Down
1 change: 1 addition & 0 deletions app/src/main/jni/tuxpaint/src/i18n.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

#ifdef __ANDROID__
#include "SDL2/SDL.h"
#include "../../../SDL2/src/core/android/SDL_android.h"
#include "jni.h"
// since setlocale on the Android is not supported well,
// setlocale cannot get current default locale of the device.
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/jni/tuxpaint/src/progressbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ void show_progress_bar_(SDL_Surface *screen, SDL_Texture *texture, SDL_Renderer
if (progress_bar_disabled)
return;

#ifdef __ANDROID__
/* On Android, skip all rendering operations in progress bar because:
* 1. It's called from worker threads (font loading, file scanning, etc.)
* 2. OpenGL/EGL contexts are thread-local and cannot be used from worker threads
* 3. Even with valid renderer/texture/screen parameters, the GL context is not
* current on the worker thread, causing SIGSEGV when GL functions are called
*
* We still allow the function to continue to update internal state like prog_bar_ctr
* and oldtime, but skip all SDL rendering calls. */
newtime = SDL_GetTicks();
if (newtime > oldtime + 500) {
prog_bar_ctr++;
}
oldtime = newtime;
return;
#endif

newtime = SDL_GetTicks();
if (newtime > oldtime + 15) /* trying not to eat some serious CPU time! */
{
Expand Down
Loading
Loading