Skip to content

Commit faacbb5

Browse files
committed
Add FreeBSD 10+ support
1 parent c9561e4 commit faacbb5

File tree

7 files changed

+46
-1
lines changed

7 files changed

+46
-1
lines changed

GNUmakefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ifdef CONFIG
2-
VERSION = 0.98
2+
VERSION = 0.99
33
GIT_LABEL = $(shell git describe --all --long)
44

55
BUNDLE = Factor.app
@@ -140,6 +140,8 @@ default:
140140
help:
141141
@echo "Run '$(MAKE)' with one of the following parameters:"
142142
@echo ""
143+
@echo "freebsd-x86-32"
144+
@echo "freebsd-x86-64"
143145
@echo "linux-x86-32"
144146
@echo "linux-x86-64"
145147
@echo "linux-ppc-32"
@@ -169,6 +171,12 @@ macosx-x86-64:
169171
macosx-x86-fat:
170172
$(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.fat
171173

174+
freebsd-x86-32:
175+
$(MAKE) $(ALL) CONFIG=vm/Config.freebsd.x86.32
176+
177+
freebsd-x86-64:
178+
$(MAKE) $(ALL) CONFIG=vm/Config.freebsd.x86.64
179+
172180
linux-x86-32:
173181
$(MAKE) $(ALL) CONFIG=vm/Config.linux.x86.32
174182

build-support/factor.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ set_gcc() {
9999
[ -z "$CXX" ] && CXX=g++
100100
fi
101101
;;
102+
freebsd)
103+
CC=clang
104+
CXX=clang++
105+
;;
102106
*)
103107
[ -z "$CC" ] && CC=gcc
104108
[ -z "$CXX" ] && CXX=g++
@@ -198,6 +202,7 @@ find_os() {
198202
*CYGWIN_NT*) OS=windows;;
199203
*CYGWIN*) OS=windows;;
200204
MINGW32*) OS=windows;;
205+
FreeBSD) OS=freebsd;;
201206
*darwin*) OS=macosx;;
202207
*Darwin*) OS=macosx;;
203208
*linux*) OS=linux;;

vm/Config.freebsd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include vm/Config.unix
2+
PLAF_DLL_OBJS += vm/os-genunix.o vm/os-linux.o vm/mvm-unix.o
3+
PLAF_MASTER_HEADERS += vm/os-genunix.hpp vm/os-linux.hpp
4+
LIBS = -ldl -lm -lrt -lpthread $(X11_UI_LIBS) -Wl,--export-dynamic
5+
6+
# clang spams warnings if we use -Wl,--no-as-needed with -c
7+
# -Wl,--no-as-needed is a gcc optimization, not required
8+
ifneq ($(CXX),clang++)
9+
SITE_CFLAGS += -Wl,--no-as-needed
10+
endif

vm/Config.freebsd.x86.32

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include vm/Config.freebsd
2+
include vm/Config.x86.32

vm/Config.freebsd.x86.64

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include vm/Config.freebsd
2+
include vm/Config.x86.64

vm/os-freebsd.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <sys/syscall.h>
2+
3+
namespace factor {}

vm/platform.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@
4545
#error "Unsupported Linux flavor"
4646
#endif
4747
#else
48+
#if defined(__freebsd__)
49+
#define FACTOR_OS_STRING "freebsd"
50+
#include "os-freebsd.hpp"
51+
52+
#if defined(FACTOR_X86)
53+
#include "os-freebsd-x86.32.hpp"
54+
#elif defined(FACTOR_ARM)
55+
#include "os-freebsd-arm.hpp"
56+
#elif defined(FACTOR_AMD64)
57+
#include "os-freebsd-x86.64.hpp"
58+
#else
59+
#error "Unsupported FreeBSD flavor"
60+
#endif
61+
#else
62+
4863
#error "Unsupported OS"
4964
#endif
5065
#endif

0 commit comments

Comments
 (0)