Builds for Haiku.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4584 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
b695a4ba3b
commit
68f5827dee
43
Makefile
43
Makefile
@ -21,6 +21,12 @@ BUILD_TYPES := debug release
|
|||||||
HAVE_ANDROID = $(if $(shell which $(ANDROID_SDK)/platform-tools/adb),1,0)
|
HAVE_ANDROID = $(if $(shell which $(ANDROID_SDK)/platform-tools/adb),1,0)
|
||||||
HAVE_LINUX_IOS = $(if $(shell which deps/ios_toolchain/target/bin deps/ios_toolchain/target/bin/arm-apple-darwin11-clang),1,0)
|
HAVE_LINUX_IOS = $(if $(shell which deps/ios_toolchain/target/bin deps/ios_toolchain/target/bin/arm-apple-darwin11-clang),1,0)
|
||||||
HAVE_WIN = $(if $(shell which x86_64-w64-mingw32-gcc-win32),1,0)
|
HAVE_WIN = $(if $(shell which x86_64-w64-mingw32-gcc-win32),1,0)
|
||||||
|
else ifeq ($(UNAME_S),Haiku)
|
||||||
|
BUILD_TYPES := debug release
|
||||||
|
CFLAGS += -Dstatic_assert=_Static_assert
|
||||||
|
LDFLAGS += \
|
||||||
|
-lbsd \
|
||||||
|
-lnetwork
|
||||||
else
|
else
|
||||||
$(error Unexpected host platform $(UNAME_S).)
|
$(error Unexpected host platform $(UNAME_S).)
|
||||||
endif
|
endif
|
||||||
@ -190,9 +196,11 @@ $(IOSSIM_TARGETS): CFLAGS += -Ideps/openssl/ios/iossimulator-xcrun/usr/local/inc
|
|||||||
$(IOSSIM_TARGETS): LDFLAGS += -Ldeps/openssl/ios/iossimulator-xcrun/usr/local/lib
|
$(IOSSIM_TARGETS): LDFLAGS += -Ldeps/openssl/ios/iossimulator-xcrun/usr/local/lib
|
||||||
|
|
||||||
ifeq ($(UNAME_M),x86_64)
|
ifeq ($(UNAME_M),x86_64)
|
||||||
|
ifneq ($(UNAME_S),Haiku)
|
||||||
debug: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-common
|
debug: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-common
|
||||||
debug: LDFLAGS += -fsanitize=address -fsanitize=undefined
|
debug: LDFLAGS += -fsanitize=address -fsanitize=undefined
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
get_objs = \
|
get_objs = \
|
||||||
$(foreach build_type,$(BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \
|
$(foreach build_type,$(BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \
|
||||||
@ -257,23 +265,34 @@ UV_SOURCES_unix := \
|
|||||||
deps/libuv/src/unix/fs.c \
|
deps/libuv/src/unix/fs.c \
|
||||||
deps/libuv/src/unix/getaddrinfo.c \
|
deps/libuv/src/unix/getaddrinfo.c \
|
||||||
deps/libuv/src/unix/getnameinfo.c \
|
deps/libuv/src/unix/getnameinfo.c \
|
||||||
deps/libuv/src/unix/linux.c \
|
|
||||||
deps/libuv/src/unix/loop-watcher.c \
|
deps/libuv/src/unix/loop-watcher.c \
|
||||||
deps/libuv/src/unix/loop.c \
|
deps/libuv/src/unix/loop.c \
|
||||||
deps/libuv/src/unix/pipe.c \
|
deps/libuv/src/unix/pipe.c \
|
||||||
deps/libuv/src/unix/poll.c \
|
deps/libuv/src/unix/poll.c \
|
||||||
deps/libuv/src/unix/process.c \
|
deps/libuv/src/unix/process.c \
|
||||||
deps/libuv/src/unix/procfs-exepath.c \
|
|
||||||
deps/libuv/src/unix/proctitle.c \
|
|
||||||
deps/libuv/src/unix/random-devurandom.c \
|
deps/libuv/src/unix/random-devurandom.c \
|
||||||
deps/libuv/src/unix/random-getrandom.c \
|
deps/libuv/src/unix/random-getrandom.c \
|
||||||
deps/libuv/src/unix/random-sysctl-linux.c \
|
|
||||||
deps/libuv/src/unix/signal.c \
|
deps/libuv/src/unix/signal.c \
|
||||||
deps/libuv/src/unix/stream.c \
|
deps/libuv/src/unix/stream.c \
|
||||||
deps/libuv/src/unix/tcp.c \
|
deps/libuv/src/unix/tcp.c \
|
||||||
deps/libuv/src/unix/thread.c \
|
deps/libuv/src/unix/thread.c \
|
||||||
deps/libuv/src/unix/tty.c \
|
deps/libuv/src/unix/tty.c \
|
||||||
deps/libuv/src/unix/udp.c
|
deps/libuv/src/unix/udp.c
|
||||||
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
UV_SOURCES_unix += \
|
||||||
|
deps/libuv/src/unix/linux.c \
|
||||||
|
deps/libuv/src/unix/procfs-exepath.c \
|
||||||
|
deps/libuv/src/unix/proctitle.c \
|
||||||
|
deps/libuv/src/unix/random-sysctl-linux.c
|
||||||
|
else ifeq ($(UNAME_S),Haiku)
|
||||||
|
UV_SOURCES_unix += \
|
||||||
|
deps/libuv/src/unix/bsd-ifaddrs.c \
|
||||||
|
deps/libuv/src/unix/haiku.c \
|
||||||
|
deps/libuv/src/unix/no-fsevents.c \
|
||||||
|
deps/libuv/src/unix/no-proctitle.c \
|
||||||
|
deps/libuv/src/unix/posix-hrtime.c \
|
||||||
|
deps/libuv/src/unix/posix-poll.c
|
||||||
|
endif
|
||||||
UV_SOURCES_android := \
|
UV_SOURCES_android := \
|
||||||
deps/libuv/src/unix/random-getentropy.c
|
deps/libuv/src/unix/random-getentropy.c
|
||||||
UV_SOURCES_win := \
|
UV_SOURCES_win := \
|
||||||
@ -338,8 +357,15 @@ $(UV_OBJS): CFLAGS += \
|
|||||||
-Wno-sign-compare \
|
-Wno-sign-compare \
|
||||||
-Wno-unused-but-set-variable \
|
-Wno-unused-but-set-variable \
|
||||||
-Wno-unused-result \
|
-Wno-unused-result \
|
||||||
-Wno-unused-variable \
|
-Wno-unused-variable
|
||||||
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
$(UV_OBJS): CFLAGS += \
|
||||||
-D_GNU_SOURCE
|
-D_GNU_SOURCE
|
||||||
|
else ifeq ($(UNAME_S),Haiku)
|
||||||
|
$(UV_OBJS): CFLAGS += \
|
||||||
|
-D_BSD_SOURCE \
|
||||||
|
-Wno-format-truncation
|
||||||
|
endif
|
||||||
|
|
||||||
SODIUM_SOURCES := \
|
SODIUM_SOURCES := \
|
||||||
deps/libsodium/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.c \
|
deps/libsodium/src/libsodium/crypto_aead/aegis128l/aead_aegis128l.c \
|
||||||
@ -528,9 +554,12 @@ LDFLAGS += \
|
|||||||
-pthread \
|
-pthread \
|
||||||
-lm
|
-lm
|
||||||
debug release $(MACOS_TARGETS) $(IOS_TARGETS) $(IOSSIM_TARGETS): LDFLAGS += \
|
debug release $(MACOS_TARGETS) $(IOS_TARGETS) $(IOSSIM_TARGETS): LDFLAGS += \
|
||||||
-ldl \
|
|
||||||
-lssl \
|
-lssl \
|
||||||
-lcrypto
|
-lcrypto
|
||||||
|
ifneq ($(UNAME_S),Haiku)
|
||||||
|
debug release $(MACOS_TARGETS) $(IOS_TARGETS) $(IOSSIM_TARGETS): LDFLAGS += \
|
||||||
|
-ldl
|
||||||
|
endif
|
||||||
$(WINDOWS_TARGETS): LDFLAGS += \
|
$(WINDOWS_TARGETS): LDFLAGS += \
|
||||||
-lssl \
|
-lssl \
|
||||||
-lcrypto \
|
-lcrypto \
|
||||||
@ -605,7 +634,7 @@ $(foreach build_type,$(BUILD_TYPES),$(eval $(call build_rules,$(build_type))))
|
|||||||
|
|
||||||
src/version.h : $(firstword $(MAKEFILE_LIST))
|
src/version.h : $(firstword $(MAKEFILE_LIST))
|
||||||
@echo [version] $@
|
@echo [version] $@
|
||||||
@echo "#define VERSION_NUMBER \"$(VERSION_NUMBER)\"\n#define VERSION_NAME \"$(VERSION_NAME)\"\n" > $@
|
@echo -e "#define VERSION_NUMBER \"$(VERSION_NUMBER)\"\n#define VERSION_NAME \"$(VERSION_NAME)\"\n" > $@
|
||||||
|
|
||||||
src/android/AndroidManifest.xml : $(firstword $(MAKEFILE_LIST))
|
src/android/AndroidManifest.xml : $(firstword $(MAKEFILE_LIST))
|
||||||
@echo [android_version] $@
|
@echo [android_version] $@
|
||||||
|
4
deps/quickjs/quickjs.c
vendored
4
deps/quickjs/quickjs.c
vendored
@ -1680,7 +1680,7 @@ static inline size_t js_def_malloc_usable_size(void *ptr)
|
|||||||
return malloc_size(ptr);
|
return malloc_size(ptr);
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
return _msize(ptr);
|
return _msize(ptr);
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN) || defined(__HAIKU__)
|
||||||
return 0;
|
return 0;
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
return malloc_usable_size(ptr);
|
return malloc_usable_size(ptr);
|
||||||
@ -1754,7 +1754,7 @@ static const JSMallocFunctions def_malloc_funcs = {
|
|||||||
malloc_size,
|
malloc_size,
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
(size_t (*)(const void *))_msize,
|
(size_t (*)(const void *))_msize,
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN) || defined(__HAIKU__)
|
||||||
NULL,
|
NULL,
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
(size_t (*)(const void *))malloc_usable_size,
|
(size_t (*)(const void *))malloc_usable_size,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
@ -331,7 +331,7 @@ static void _tf_run_task_thread(void* data)
|
|||||||
#if !TARGET_OS_IPHONE
|
#if !TARGET_OS_IPHONE
|
||||||
static void _shed_privileges()
|
static void _shed_privileges()
|
||||||
{
|
{
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32) && !defined(__HAIKU__)
|
||||||
struct rlimit zeroLimit;
|
struct rlimit zeroLimit;
|
||||||
zeroLimit.rlim_cur = 0;
|
zeroLimit.rlim_cur = 0;
|
||||||
zeroLimit.rlim_max = 0;
|
zeroLimit.rlim_max = 0;
|
||||||
@ -484,7 +484,7 @@ static int _tf_command_sandbox(const char* file, int argc, char* argv[])
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||||
prctl(PR_SET_PDEATHSIG, SIGHUP);
|
prctl(PR_SET_PDEATHSIG, SIGHUP);
|
||||||
#endif
|
#endif
|
||||||
tf_task_t* task = tf_task_create();
|
tf_task_t* task = tf_task_create();
|
||||||
@ -607,7 +607,7 @@ static void _startup(int argc, char* argv[])
|
|||||||
_backtrace_error,
|
_backtrace_error,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||||
prctl(PR_SET_PDEATHSIG, SIGKILL);
|
prctl(PR_SET_PDEATHSIG, SIGKILL);
|
||||||
#endif
|
#endif
|
||||||
tf_mem_replace_uv_allocator();
|
tf_mem_replace_uv_allocator();
|
||||||
|
@ -436,6 +436,10 @@ void tf_free(void* ptr)
|
|||||||
|
|
||||||
char* tf_strdup(const char* string)
|
char* tf_strdup(const char* string)
|
||||||
{
|
{
|
||||||
|
if (!string)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
size_t len = strlen(string);
|
size_t len = strlen(string);
|
||||||
char* buffer = tf_malloc(len + 1);
|
char* buffer = tf_malloc(len + 1);
|
||||||
if ( buffer)
|
if ( buffer)
|
||||||
|
@ -282,7 +282,7 @@ static char* _tf_ssb_import_read_current_file_from_zip(unzFile zip, size_t* size
|
|||||||
|
|
||||||
static void _tf_ssb_import_recursive_add_files_from_zip(tf_ssb_t* ssb, unzFile zip, JSContext* context, JSValue files, const char* root)
|
static void _tf_ssb_import_recursive_add_files_from_zip(tf_ssb_t* ssb, unzFile zip, JSContext* context, JSValue files, const char* root)
|
||||||
{
|
{
|
||||||
if (unzGoToFirstFile(zip) == UNZ_OK)
|
if (root && unzGoToFirstFile(zip) == UNZ_OK)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -355,7 +355,7 @@ static void _tf_ssb_import_app_json_from_zip(tf_ssb_t* ssb, unzFile zip, JSConte
|
|||||||
void tf_ssb_import_from_zip(tf_ssb_t* ssb, const char* zip_path, const char* user, const char* path)
|
void tf_ssb_import_from_zip(tf_ssb_t* ssb, const char* zip_path, const char* user, const char* path)
|
||||||
{
|
{
|
||||||
unzFile zip = unzOpen(zip_path);
|
unzFile zip = unzOpen(zip_path);
|
||||||
if (zip)
|
if (zip && path)
|
||||||
{
|
{
|
||||||
tf_printf("Importing from %s.\n", zip_path);
|
tf_printf("Importing from %s.\n", zip_path);
|
||||||
if (unzGoToFirstFile(zip) == UNZ_OK)
|
if (unzGoToFirstFile(zip) == UNZ_OK)
|
||||||
|
@ -685,6 +685,8 @@ void tf_ssb_test_bench(const tf_test_options_t* options)
|
|||||||
uv_run(&loop, UV_RUN_DEFAULT);
|
uv_run(&loop, UV_RUN_DEFAULT);
|
||||||
|
|
||||||
char* trace_data = tf_trace_export(trace);
|
char* trace_data = tf_trace_export(trace);
|
||||||
|
if (trace_data)
|
||||||
|
{
|
||||||
FILE* file = fopen("out/trace.json", "wb");
|
FILE* file = fopen("out/trace.json", "wb");
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
@ -692,6 +694,7 @@ void tf_ssb_test_bench(const tf_test_options_t* options)
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
tf_free(trace_data);
|
tf_free(trace_data);
|
||||||
|
}
|
||||||
|
|
||||||
tf_ssb_destroy(ssb1);
|
tf_ssb_destroy(ssb1);
|
||||||
tf_ssb_destroy(ssb0);
|
tf_ssb_destroy(ssb0);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#include <unwind.h>
|
#include <unwind.h>
|
||||||
#elif !defined(_WIN32)
|
#elif !defined(_WIN32) && !defined(__HAIKU__)
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -497,9 +497,9 @@ static int _tf_util_backtrace_callback(void* data, uintptr_t pc, const char* fil
|
|||||||
static void _tf_util_backtrace_error(void* data, const char* message, int error)
|
static void _tf_util_backtrace_error(void* data, const char* message, int error)
|
||||||
{
|
{
|
||||||
char** stack = data;
|
char** stack = data;
|
||||||
int length = strlen(message);
|
|
||||||
if (message)
|
if (message)
|
||||||
{
|
{
|
||||||
|
int length = strlen(message);
|
||||||
int current = *stack ? strlen(*stack) : 0;
|
int current = *stack ? strlen(*stack) : 0;
|
||||||
*stack = tf_resize_vec(*stack, current + length + 1);
|
*stack = tf_resize_vec(*stack, current + length + 1);
|
||||||
memcpy(*stack + current, message, length + 1);
|
memcpy(*stack + current, message, length + 1);
|
||||||
@ -587,6 +587,8 @@ int tf_util_backtrace(void** buffer, int count)
|
|||||||
android_backtrace_t state = { .current = buffer, .end = buffer + count };
|
android_backtrace_t state = { .current = buffer, .end = buffer + count };
|
||||||
_Unwind_Backtrace(_android_unwind_callback, &state);
|
_Unwind_Backtrace(_android_unwind_callback, &state);
|
||||||
return state.current - buffer;
|
return state.current - buffer;
|
||||||
|
#elif defined(__HAIKU__)
|
||||||
|
return 0;
|
||||||
#else
|
#else
|
||||||
return backtrace(buffer, count);
|
return backtrace(buffer, count);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user