diff -Naur quake2-r0.16.1/Makefile quake2-r0.16.1.netbsd/Makefile --- quake2-r0.16.1/Makefile 2005-01-02 04:47:10.000000000 +0100 +++ quake2-r0.16.1.netbsd/Makefile 2006-09-08 19:44:07.000000000 +0200 @@ -22,7 +22,7 @@ BUILD_CTFDLL=YES # game$(ARCH).so for ctf BUILD_XATRIX=NO # game$(ARCH).so for xatrix (see README.r for details) BUILD_ROGUE=NO # game$(ARCH).so for rogue (see README.r for details) -BUILD_JOYSTICK=YES # build in joystick support +BUILD_JOYSTICK=NO # build in joystick support BUILD_ARTS=NO # build in support for libaRts sound. BUILD_ALSA=NO # build in support for ALSA (default sound on 2.6) BUILD_DEDICATED=NO # build a dedicated quake2 server @@ -44,6 +44,7 @@ ifneq ($(OSTYPE),Linux) ifneq ($(OSTYPE),FreeBSD) +ifneq ($(OSTYPE),NetBSD) ifeq ($(OSTYPE),SunOS) $(error OS $(OSTYPE) detected, use "Makefile.Solaris" instead.) else @@ -51,6 +52,7 @@ endif endif endif +endif # this nice line comes from the linux kernel makefile @@ -124,6 +126,9 @@ ifeq ($(OSTYPE),FreeBSD) BASE_CFLAGS+= -DHAVE_SIN6_LEN endif +ifeq ($(OSTYPE),NetBSD) +BASE_CFLAGS+= -DHAVE_SIN6_LEN +endif NET_UDP=net_udp6 else NET_UDP=net_udp @@ -153,6 +158,9 @@ ifeq ($(OSTYPE),FreeBSD) LDFLAGS=-lm endif +ifeq ($(OSTYPE),NetBSD) +LDFLAGS=-lm +endif ifeq ($(OSTYPE),Linux) LDFLAGS=-lm -ldl endif @@ -168,8 +176,8 @@ SVGALDFLAGS=-lvga -XCFLAGS=-I/usr/X11R6/include -XLDFLAGS=-L/usr/X11R6/lib$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm +XCFLAGS=-I/usr/X11R6/include -I/usr/pkg/xorg/include +XLDFLAGS=-L/usr/X11R6/lib$(_LIB) -L/usr/pkg/xorg/lib$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm AALDFLAGS=-lm -laa SDLCFLAGS=$(shell sdl-config --cflags) @@ -186,12 +194,13 @@ SDLCFLAGS+=-DJoystick endif -FXGLCFLAGS=-I/usr/X11R6/include +GLCFLAGS=-I/usr/pkg/xorg/include +FXGLCFLAGS=-I/usr/X11R6/include -I/usr/pkg/xorg/include FXGLLDFLAGS=-L/usr/local/glide/lib -L/usr/X11/lib -L/usr/local/lib \ -L/usr/X11R6/lib -lX11 -lXext -lGL -lvga GLXCFLAGS=-I/usr/X11R6/include -DOPENGL -GLXLDFLAGS=-L/usr/X11R6/lib$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm +GLXLDFLAGS=-L/usr/X11R6/lib$(_LIB) -L/usr/pkg/xorg/lib$(_LIB) -lX11 -lXext -lXxf86dga -lXxf86vm SDLGLCFLAGS=$(SDLCFLAGS) -DOPENGL SDLGLLDFLAGS=$(SDLLDFLAGS) diff -Naur quake2-r0.16.1/src/client/cl_main.c quake2-r0.16.1.netbsd/src/client/cl_main.c --- quake2-r0.16.1/src/client/cl_main.c 2002-06-15 19:51:52.000000000 +0200 +++ quake2-r0.16.1.netbsd/src/client/cl_main.c 2006-09-08 19:30:23.000000000 +0200 @@ -1828,7 +1828,7 @@ // all archived variables will now be loaded Con_Init (); -#if defined __linux__ || defined __FreeBSD__ || defined __sgi +#if defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ || defined __sgi S_Init (); VID_Init (); #else diff -Naur quake2-r0.16.1/src/client/snd_mix.c quake2-r0.16.1.netbsd/src/client/snd_mix.c --- quake2-r0.16.1/src/client/snd_mix.c 2003-07-12 03:59:51.000000000 +0200 +++ quake2-r0.16.1.netbsd/src/client/snd_mix.c 2006-09-08 19:25:30.000000000 +0200 @@ -30,7 +30,7 @@ void S_WriteLinearBlastStereo16 (void); -#if !((defined __linux__ || defined __FreeBSD__) && defined __i386__) || defined C_ONLY +#if !((defined __linux__ || defined __FreeBSD__ || defined __NetBSD__) && defined __i386__) || defined C_ONLY #if !id386 void S_WriteLinearBlastStereo16 (void) @@ -362,7 +362,7 @@ } -#if !((defined __linux__ || __FreeBSD__) && defined __i386__) || defined C_ONLY +#if !((defined __linux__ || __FreeBSD__ || __NetBSD__) && defined __i386__) || defined C_ONLY #if !id386 void S_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count, int offset) diff -Naur quake2-r0.16.1/src/ctf/q_shared.c quake2-r0.16.1.netbsd/src/ctf/q_shared.c --- quake2-r0.16.1/src/ctf/q_shared.c 2002-02-09 23:09:22.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/ctf/q_shared.c 2006-09-08 19:33:47.000000000 +0200 @@ -345,7 +345,7 @@ Returns 1, 2, or 1 + 2 ================== */ -#if !id386 || defined __linux__ || defined __FreeBSD__ +#if !id386 || defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p) { float dist1, dist2; diff -Naur quake2-r0.16.1/src/ctf/q_shared.h quake2-r0.16.1.netbsd/src/ctf/q_shared.h --- quake2-r0.16.1/src/ctf/q_shared.h 2002-02-09 23:09:23.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/ctf/q_shared.h 2006-09-08 19:34:05.000000000 +0200 @@ -145,7 +145,7 @@ // microsoft's fabs seems to be ungodly slow... //float Q_fabs (float f); //#define fabs(f) Q_fabs(f) -#if !defined C_ONLY && !defined __linux__ && !defined __FreeBSD__ && !defined __sgi +#if !defined C_ONLY && !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ && !defined __sgi extern long Q_ftol( float f ); #else #define Q_ftol( f ) ( long ) (f) diff -Naur quake2-r0.16.1/src/game/q_shared.c quake2-r0.16.1.netbsd/src/game/q_shared.c --- quake2-r0.16.1/src/game/q_shared.c 2002-08-29 19:54:37.000000000 +0200 +++ quake2-r0.16.1.netbsd/src/game/q_shared.c 2006-09-08 19:28:09.000000000 +0200 @@ -345,7 +345,7 @@ Returns 1, 2, or 1 + 2 ================== */ -#if !id386 || defined __linux__ || defined __FreeBSD__ || defined __sun__ +#if !id386 || defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ || defined __sun__ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p) { float dist1, dist2; diff -Naur quake2-r0.16.1/src/linux/cd_linux.c quake2-r0.16.1.netbsd/src/linux/cd_linux.c --- quake2-r0.16.1/src/linux/cd_linux.c 2004-09-20 02:44:34.000000000 +0200 +++ quake2-r0.16.1.netbsd/src/linux/cd_linux.c 2006-09-08 19:29:11.000000000 +0200 @@ -31,7 +31,7 @@ #include #include -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) #include #else #include @@ -65,7 +65,7 @@ if (cdfile == -1 || !enabled) return; // no cd init'd -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if ( ioctl(cdfile, CDIOCEJECT) == -1 ) Com_DPrintf("ioctl cdioeject failed\n"); #else @@ -80,7 +80,7 @@ if (cdfile == -1 || !enabled) return; // no cd init'd -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if ( ioctl(cdfile, CDIOCCLOSE) == -1 ) Com_DPrintf("ioctl cdiocclose failed\n"); #else @@ -91,7 +91,7 @@ static int CDAudio_GetAudioDiskInfo(void) { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) struct ioc_toc_header tochdr; #endif #ifdef __linux__ @@ -100,7 +100,7 @@ cdValid = false; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if ( ioctl(cdfile, CDIOREADTOCHEADER, &tochdr) == -1 ) { Com_DPrintf("ioctl cdioreadtocheader failed\n"); @@ -113,7 +113,7 @@ return -1; } -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if (tochdr.starting_track < 1) #endif #ifdef __linux__ @@ -125,7 +125,7 @@ } cdValid = true; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) maxTrack = tochdr.ending_track; #endif #ifdef __linux__ @@ -138,7 +138,7 @@ void CDAudio_Play(int track, qboolean looping) { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) struct ioc_read_toc_entry entry; struct cd_toc_entry toc_buffer; struct ioc_play_track ti; @@ -166,7 +166,7 @@ return; } -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) #define CDROM_DATA_TRACK 4 bzero((char *)&toc_buffer, sizeof(toc_buffer)); entry.data_len = sizeof(toc_buffer); @@ -205,7 +205,7 @@ CDAudio_Stop(); } -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) ti.start_track = track; ti.end_track = track; ti.start_index = 1; @@ -218,7 +218,7 @@ ti.cdti_ind1 = 0; #endif -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if ( ioctl(cdfile, CDIOCPLAYTRACKS, &ti) == -1 ) #endif #if defined(__linux__) @@ -229,7 +229,7 @@ return; } -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if ( ioctl(cdfile, CDIOCRESUME) == -1 ) #endif #if defined(__linux__) @@ -250,7 +250,7 @@ int track, i = 0, free_tracks = 0, remap_track; float f; byte* track_bools; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) struct ioc_read_toc_entry entry; struct cd_toc_entry toc_buffer; struct ioc_play_track ti; @@ -272,7 +272,7 @@ for (; i < maxTrack; i++) { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) #define CDROM_DATA_TRACK 4 bzero((char *)&toc_buffer, sizeof(toc_buffer)); entry.data_len = sizeof(toc_buffer); @@ -328,7 +328,7 @@ CDAudio_Stop(); } -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) #define CDROMPLAYTRKIND 0x5304 ti.start_track = remap_track; @@ -370,7 +370,7 @@ if (!playing) return; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if ( ioctl(cdfile, CDIOCSTOP) == -1 ) Com_DPrintf("ioctl cdiocstop failed (%d)\n", errno); #endif @@ -391,7 +391,7 @@ if (!playing) return; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if ( ioctl(cdfile, CDIOCPAUSE) == -1 ) Com_DPrintf("ioctl cdiocpause failed\n"); #endif @@ -416,7 +416,7 @@ if (!wasPlaying) return; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) if ( ioctl(cdfile, CDIOCRESUME) == -1 ) Com_DPrintf("ioctl cdiocresume failed\n"); #endif @@ -547,7 +547,7 @@ void CDAudio_Update(void) { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) struct ioc_read_subchannel subchnl; struct cd_sub_channel_info data; #endif @@ -577,7 +577,7 @@ if (playing && lastchk < time(NULL)) { lastchk = time(NULL) + 2; //two seconds between chks -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) subchnl.address_format = CD_MSF_FORMAT; subchnl.data_format = CD_CURRENT_POSITION; subchnl.data_len = sizeof(data); diff -Naur quake2-r0.16.1/src/linux/gl_glx.c quake2-r0.16.1.netbsd/src/linux/gl_glx.c --- quake2-r0.16.1/src/linux/gl_glx.c 2005-01-27 23:36:31.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/linux/gl_glx.c 2006-09-08 19:30:45.000000000 +0200 @@ -59,7 +59,7 @@ #ifdef Joystick # if defined (__linux__) #include -# elif defined (__FreeBSD__) +# elif defined (__FreeBSD__) || defined (__NetBSD__) #include # endif #include diff -Naur quake2-r0.16.1/src/linux/glw_linux.h quake2-r0.16.1.netbsd/src/linux/glw_linux.h --- quake2-r0.16.1/src/linux/glw_linux.h 2002-06-15 15:51:43.000000000 +0200 +++ quake2-r0.16.1.netbsd/src/linux/glw_linux.h 2006-09-08 19:32:43.000000000 +0200 @@ -19,9 +19,11 @@ */ #ifndef __linux__ #ifndef __FreeBSD__ +#ifndef __NetBSD__ #error You shouldnt be including this file on non-unix platforms #endif #endif +#endif #ifndef __GLW_LINUX_H__ #define __GLW_LINUX_H__ diff -Naur quake2-r0.16.1/src/linux/q_shlinux.c quake2-r0.16.1.netbsd/src/linux/q_shlinux.c --- quake2-r0.16.1/src/linux/q_shlinux.c 2002-02-09 23:09:23.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/linux/q_shlinux.c 2006-09-08 19:36:30.000000000 +0200 @@ -31,7 +31,7 @@ #include "../qcommon/qcommon.h" -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) #include #endif @@ -47,7 +47,7 @@ maxhunksize = maxsize + sizeof(int); curhunksize = 0; -#if (defined __FreeBSD__) +#if defined (__FreeBSD__) || defined(__NetBSD__) membase = mmap(0, maxhunksize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0); #else @@ -80,12 +80,15 @@ { byte *n; -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) size_t old_size = maxhunksize; size_t new_size = curhunksize + sizeof(int); void * unmap_base; size_t unmap_len; +#if defined(__NetBSD__) +# define round_page(a) x86_round_page(a) +#endif new_size = round_page(new_size); old_size = round_page(old_size); if (new_size > old_size) diff -Naur quake2-r0.16.1/src/linux/rw_x11.c quake2-r0.16.1.netbsd/src/linux/rw_x11.c --- quake2-r0.16.1/src/linux/rw_x11.c 2005-01-27 23:36:31.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/linux/rw_x11.c 2006-09-08 19:33:01.000000000 +0200 @@ -60,7 +60,7 @@ #ifdef Joystick # if defined (__linux__) #include -# elif defined (__FreeBSD__) +# elif defined (__FreeBSD__) || defined (__NetBSD__) #include # endif #include diff -Naur quake2-r0.16.1/src/linux/snd_linux.c quake2-r0.16.1.netbsd/src/linux/snd_linux.c --- quake2-r0.16.1/src/linux/snd_linux.c 2002-02-09 23:09:23.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/linux/snd_linux.c 2006-09-08 19:34:52.000000000 +0200 @@ -25,7 +25,7 @@ #include #include #include -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) #include #endif #if defined(__linux__) @@ -36,6 +36,10 @@ #include "../client/client.h" #include "../client/snd_loc.h" +#if defined(__NetBSD__) +# undef ioctl +#endif + int audio_fd = -1; int snd_inited; diff -Naur quake2-r0.16.1/src/qcommon/qcommon.h quake2-r0.16.1.netbsd/src/qcommon/qcommon.h --- quake2-r0.16.1/src/qcommon/qcommon.h 2002-02-17 19:03:19.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/qcommon/qcommon.h 2006-09-08 19:31:33.000000000 +0200 @@ -41,7 +41,7 @@ #define CPUSTRING "AXP" #endif -#elif defined __linux__ || defined __FreeBSD__ +#elif defined __linux__ || defined __FreeBSD__ || defined __NetBSD__ #define BUILDSTRING "Linux" diff -Naur quake2-r0.16.1/src/ref_soft/r_alias.c quake2-r0.16.1.netbsd/src/ref_soft/r_alias.c --- quake2-r0.16.1/src/ref_soft/r_alias.c 2002-02-09 23:09:23.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/ref_soft/r_alias.c 2006-09-08 19:31:50.000000000 +0200 @@ -418,7 +418,7 @@ R_AliasTransformFinalVerts ================ */ -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ void R_AliasTransformFinalVerts( int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv ) { float lightcos; diff -Naur quake2-r0.16.1/src/ref_soft/r_part.c quake2-r0.16.1.netbsd/src/ref_soft/r_part.c --- quake2-r0.16.1/src/ref_soft/r_part.c 2002-02-09 23:09:23.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/ref_soft/r_part.c 2006-09-08 19:32:27.000000000 +0200 @@ -34,7 +34,7 @@ static partparms_t partparms; -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ static unsigned s_prefetch_address; @@ -598,7 +598,7 @@ particle_t *p; int i; -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ extern unsigned long fpu_sp24_cw, fpu_chop_cw; #endif @@ -606,7 +606,7 @@ VectorScale( vup, yscaleshrink, r_pup ); VectorCopy( vpn, r_ppn ); -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ __asm fldcw word ptr [fpu_sp24_cw] #endif @@ -623,7 +623,7 @@ partparms.particle = p; partparms.color = p->color; -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ if ( i < r_newrefdef.num_particles-1 ) s_prefetch_address = ( unsigned int ) ( p + 1 ); else @@ -633,7 +633,7 @@ R_DrawParticle(); } -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ __asm fldcw word ptr [fpu_chop_cw] #endif diff -Naur quake2-r0.16.1/src/ref_soft/r_polyse.c quake2-r0.16.1.netbsd/src/ref_soft/r_polyse.c --- quake2-r0.16.1/src/ref_soft/r_polyse.c 2002-02-09 23:09:23.000000000 +0100 +++ quake2-r0.16.1.netbsd/src/ref_soft/r_polyse.c 2006-09-08 19:33:16.000000000 +0200 @@ -411,7 +411,7 @@ R_PolysetCalcGradients ================ */ -#if id386 && !defined __linux__ && !defined __FreeBSD__ +#if id386 && !defined __linux__ && !defined __FreeBSD__ && !defined __NetBSD__ void R_PolysetCalcGradients( int skinwidth ) { static float xstepdenominv, ystepdenominv, t0, t1;