forked from cory/tildefriends
Builds for OpenBSD!
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4620 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
6cdf207dcd
commit
52aa6eed0d
20
Makefile
20
Makefile
@ -27,6 +27,16 @@ CFLAGS += -Dstatic_assert=_Static_assert
|
||||
LDFLAGS += \
|
||||
-lbsd \
|
||||
-lnetwork
|
||||
else ifeq ($(UNAME_S),OpenBSD)
|
||||
BUILD_TYPES := debug release
|
||||
CFLAGS += \
|
||||
-Wno-unknown-warning-option
|
||||
LDFLAGS += \
|
||||
-lexecinfo \
|
||||
-lc++abi
|
||||
HAVE_ANDROID := 0
|
||||
HAVE_LINUX_IOS := 0
|
||||
HAVE_WIN := 0
|
||||
else
|
||||
$(error Unexpected host platform $(UNAME_S).)
|
||||
endif
|
||||
@ -292,6 +302,14 @@ else ifeq ($(UNAME_S),Haiku)
|
||||
deps/libuv/src/unix/no-proctitle.c \
|
||||
deps/libuv/src/unix/posix-hrtime.c \
|
||||
deps/libuv/src/unix/posix-poll.c
|
||||
else ifeq ($(UNAME_S),OpenBSD)
|
||||
UV_SOURCES_unix += \
|
||||
deps/libuv/src/unix/bsd-ifaddrs.c \
|
||||
deps/libuv/src/unix/kqueue.c \
|
||||
deps/libuv/src/unix/no-proctitle.c \
|
||||
deps/libuv/src/unix/openbsd.c \
|
||||
deps/libuv/src/unix/posix-hrtime.c \
|
||||
deps/libuv/src/unix/random-getentropy.c
|
||||
endif
|
||||
UV_SOURCES_android := \
|
||||
deps/libuv/src/unix/random-getentropy.c
|
||||
@ -558,9 +576,11 @@ debug release $(MACOS_TARGETS) $(IOS_TARGETS) $(IOSSIM_TARGETS): LDFLAGS += \
|
||||
-lssl \
|
||||
-lcrypto
|
||||
ifneq ($(UNAME_S),Haiku)
|
||||
ifneq ($(UNAME_S),OpenBSD)
|
||||
debug release $(MACOS_TARGETS) $(IOS_TARGETS) $(IOSSIM_TARGETS): LDFLAGS += \
|
||||
-ldl
|
||||
endif
|
||||
endif
|
||||
$(WINDOWS_TARGETS): LDFLAGS += \
|
||||
-lssl \
|
||||
-lcrypto \
|
||||
|
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);
|
||||
#elif defined(_WIN32)
|
||||
return _msize(ptr);
|
||||
#elif defined(EMSCRIPTEN) || defined(__HAIKU__)
|
||||
#elif defined(EMSCRIPTEN) || defined(__HAIKU__) || defined(__OpenBSD__)
|
||||
return 0;
|
||||
#elif defined(__linux__)
|
||||
return malloc_usable_size(ptr);
|
||||
@ -1754,7 +1754,7 @@ static const JSMallocFunctions def_malloc_funcs = {
|
||||
malloc_size,
|
||||
#elif defined(_WIN32)
|
||||
(size_t (*)(const void *))_msize,
|
||||
#elif defined(EMSCRIPTEN) || defined(__HAIKU__)
|
||||
#elif defined(EMSCRIPTEN) || defined(__HAIKU__) || defined(__OpenBSD__)
|
||||
NULL,
|
||||
#elif defined(__linux__)
|
||||
(size_t (*)(const void *))malloc_usable_size,
|
||||
|
11
src/main.c
11
src/main.c
@ -18,10 +18,13 @@
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||
#include <signal.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
@ -362,7 +365,7 @@ static void _shed_privileges()
|
||||
perror("setrlimit(RLIMIT_NPROC, {0, 0})");
|
||||
exit(-1);
|
||||
}
|
||||
#if !defined(__MACH__)
|
||||
#if !defined(__MACH__) && !defined(__OpenBSD__)
|
||||
if (setrlimit(RLIMIT_LOCKS, &zeroLimit) != 0)
|
||||
{
|
||||
perror("setrlimit(RLIMIT_LOCKS, {0, 0})");
|
||||
@ -484,7 +487,7 @@ static int _tf_command_sandbox(const char* file, int argc, char* argv[])
|
||||
return 2;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||
#if defined(__linux__)
|
||||
prctl(PR_SET_PDEATHSIG, SIGHUP);
|
||||
#endif
|
||||
tf_task_t* task = tf_task_create();
|
||||
@ -607,7 +610,7 @@ static void _startup(int argc, char* argv[])
|
||||
_backtrace_error,
|
||||
NULL);
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__)
|
||||
#if defined(__linux__)
|
||||
prctl(PR_SET_PDEATHSIG, SIGKILL);
|
||||
#endif
|
||||
tf_mem_replace_uv_allocator();
|
||||
|
12
src/mem.c
12
src/mem.c
@ -394,17 +394,29 @@ size_t tf_mem_get_uv_malloc_size()
|
||||
return s_uv_malloc_size;
|
||||
}
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
void* _tf_tls_alloc(size_t size)
|
||||
#else
|
||||
void* _tf_tls_alloc(size_t size, const char* file, int line)
|
||||
#endif
|
||||
{
|
||||
return _tf_alloc(&s_tls_malloc_size, size);
|
||||
}
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
void* _tf_tls_realloc(void* ptr, size_t size)
|
||||
#else
|
||||
void* _tf_tls_realloc(void* ptr, size_t size, const char* file, int line)
|
||||
#endif
|
||||
{
|
||||
return _tf_realloc(&s_tls_malloc_size, ptr, size);
|
||||
}
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
void _tf_tls_free(void* ptr)
|
||||
#else
|
||||
void _tf_tls_free(void* ptr, const char* file, int line)
|
||||
#endif
|
||||
{
|
||||
_tf_free(&s_tls_malloc_size, ptr);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
#if !defined(__APPLE__) && !defined(__OpenBSD__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
|
@ -16,6 +16,10 @@
|
||||
#define WEXITSTATUS(x) (x)
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <TargetConditionals.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user