Skip to content

Commit

Permalink
FreeBSD QuickJS Patch (bellard#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickva committed Feb 12, 2024
1 parent ae6fa8d commit 636c946
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
ifeq ($(shell uname -s),Darwin)
CONFIG_DARWIN=y
endif
ifeq ($(shell uname -s),FreeBSD)
CONFIG_FREEBSD=y
endif
# Windows cross compilation from Linux
#CONFIG_WIN32=y
# use link time optimization (smaller and faster executables but slower build)
Expand Down Expand Up @@ -57,6 +60,12 @@ ifdef CONFIG_DARWIN
CONFIG_CLANG=y
CONFIG_DEFAULT_AR=y
endif
ifdef CONFIG_FREEBSD
# use clang instead of gcc
CONFIG_CLANG=y
CONFIG_DEFAULT_AR=y
CONFIG_LTO=
endif

ifdef CONFIG_WIN32
ifdef CONFIG_M32
Expand Down
2 changes: 2 additions & 0 deletions qjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <malloc/malloc.h>
#elif defined(__linux__)
#include <malloc.h>
#elif defined(__FreeBSD__)
#include <malloc_np.h>
#endif

#include "cutils.h"
Expand Down
9 changes: 8 additions & 1 deletion quickjs-libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,15 @@
#include <sys/ioctl.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;
#endif

#if defined(__APPLE__)
#if !defined(environ)
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
Expand Down

0 comments on commit 636c946

Please sign in to comment.