mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-22 10:52:09 +00:00
OpenBSD port
This commit is contained in:
parent
22fa99b713
commit
1f9d6084b6
4 changed files with 49 additions and 5 deletions
8
Makefile
8
Makefile
|
@ -140,6 +140,8 @@ ifeq ($(OSTYPE),Linux)
|
|||
INCLUDE := -I/usr/include
|
||||
else ifeq ($(OSTYPE),FreeBSD)
|
||||
INCLUDE := -I/usr/local/include
|
||||
else ifeq ($(OSTYPE),OpenBSD)
|
||||
INCLUDE := -I/usr/local/include
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
@ -149,6 +151,8 @@ ifeq ($(OSTYPE),Linux)
|
|||
LDFLAGS := -L/usr/lib -lm -ldl
|
||||
else ifeq ($(OSTYPE),FreeBSD)
|
||||
LDFLAGS := -L/usr/local/lib -lm
|
||||
else ifeq ($(OSTYPE),OpenBSD)
|
||||
LDFLAGS := -L/usr/local/lib -lm
|
||||
else ifeq ($(OSTYPE),Windows)
|
||||
LDFLAGS := -lws2_32 -lwinmm
|
||||
endif
|
||||
|
@ -271,8 +275,12 @@ release/quake2 : LDFLAGS += -lvorbis -lvorbisfile -logg
|
|||
endif
|
||||
|
||||
ifeq ($(WITH_OPENAL),yes)
|
||||
ifeq ($(OSTYPE), OpenBSD)
|
||||
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so"'
|
||||
else
|
||||
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"'
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(WITH_ZIP),yes)
|
||||
release/quake2 : CFLAGS += -DZIP -DNOUNCRYPT
|
||||
|
|
|
@ -32,10 +32,11 @@
|
|||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../common/header/common.h"
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#include <machine/param.h>
|
||||
#define MAP_ANONYMOUS MAP_ANON
|
||||
#endif
|
||||
|
@ -87,7 +88,9 @@ Hunk_End(void)
|
|||
{
|
||||
byte *n = NULL;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#if defined(__linux__)
|
||||
n = (byte *)mremap(membase, maxhunksize, curhunksize + sizeof(int), 0);
|
||||
#elif defined(__FreeBSD__)
|
||||
size_t old_size = maxhunksize;
|
||||
size_t new_size = curhunksize + sizeof(int);
|
||||
void *unmap_base;
|
||||
|
@ -106,10 +109,37 @@ Hunk_End(void)
|
|||
unmap_len = old_size - new_size;
|
||||
n = munmap(unmap_base, unmap_len) + membase;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#ifndef round_page
|
||||
#define round_page(x) (((size_t)(x) + (page_size - 1)) / page_size) * \
|
||||
page_size
|
||||
#endif
|
||||
|
||||
#if defined(__linux__)
|
||||
n = (byte *)mremap(membase, maxhunksize, curhunksize + sizeof(int), 0);
|
||||
size_t old_size = maxhunksize;
|
||||
size_t new_size = curhunksize + sizeof(int);
|
||||
void *unmap_base;
|
||||
size_t unmap_len;
|
||||
long page_size;
|
||||
|
||||
page_size = sysconf(_SC_PAGESIZE);
|
||||
if (page_size == -1)
|
||||
{
|
||||
Sys_Error("Hunk_End: sysconf _SC_PAGESIZE failed (%d)", errno);
|
||||
}
|
||||
|
||||
new_size = round_page(new_size);
|
||||
old_size = round_page(old_size);
|
||||
|
||||
if (new_size > old_size)
|
||||
{
|
||||
n = 0; /* error */
|
||||
}
|
||||
else if (new_size < old_size)
|
||||
{
|
||||
unmap_base = (caddr_t)(membase + new_size);
|
||||
unmap_len = old_size - new_size;
|
||||
n = munmap(unmap_base, unmap_len) + membase;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (n != membase)
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#define BUILDSTRING "Linux"
|
||||
#elif defined __FreeBSD__
|
||||
#define BUILDSTRING "FreeBSD"
|
||||
#elif defined __OpenBSD__
|
||||
#define BUILDSTRING "OpenBSD"
|
||||
#elif defined _WIN32
|
||||
#define BUILDSTRING "Windows"
|
||||
#else
|
||||
|
@ -65,6 +67,8 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
#define LIBGL "opengl32.dll"
|
||||
#elif defined __OpenBSD__
|
||||
#define LIBGL "libGL.so"
|
||||
#else
|
||||
#define LIBGL "libGL.so.1"
|
||||
#endif
|
||||
|
|
|
@ -86,6 +86,8 @@
|
|||
*/
|
||||
#if defined(__FreeBSD__)
|
||||
#define OS "FreeBSD"
|
||||
#elif defined(__OpenBSD__)
|
||||
#define OS "OpenBSD"
|
||||
#elif defined(__linux__)
|
||||
#define OS "Linux"
|
||||
#elif defined(_WIN32)
|
||||
|
|
Loading…
Reference in a new issue