aboutsummaryrefslogtreecommitdiffstats
path: root/code/unix
diff options
context:
space:
mode:
Diffstat (limited to 'code/unix')
-rw-r--r--code/unix/Makefile157
-rw-r--r--code/unix/linux_glimp.c38
-rw-r--r--code/unix/linux_joystick.c4
-rw-r--r--code/unix/linux_snd.c4
-rw-r--r--code/unix/sdl_glimp.c4
-rw-r--r--code/unix/sdl_snd.c4
-rw-r--r--code/unix/unix_glw.h4
-rw-r--r--code/unix/unix_main.c8
-rw-r--r--code/unix/unix_net.c4
-rw-r--r--code/unix/unix_shared.c2
10 files changed, 208 insertions, 21 deletions
diff --git a/code/unix/Makefile b/code/unix/Makefile
index 3eaa504..46abd59 100644
--- a/code/unix/Makefile
+++ b/code/unix/Makefile
@@ -49,6 +49,10 @@ ifndef DXSDK_DIR
DXSDK_DIR=C:/DXSDK
endif
+ifndef USE_SDL
+USE_SDL=true
+endif
+
#############################################################################
BD=debug$(ARCH)$(GLIBC)
@@ -78,12 +82,8 @@ VERSION=$(shell grep Q3_VERSION ../qcommon/q_shared.h | \
#############################################################################
## Defaults
-USE_SDL=true
VM_PPC=
-# bk010215 - TODO - add all defaults / kill Ryan
-
-
LIB=lib
ifeq ($(PLATFORM),linux)
@@ -110,7 +110,7 @@ ifeq ($(PLATFORM),linux)
BASE_CFLAGS = -pipe -Wall -Wimplicit -Wstrict-prototypes
ifeq ($(strip $(USE_SDL)),true)
- BASE_CFLAGS += -DUSE_SDL=1 $(shell sdl-config --cflags)
+ BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
GL_CFLAGS =
else
GL_CFLAGS = -I/usr/X11R6/include
@@ -352,6 +352,117 @@ ifeq ($(PLATFORM),irix)
else # ifeq IRIX
#############################################################################
+# SETUP AND BUILD -- SunOS
+#############################################################################
+
+ifeq ($(PLATFORM),SunOS)
+
+ GLIBC= #libc is irrelevant
+ CC=gcc
+ CXX=g++
+ COPYDIR="/usr/local/share/games/quake3"
+
+ ifneq (,$(findstring i86pc,$(shell uname -m)))
+ ARCH=i386
+ else #default to sparc
+ ARCH=sparc
+ endif
+
+ ifneq ($(ARCH),i386)
+ ifneq ($(ARCH),sparc)
+ $(error arch $(ARCH) is currently not supported)
+ endif
+ endif
+
+
+ BASE_CFLAGS = -pipe -Wall -Wimplicit -Wstrict-prototypes
+
+ ifeq ($(strip $(USE_SDL)),true)
+ BASE_CFLAGS += -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
+ GL_CFLAGS =
+ else
+ GL_CFLAGS = -I/usr/openwin/include
+ endif
+
+ OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer \
+ -fno-strict-aliasing
+ BASE_CFLAGS += -DNO_VM_COMPILED
+
+ ifeq ($(ARCH),sparc)
+ OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -falign-loops=2 \
+ -falign-jumps=2 -falign-functions=2 -fstrength-reduce \
+ -fno-strict-aliasing
+ else
+ ifeq ($(ARCH),i386)
+ OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math \
+ -falign-loops=2 -falign-jumps=2 -falign-functions=2 \
+ -fno-strict-aliasing -fstrength-reduce
+ endif
+ endif
+
+ DEBUG_CFLAGS = $(BASE_CFLAGS) -g -O0
+
+ RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG $(OPTIMIZE)
+
+ SHLIBEXT=so
+ SHLIBCFLAGS=-fPIC
+ SHLIBLDFLAGS=-shared $(LDFLAGS)
+
+ THREAD_LDFLAGS=-lpthread
+ LDFLAGS=-lsocket -lnsl -ldl -lm
+
+ ifeq ($(strip $(USE_SDL)),true)
+ GLLDFLAGS=$(shell sdl-config --libs) -lGLU -lX11 -lXext
+ else
+ GLLDFLAGS=-L/usr/openwin/$(LIB) -lGLU -lX11 -lXext
+ endif
+
+ ifeq ($(ARCH),i386)
+ # linux32 make ...
+ BASE_CFLAGS += -m32
+ LDFLAGS+=-m32
+ endif
+
+ ifeq ($(ARCH),sparc)
+ TARGETS=\
+ $(B)/$(PLATFORM)quake3 \
+ $(B)/$(PLATFORM)q3ded \
+ $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/vm/cgame.qvm \
+ $(B)/baseq3/vm/qagame.qvm \
+ $(B)/baseq3/vm/ui.qvm \
+ $(B)/missionpack/vm/qagame.qvm \
+ $(B)/missionpack/vm/cgame.qvm \
+ $(B)/missionpack/vm/ui.qvm
+# $(B)/$(PLATFORM)quake3-smp
+ else
+ TARGETS=\
+ $(B)/$(PLATFORM)quake3 \
+ $(B)/$(PLATFORM)q3ded \
+ $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
+ $(B)/missionpack/ui$(ARCH).$(SHLIBEXT) \
+ $(B)/baseq3/vm/cgame.qvm \
+ $(B)/baseq3/vm/qagame.qvm \
+ $(B)/baseq3/vm/ui.qvm \
+ $(B)/missionpack/vm/qagame.qvm \
+ $(B)/missionpack/vm/cgame.qvm \
+ $(B)/missionpack/vm/ui.qvm
+# $(B)/$(PLATFORM)quake3-smp
+
+ endif
+
+else # ifeq SunOS
+
+#############################################################################
# SETUP AND BUILD -- GENERIC
#############################################################################
@@ -371,6 +482,7 @@ endif #Linux
endif #mingw32
endif #FreeBSD
endif #IRIX
+endif #SunOS
ifdef DEFAULT_BASEDIR
BASE_CFLAGS += -DDEFAULT_BASEDIR=\\\"$(DEFAULT_BASEDIR)\\\"
@@ -699,8 +811,41 @@ else
Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
endif
-
endif #Linux-axp
+else
+ifeq ($(PLATFORM),SunOS)
+ Q3POBJ=\
+ $(B)/client/unix_main.o \
+ $(B)/client/unix_net.o \
+ $(B)/client/unix_shared.o \
+ $(B)/client/linux_signals.o \
+ $(B)/client/linux_common.o \
+ $(B)/client/linux_qgl.o \
+ $(B)/client/linux_glimp.o \
+ $(B)/client/linux_snd.o \
+ $(B)/client/sdl_snd.o \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o \
+
+ Q3POBJ_SMP=\
+ $(B)/client/unix_main.o \
+ $(B)/client/unix_net.o \
+ $(B)/client/unix_shared.o \
+ $(B)/client/linux_signals.o \
+ $(B)/client/linux_common.o \
+ $(B)/client/linux_qgl.o \
+ $(B)/client/linux_glimp_smp.o \
+ $(B)/client/linux_snd.o \
+ $(B)/client/sdl_snd.o \
+ $(B)/client/snd_mixa.o \
+ $(B)/client/matha.o
+
+ ifeq ($(ARCH),i386)
+ Q3POBJ += $(B)/client/ftola.o $(B)/client/snapvectora.o
+ Q3POBJ_SMP += $(B)/client/ftola.o $(B)/client/snapvectora.o
+ endif
+
+endif #SunOS
endif #Linux
endif #mingw32
endif #IRIX
diff --git a/code/unix/linux_glimp.c b/code/unix/linux_glimp.c
index 792677a..cc9aa91 100644
--- a/code/unix/linux_glimp.c
+++ b/code/unix/linux_glimp.c
@@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**
*/
-#if !USE_SDL
+#if !USE_SDL_VIDEO
#include <termios.h>
#include <sys/ioctl.h>
@@ -68,8 +68,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <X11/keysym.h>
#include <X11/cursorfont.h>
+#if !defined(__sun)
#include <X11/extensions/xf86dga.h>
#include <X11/extensions/xf86vmode.h>
+#endif
+
+#if defined(__sun)
+#include <X11/Sunkeysym.h>
+#endif
+
+#ifdef _XF86DGA_H_
+#define HAVE_XF86DGA
+#endif
#define WINDOW_CLASS_NAME "Quake III: Arena"
@@ -121,14 +131,18 @@ cvar_t *r_allowSoftwareGL; // don't abort out if the pixelformat claims softw
cvar_t *r_previousglDriver;
qboolean vidmode_ext = qfalse;
+#ifdef HAVE_XF86DGA
static int vidmode_MajorVersion = 0, vidmode_MinorVersion = 0; // major and minor of XF86VidExtensions
// gamma value of the X display before we start playing with it
static XF86VidModeGamma vidmode_InitialGamma;
+#endif /* HAVE_XF86DGA */
static int win_x, win_y;
+#ifdef HAVE_XF86DGA
static XF86VidModeModeInfo **vidmodes;
+#endif /* HAVE_XF86DGA */
//static int default_dotclock_vidmode; // bk001204 - unused
static int num_vidmodes;
static qboolean vidmode_active = qfalse;
@@ -398,6 +412,7 @@ static void install_grabs(void)
if (in_dgamouse->value)
{
+#ifdef HAVE_XF86DGA
int MajorVersion, MinorVersion;
if (!XF86DGAQueryVersion(dpy, &MajorVersion, &MinorVersion))
@@ -410,6 +425,7 @@ static void install_grabs(void)
XF86DGADirectVideo(dpy, DefaultScreen(dpy), XF86DGADirectMouse);
XWarpPointer(dpy, None, win, 0, 0, 0, 0, 0, 0);
}
+#endif /* HAVE_XF86DGA */
} else
{
mwx = glConfig.vidWidth / 2;
@@ -431,7 +447,9 @@ static void uninstall_grabs(void)
{
if (com_developer->value)
ri.Printf( PRINT_ALL, "DGA Mouse - Disabling DGA DirectVideo\n" );
+#ifdef HAVE_XF86DGA
XF86DGADirectVideo(dpy, DefaultScreen(dpy), 0);
+#endif /* HAVE_XF86DGA */
}
XChangePointerControl(dpy, qtrue, qtrue, mouse_accel_numerator,
@@ -741,6 +759,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
{
// NOTE TTimo we get the gamma value from cvar, because we can't work with the s_gammatable
// the API wasn't changed to avoid breaking other OSes
+#ifdef HAVE_XF86DGA
float g = Cvar_Get("r_gamma", "1.0", 0)->value;
XF86VidModeGamma gamma;
assert(glConfig.deviceSupportsGamma);
@@ -748,6 +767,7 @@ void GLimp_SetGamma( unsigned char red[256], unsigned char green[256], unsigned
gamma.green = g;
gamma.blue = g;
XF86VidModeSetGamma(dpy, scrnum, &gamma);
+#endif /* HAVE_XF86DGA */
}
/*
@@ -773,12 +793,14 @@ void GLimp_Shutdown( void )
qglXDestroyContext(dpy, ctx);
if (win)
XDestroyWindow(dpy, win);
+#ifdef HAVE_XF86DGA
if (vidmode_active)
XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]);
if (glConfig.deviceSupportsGamma)
{
XF86VidModeSetGamma(dpy, scrnum, &vidmode_InitialGamma);
}
+#endif /* HAVE_XF86DGA */
// NOTE TTimo opening/closing the display should be necessary only once per run
// but it seems QGL_Shutdown gets called in a lot of occasion
// in some cases, this XCloseDisplay is known to raise some X errors
@@ -909,18 +931,23 @@ int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen )
actualHeight = glConfig.vidHeight;
// Get video mode list
+#ifdef HAVE_XF86DGA
if (!XF86VidModeQueryVersion(dpy, &vidmode_MajorVersion, &vidmode_MinorVersion))
{
+#endif /* HAVE_XF86DGA */
vidmode_ext = qfalse;
+#ifdef HAVE_XF86DGA
} else
{
ri.Printf(PRINT_ALL, "Using XFree86-VidModeExtension Version %d.%d\n",
vidmode_MajorVersion, vidmode_MinorVersion);
vidmode_ext = qtrue;
}
+#endif /* HAVE_XF86DGA */
// Check for DGA
dga_MajorVersion = 0, dga_MinorVersion = 0;
+#ifdef HAVE_XF86DGA
if (in_dgamouse->value)
{
if (!XF86DGAQueryVersion(dpy, &dga_MajorVersion, &dga_MinorVersion))
@@ -934,7 +961,9 @@ int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen )
dga_MajorVersion, dga_MinorVersion);
}
}
+#endif /* HAVE_XF86DGA */
+#ifdef HAVE_XF86DGA
if (vidmode_ext)
{
int best_fit, best_dist, dist, x, y;
@@ -988,6 +1017,7 @@ int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen )
ri.Printf(PRINT_ALL, "XFree86-VidModeExtension: Ignored on non-fullscreen/Voodoo\n");
}
}
+#endif /* HAVE_XF86DGA */
if (!r_colorbits->value)
@@ -1286,6 +1316,7 @@ static void GLW_InitGamma(void)
glConfig.deviceSupportsGamma = qfalse;
+#ifdef HAVE_XF86DGA
if (vidmode_ext)
{
if (vidmode_MajorVersion < GAMMA_MINMAJOR ||
@@ -1297,6 +1328,7 @@ static void GLW_InitGamma(void)
ri.Printf( PRINT_ALL, "XF86 Gamma extension initialized\n");
glConfig.deviceSupportsGamma = qtrue;
}
+#endif /* HAVE_XF86DGA */
}
/*
@@ -1768,10 +1800,10 @@ void Sys_SendKeyEvents (void) {
// bk010216 - added stubs for non-Linux UNIXes here
// FIXME - use NO_JOYSTICK or something else generic
-#if defined( __FreeBSD__ ) // rb010123
+#if (defined( __FreeBSD__ ) || defined( __sun)) // rb010123
void IN_StartupJoystick( void ) {}
void IN_JoyMove( void ) {}
#endif
-#endif // !USE_SDL
+#endif // !USE_SDL_VIDEO
diff --git a/code/unix/linux_joystick.c b/code/unix/linux_joystick.c
index 13a866c..1ab114b 100644
--- a/code/unix/linux_joystick.c
+++ b/code/unix/linux_joystick.c
@@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**
*/
-#if !USE_SDL
+#if !USE_SDL_VIDEO
#include <linux/joystick.h>
#include <sys/types.h>
@@ -206,6 +206,6 @@ void IN_JoyMove( void )
old_axes = axes;
}
-#endif // !USE_SDL
+#endif // !USE_SDL_VIDEO
diff --git a/code/unix/linux_snd.c b/code/unix/linux_snd.c
index 284be10..5193769 100644
--- a/code/unix/linux_snd.c
+++ b/code/unix/linux_snd.c
@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
-#if !USE_SDL
+#if !USE_SDL_SOUND
#include <unistd.h>
#include <fcntl.h>
@@ -290,5 +290,5 @@ void SNDDMA_BeginPainting (void)
{
}
-#endif // !USE_SDL
+#endif // !USE_SDL_SOUND
diff --git a/code/unix/sdl_glimp.c b/code/unix/sdl_glimp.c
index cac10ed..dfc6724 100644
--- a/code/unix/sdl_glimp.c
+++ b/code/unix/sdl_glimp.c
@@ -1,5 +1,5 @@
-#if USE_SDL
+#if USE_SDL_VIDEO
/*
* SDL implementation for Quake 3: Arena's GPL source release.
@@ -1406,7 +1406,7 @@ void IN_JoyMove( void )
stick_state.oldaxes = axes;
}
-#endif // USE_SDL
+#endif // USE_SDL_VIDEO
// end of linux_glimp_sdl.c ...
diff --git a/code/unix/sdl_snd.c b/code/unix/sdl_snd.c
index 73ae4d6..3caf85a 100644
--- a/code/unix/sdl_snd.c
+++ b/code/unix/sdl_snd.c
@@ -1,4 +1,4 @@
-#if USE_SDL
+#if USE_SDL_SOUND
/*
* SDL implementation for Quake 3: Arena's GPL source release.
@@ -298,7 +298,7 @@ void SNDDMA_BeginPainting (void)
SDL_LockAudio();
}
-#endif // USE_SDL
+#endif // USE_SDL_SOUND
// end of linux_snd_sdl.c ...
diff --git a/code/unix/unix_glw.h b/code/unix/unix_glw.h
index 2dda4ef..1e88c13 100644
--- a/code/unix/unix_glw.h
+++ b/code/unix/unix_glw.h
@@ -19,8 +19,8 @@ along with Quake III Arena source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
-#if !( defined __linux__ || defined __FreeBSD__ )
-#error You should include this file only on Linux/FreeBSD platforms
+#if !( defined __linux__ || defined __FreeBSD__ || defined __sun)
+#error You should include this file only on Linux/FreeBSD/Solaris platforms
#endif
#ifndef __GLW_LINUX_H__
diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c
index 7d913cc..7ee5620 100644
--- a/code/unix/unix_main.c
+++ b/code/unix/unix_main.c
@@ -47,6 +47,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <fpu_control.h> // bk001213 - force dumps on divide by zero
#endif
+#if defined(__sun)
+ #include <sys/file.h>
+#endif
+
// FIXME TTimo should we gard this? most *nix system should comply?
#include <termios.h>
@@ -391,7 +395,7 @@ void Sys_Init(void)
#else
Cvar_Set( "arch", "freebsd unknown" );
#endif
-#elif defined __sun__
+#elif defined(__sun)
#if defined __i386__
Cvar_Set( "arch", "solaris x86" );
#elif defined __sparc__
@@ -801,6 +805,8 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
snprintf (fname, sizeof(fname), "%shppa.so", name);
#elif defined __sh__
snprintf (fname, sizeof(fname), "%ssh.so", name);
+#elif defined __sparc__
+ snprintf (fname, sizeof(fname), "%ssparc.so", name);
#else
#error Unknown arch
#endif
diff --git a/code/unix/unix_net.c b/code/unix/unix_net.c
index c0fd124..b0bad36 100644
--- a/code/unix/unix_net.c
+++ b/code/unix/unix_net.c
@@ -45,6 +45,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#import <net/if_dl.h> // for 'struct sockaddr_dl'
#endif
+#ifdef __sun
+#include <sys/filio.h>
+#endif
+
static cvar_t *noudp;
netadr_t net_local_adr;
diff --git a/code/unix/unix_shared.c b/code/unix/unix_shared.c
index dca610f..be39955 100644
--- a/code/unix/unix_shared.c
+++ b/code/unix/unix_shared.c
@@ -76,7 +76,7 @@ int Sys_Milliseconds (void)
return curtime;
}
-#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(DEDICATED)
+#if (defined(__linux__) || defined(__FreeBSD__) || defined(__sun)) && !defined(DEDICATED)
/*
================
Sys_XTimeToSysTime