FreeBSD QuickJS Patch (#203)

This commit is contained in:
Nick Vatamaniuc 2024-02-12 05:28:00 -05:00 committed by GitHub
parent ae6fa8d3d2
commit 636c946531
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 1 deletions

View file

@ -25,6 +25,9 @@
ifeq ($(shell uname -s),Darwin) ifeq ($(shell uname -s),Darwin)
CONFIG_DARWIN=y CONFIG_DARWIN=y
endif endif
ifeq ($(shell uname -s),FreeBSD)
CONFIG_FREEBSD=y
endif
# Windows cross compilation from Linux # Windows cross compilation from Linux
#CONFIG_WIN32=y #CONFIG_WIN32=y
# use link time optimization (smaller and faster executables but slower build) # use link time optimization (smaller and faster executables but slower build)
@ -57,6 +60,12 @@ ifdef CONFIG_DARWIN
CONFIG_CLANG=y CONFIG_CLANG=y
CONFIG_DEFAULT_AR=y CONFIG_DEFAULT_AR=y
endif endif
ifdef CONFIG_FREEBSD
# use clang instead of gcc
CONFIG_CLANG=y
CONFIG_DEFAULT_AR=y
CONFIG_LTO=
endif
ifdef CONFIG_WIN32 ifdef CONFIG_WIN32
ifdef CONFIG_M32 ifdef CONFIG_M32

2
qjs.c
View file

@ -36,6 +36,8 @@
#include <malloc/malloc.h> #include <malloc/malloc.h>
#elif defined(__linux__) #elif defined(__linux__)
#include <malloc.h> #include <malloc.h>
#elif defined(__FreeBSD__)
#include <malloc_np.h>
#endif #endif
#include "cutils.h" #include "cutils.h"

View file

@ -47,8 +47,15 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/wait.h> #include <sys/wait.h>
#if defined(__APPLE__) #if defined(__FreeBSD__)
extern char **environ;
#endif
#if defined(__APPLE__) || defined(__FreeBSD__)
typedef sig_t sighandler_t; typedef sig_t sighandler_t;
#endif
#if defined(__APPLE__)
#if !defined(environ) #if !defined(environ)
#include <crt_externs.h> #include <crt_externs.h>
#define environ (*_NSGetEnviron()) #define environ (*_NSGetEnviron())