Whoa. Apps are running on android. Switched to a static build of OpenSSL 1.1.1t for simplicity.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4211 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-03-10 02:02:24 +00:00
parent d532795b7f
commit 400f07660f
7649 changed files with 9904 additions and 2321 deletions

View File

@ -1,5 +1,6 @@
#include "taskstub.js.h"
#include "log.h"
#include "mem.h"
#include "packetstream.h"
#include "serialize.h"
@ -44,6 +45,11 @@ void tf_taskstub_startup()
JS_NewClassID(&_classId);
size_t size = sizeof(_executable);
uv_exepath(_executable, &size);
#if defined(__ANDROID__)
/* We have already changed into our files directory. */
snprintf(_executable, sizeof(_executable), "./tildefriends");
#endif
tf_printf("exepath is %s\n", _executable);
initialized = true;
}
}
@ -129,7 +135,7 @@ static JSValue _taskstub_create(JSContext* context, JSValueConst this_val, int a
memset(pipe, 0, sizeof(*pipe));
if (uv_pipe_init(tf_task_get_loop(parent), pipe, 1) != 0)
{
fprintf(stderr, "uv_pipe_init failed\n");
tf_printf("uv_pipe_init failed\n");
}
uv_stdio_container_t io[3];
@ -158,7 +164,7 @@ static JSValue _taskstub_create(JSContext* context, JSValueConst this_val, int a
}
else
{
fprintf(stderr, "uv_spawn failed: %s\n", uv_strerror(spawn_result));
tf_printf("uv_spawn failed: %s\n", uv_strerror(spawn_result));
JS_FreeValue(context, taskObject);
}
return result;
@ -177,14 +183,15 @@ void _taskstub_gc_mark(JSRuntime* rt, JSValueConst value, JS_MarkFunc mark_func)
JSValue tf_taskstub_register(JSContext* context)
{
JSClassDef def = {
JSClassDef def =
{
.class_name = "TaskStub",
.finalizer = &_taskstub_finalizer,
.gc_mark = _taskstub_gc_mark,
};
if (JS_NewClass(JS_GetRuntime(context), _classId, &def) != 0)
{
fprintf(stderr, "Failed to register TaskStub class.\n");
tf_printf("Failed to register TaskStub class.\n");
}
return JS_NewCFunction2(context, _taskstub_create, "TaskStub", 0, JS_CFUNC_constructor, 0);
}
@ -226,12 +233,12 @@ tf_taskstub_t* tf_taskstub_create_parent(tf_task_t* task, uv_file file)
if (uv_pipe_init(tf_task_get_loop(task), tf_packetstream_get_pipe(parentStub->_stream), 1) != 0)
{
fprintf(stderr, "uv_pipe_init failed\n");
tf_printf("uv_pipe_init failed\n");
}
tf_packetstream_set_on_receive(parentStub->_stream, tf_task_on_receive_packet, parentStub);
if (uv_pipe_open(tf_packetstream_get_pipe(parentStub->_stream), file) != 0)
{
fprintf(stderr, "uv_pipe_open failed\n");
tf_printf("uv_pipe_open failed\n");
}
tf_packetstream_start(parentStub->_stream);
@ -285,6 +292,7 @@ static void _taskstub_on_handle_close(uv_handle_t* handle)
static void _taskstub_on_process_exit(uv_process_t* process, int64_t status, int terminationSignal)
{
tf_printf("_taskstub_on_process_exit %d %d\n", (int)status, terminationSignal);
tf_taskstub_t* stub = process->data;
JSContext* context = tf_task_get_context(stub->_owner);
if (!JS_IsUndefined(stub->_on_exit))