From ebef51b4eac730f727af688a7f9c6f58cd553622 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 20 Mar 2023 00:29:46 +0000 Subject: [PATCH] Continue trying to make the android build smaller. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4240 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- Makefile | 15 +++++++++++---- src/main.c | 4 +++- src/serialize.c | 3 +-- src/socket.js.c | 2 -- src/ssb.js.c | 2 -- src/ssb.tests.c | 8 +------- src/task.c | 10 +--------- src/taskstub.js.c | 2 -- src/util.js.c | 11 ++--------- 9 files changed, 19 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 63aa5eca..f35b5318 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ CFLAGS += \ -MMD \ -ffunction-sections \ -fdata-sections \ - -fno-omit-frame-pointer \ + -fno-exceptions \ -g LDFLAGS += -Wl,--gc-sections @@ -51,8 +51,13 @@ ANDROID_RELEASE_TARGETS := $(filter-out $(DEBUG_TARGETS),$(ANDROID_TARGETS)) NONANDROID_RELEASE_TARGETS := $(filter-out $(ANDROID_ARM64_TARGETS),$(RELEASE_TARGETS)) NONANDROID_TARGETS := $(filter-out $(ANDROID_TARGETS),$(DEBUG_TARGETS) $(RELEASE_TARGETS)) -debug release out/androidrelease/tildefriends out/androidrelease-x86_64/tildefriends: LDFLAGS += -rdynamic -$(ANDROID_TARGETS): CFLAGS += --sysroot $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC +$(NONANDROID_TARGETS): CFLAGS += -fno-omit-frame-pointer +$(NONANDROID_TARGETS): LDFLAGS += -rdynamic +$(ANDROID_TARGETS): CFLAGS += \ + --sysroot $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot \ + -fPIC \ + -fomit-frame-pointer \ + -fno-asynchronous-unwind-tables $(ANDROID_TARGETS): LDFLAGS += --sysroot $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC $(DEBUG_TARGETS): CFLAGS += -DDEBUG -Og $(RELEASE_TARGETS): CFLAGS += -DNDEBUG @@ -256,8 +261,10 @@ $(SQLITE_OBJS): CFLAGS += \ -DSQLITE_DBCONFIG_DEFAULT_DEFENSIVE \ -DSQLITE_DEFAULT_MEMSTATUS=0 \ -DSQLITE_DQS=0 \ + -DSQLITE_ENABLE_MEMSYS5 \ -DSQLITE_ENABLE_FTS5 \ -DSQLITE_ENABLE_JSON1 \ + -DSQLITE_LIKE_DOESNT_MATCH_BLOBS \ -DSQLITE_MAX_ATTACHED=0 \ -DSQLITE_MAX_COLUMN=100 \ -DSQLITE_MAX_COMPOUND_SELECT=300 \ @@ -273,6 +280,7 @@ $(SQLITE_OBJS): CFLAGS += \ -DSQLITE_OMIT_DESERIALIZE \ -DSQLITE_OMIT_LOAD_EXTENSION \ -DSQLITE_OMIT_TCL_VARIABLE \ + -DSQLITE_PRAGMA_DEFAULT_WAL_SYNCHRONOUS=1 \ -DSQLITE_SECURE_DELETE \ -DSQLITE_THREADSAFE=0 \ -DSQLITE_UNTESTABLE \ @@ -299,7 +307,6 @@ QUICKJS_SOURCES := \ deps/quickjs/libbf.c \ deps/quickjs/libregexp.c \ deps/quickjs/libunicode.c \ - deps/quickjs/quickjs-libc.c \ deps/quickjs/quickjs.c QUICKJS_OBJS := $(call get_objs,QUICKJS_SOURCES) $(QUICKJS_OBJS): CFLAGS += \ diff --git a/src/main.c b/src/main.c index 83b5b5ea..546300d7 100644 --- a/src/main.c +++ b/src/main.c @@ -12,11 +12,11 @@ #include #include -#include #include #include #include +#include #include #if !defined(_WIN32) && !defined(__MACH__) @@ -139,6 +139,7 @@ void shedPrivileges() static int _tf_command_test(const char* file, int argc, char* argv[]) { +#if !defined(__ANDROID__) typedef struct args_t { const char* tests; bool help; @@ -177,6 +178,7 @@ xopt_help: { free((void*)extras); } +#endif return 1; } diff --git a/src/serialize.c b/src/serialize.c index 2dbc5c1b..65d06860 100644 --- a/src/serialize.c +++ b/src/serialize.c @@ -6,11 +6,10 @@ #include "trace.h" #include "util.js.h" +#include #include #include -#include "quickjs-libc.h" - #include typedef enum _serialize_type_t { diff --git a/src/socket.js.c b/src/socket.js.c index f28c4d01..b4c9557b 100644 --- a/src/socket.js.c +++ b/src/socket.js.c @@ -10,8 +10,6 @@ #include #include -#include "quickjs-libc.h" - typedef int promiseid_t; typedef struct _socket_t socket_t; diff --git a/src/ssb.js.c b/src/ssb.js.c index 79dc0ddd..0f5d8d7d 100644 --- a/src/ssb.js.c +++ b/src/ssb.js.c @@ -21,8 +21,6 @@ #include #include -#include "quickjs-libc.h" - static JSClassID _tf_ssb_classId; void _tf_ssb_on_rpc(tf_ssb_connection_t* connection, uint8_t flags, int32_t request_number, JSValue args, const uint8_t* message, size_t size, void* user_data); diff --git a/src/ssb.tests.c b/src/ssb.tests.c index 8bdd0f87..9a32fc56 100644 --- a/src/ssb.tests.c +++ b/src/ssb.tests.c @@ -14,8 +14,6 @@ #include #include -#include "quickjs-libc.h" - void tf_ssb_test_id_conversion(const tf_test_options_t* options) { tf_printf("Testing id conversion.\n"); @@ -114,11 +112,7 @@ static void _ssb_test_idle(uv_idle_t* idle) { tf_util_report_error(context, result); } - if (r < 0) - { - js_std_dump_error(context); - } - else if (r == 0) + if (r == 0) { break; } diff --git a/src/task.c b/src/task.c index 3cb0c029..8e97ab83 100644 --- a/src/task.c +++ b/src/task.c @@ -27,7 +27,6 @@ #include "unzip.h" #include "quickjs.h" -#include "quickjs-libc.h" #include @@ -1449,14 +1448,7 @@ static bool _tf_task_run_jobs(tf_task_t* task) tf_util_report_error(context, result); JS_FreeValue(context, result); } - if (r < 0) - { - js_std_dump_error(context); - } - else - { - return r != 0; - } + return r != 0; } return 0; } diff --git a/src/taskstub.js.c b/src/taskstub.js.c index f44c6e50..a7379b18 100644 --- a/src/taskstub.js.c +++ b/src/taskstub.js.c @@ -10,8 +10,6 @@ #include #include -#include "quickjs-libc.h" - #ifdef _WIN32 #include #include diff --git a/src/util.js.c b/src/util.js.c index 3c46469d..31f0b414 100644 --- a/src/util.js.c +++ b/src/util.js.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -176,19 +175,13 @@ bool tf_util_report_error(JSContext* context, JSValue value) JS_FreeValue(context, stack); tf_task_t* task = tf_task_get(context); - if (!task || !tf_task_send_error_to_parent(task, value)) - { - js_std_dump_error(context); - } + tf_task_send_error_to_parent(task, value); is_error = true; } else if (JS_IsException(value)) { tf_task_t* task = tf_task_get(context); - if (!task || !tf_task_send_error_to_parent(task, value)) - { - js_std_dump_error(context); - } + tf_task_send_error_to_parent(task, value); is_error = true; } return is_error;