Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetBSD client build support. #468

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -843,19 +843,53 @@ else # ifeq openbsd

ifeq ($(PLATFORM),netbsd)

LIBS=-lm
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-pipe -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON

CLIENT_CFLAGS += $(SDL_CFLAGS)

OPTIMIZEVM = -O3
OPTIMIZE = $(OPTIMIZEVM) -ffast-math

ifeq ($(ARCH),x86_64)
OPTIMIZEVM = -O3
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED = true
else
ifeq ($(ARCH),x86)
OPTIMIZEVM = -O3 -march=i586
OPTIMIZE = $(OPTIMIZEVM) -ffast-math
HAVE_VM_COMPILED=true
endif
endif

ifeq ($(USE_CURL),1)
CLIENT_CFLAGS += $(CURL_CFLAGS)
USE_CURL_DLOPEN=0
endif

SHLIBEXT=so
SHLIBCFLAGS=-fPIC
SHLIBLDFLAGS=-shared $(LDFLAGS)
THREAD_LIBS=-lpthread
LIBS=-lm

BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
CLIENT_LIBS =

ifeq ($(ARCH),x86)
HAVE_VM_COMPILED=true
CLIENT_LIBS += $(SDL_LIBS)
RENDERER_LIBS = $(SDL_LIBS)

ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
CLIENT_LIBS += $(THREAD_LIBS) $(OPENAL_LIBS)
endif
endif

BUILD_CLIENT = 0
ifeq ($(USE_CURL),1)
ifneq ($(USE_CURL_DLOPEN),1)
CLIENT_LIBS += $(CURL_LIBS)
endif
endif
else # ifeq netbsd

#############################################################################
Expand Down
6 changes: 5 additions & 1 deletion code/qcommon/vm_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,11 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
// copy to an exact sized buffer with the appropriate permission bits
vm->codeLength = compiledOfs;
#ifdef VM_X86_MMAP
vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
int prot_flags = PROT_WRITE;
#ifdef __NetBSD__
prot_flags |= PROT_MPROTECT(PROT_READ|PROT_EXEC);
#endif
vm->codeBase = mmap(NULL, compiledOfs, prot_flags, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
if(vm->codeBase == MAP_FAILED)
Com_Error(ERR_FATAL, "VM_CompileX86: can't mmap memory");
#elif _WIN32
Expand Down