Index: Makefile =================================================================== RCS file: /cvs/cvsroot/quake2/Makefile,v retrieving revision 1.56 diff -u -p -r1.56 Makefile --- Makefile 5 May 2005 22:23:34 -0000 1.56 +++ Makefile 29 Aug 2005 22:52:28 -0000 @@ -74,35 +74,46 @@ endif CC=gcc +ifndef OPT_CFLAGS ifeq ($(ARCH),axp) -RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \ +OPT_CFLAGS=-ffast-math -funroll-loops \ -fomit-frame-pointer -fexpensive-optimizations endif ifeq ($(ARCH),ppc) -RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \ +OPT_CFLAGS=-O2 -ffast-math -funroll-loops \ -fomit-frame-pointer -fexpensive-optimizations endif ifeq ($(ARCH),sparc) -RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \ +OPT_CFLAGS=-ffast-math -funroll-loops \ -fomit-frame-pointer -fexpensive-optimizations endif ifeq ($(ARCH),i386) -RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -falign-loops=2 \ +OPT_CFLAGS=-O2 -ffast-math -funroll-loops -falign-loops=2 \ -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing # compiler bugs with gcc 2.96 and 3.0.1 can cause bad builds with heavy opts. -#RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -m486 -ffast-math -funroll-loops \ +#OPT_CFLAGS=-O6 -m486 -ffast-math -funroll-loops \ # -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \ # -malign-jumps=2 -malign-functions=2 endif ifeq ($(ARCH),x86_64) _LIB := 64 -RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \ +OPT_CFLAGS=-O2 -ffast-math -funroll-loops \ -fomit-frame-pointer -fexpensive-optimizations -fno-strict-aliasing endif +endif +RELEASE_CFLAGS=$(BASE_CFLAGS) $(OPT_CFLAGS) + +ifeq ($(ADDCFLAGS),debug) +CFLAGS=$(DEBUG_CFLAGS) -DLINUX_VERSION=\"$(VERSION) Debug\" +endif + +ifeq ($(ADDCFLAGS),release) +CFLAGS=$(RELEASE_CFLAGS) -DLINUX_VERSION=\"$(VERSION)\" +endif VERSION=3.21+r0.16 @@ -133,6 +136,13 @@ else NET_UDP=net_udp endif +ifdef DEFAULT_BASEDIR +BASE_CFLAGS += -DDEFAULT_BASEDIR=\"$(DEFAULT_BASEDIR)\" +endif +ifdef DEFAULT_LIBDIR +BASE_CFLAGS += -DDEFAULT_LIBDIR=\"$(DEFAULT_LIBDIR)\" +endif + ifeq ($(strip $(BUILD_QMAX)),YES) BASE_CFLAGS+=-DQMAX endif @@ -406,7 +424,7 @@ $(BUILD_DEBUG_DIR)/ctf \ $(BUILD_DEBUG_DIR)/xatrix \ $(BUILD_DEBUG_DIR)/rogue - $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS) -DLINUX_VERSION='\"$(VERSION) Debug\"'" + $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) ADDCFLAGS=debug build_release: @-mkdir -p $(BUILD_RELEASE_DIR) \ @@ -418,7 +436,7 @@ $(BUILD_RELEASE_DIR)/ctf \ $(BUILD_RELEASE_DIR)/xatrix \ $(BUILD_RELEASE_DIR)/rogue - $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS) -DLINUX_VERSION='\"$(VERSION)\"'" + $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) ADDCFLAGS=release targets: $(TARGETS) Index: src/linux/qgl_linux.c =================================================================== RCS file: /cvs/cvsroot/quake2/src/linux/qgl_linux.c,v retrieving revision 1.9 diff -u -p -r1.9 qgl_linux.c --- src/linux/qgl_linux.c 25 Sep 2002 13:39:58 -0000 1.9 +++ src/linux/qgl_linux.c 29 Aug 2005 22:52:28 -0000 @@ -3006,13 +3006,17 @@ qboolean QGL_Init( const char *dllname ) // dllname, dlerror()); // try basedir next - path = ri.Cvar_Get ("basedir", ".", CVAR_NOSET)->string; + path = ri.Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string; snprintf (fn, MAX_OSPATH, "%s/%s", path, dllname ); if ( ( glw_state.OpenGLLib = dlopen( fn, RTLD_LAZY ) ) == 0 ) { - ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() ); - return false; + path = ri.Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string; + snprintf (fn, MAX_OSPATH, "%s/%s", path, dllname ); + if ( ( glw_state.OpenGLLib = dlopen( fn, RTLD_LAZY ) ) == 0 ) { + ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() ); + return false; + } } Com_Printf ("Using %s for OpenGL...", fn); } else { Index: src/linux/vid_so.c =================================================================== RCS file: /cvs/cvsroot/quake2/src/linux/vid_so.c,v retrieving revision 1.10 diff -u -p -r1.10 vid_so.c --- src/linux/vid_so.c 24 Sep 2004 22:11:44 -0000 1.10 +++ src/linux/vid_so.c 29 Aug 2005 22:52:28 -0000 @@ -237,13 +237,17 @@ qboolean VID_LoadRefresh( char *name ) //regain root seteuid(saved_euid); - path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string; + path = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string; snprintf (fn, MAX_OSPATH, "%s/%s", path, name ); if (stat(fn, &st) == -1) { - Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, strerror(errno)); - return false; + path = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string; + snprintf (fn, MAX_OSPATH, "%s/%s", path, name ); + if (stat(fn, &st) == -1) { + Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, strerror(errno)); + return false; + } } // permission checking @@ -493,13 +497,19 @@ qboolean VID_CheckRefExists (const char char *path; struct stat st; - path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string; + path = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string; snprintf (fn, MAX_OSPATH, "%s/ref_%s.so", path, ref ); if (stat(fn, &st) == 0) return true; - else - return false; + else { + path = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string; + snprintf (fn, MAX_OSPATH, "%s/ref_%s.so", path, ref ); + if (stat(fn, &st) == 0) + return true; + else + return false; + } } /*****************************************************************************/ Index: src/qcommon/files.c =================================================================== RCS file: /cvs/cvsroot/quake2/src/qcommon/files.c,v retrieving revision 1.11 diff -u -p -r1.11 files.c --- src/qcommon/files.c 2 Jan 2005 03:38:12 -0000 1.11 +++ src/qcommon/files.c 29 Aug 2005 22:52:29 -0000 @@ -60,6 +60,7 @@ typedef struct pack_s char fs_gamedir[MAX_OSPATH]; cvar_t *fs_basedir; +cvar_t *fs_libdir; cvar_t *fs_cddir; cvar_t *fs_gamedirvar; @@ -681,6 +682,7 @@ void FS_SetGamedir (char *dir) if (fs_cddir->string[0]) FS_AddGameDirectory (va("%s/%s", fs_cddir->string, dir) ); FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) ); + FS_AddGameDirectory (va("%s/%s", fs_libdir->string, dir) ); FS_AddHomeAsGameDirectory(dir); } } @@ -898,7 +900,13 @@ void FS_InitFilesystem (void) // basedir // allows the game to run from outside the data tree // - fs_basedir = Cvar_Get ("basedir", ".", CVAR_NOSET); + fs_basedir = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET); + + // + // libdir + // allows the game to store binary files (not data) in a sep tree + // + fs_libdir = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET); // // cddir @@ -913,6 +921,7 @@ void FS_InitFilesystem (void) // add baseq2 to search path // FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) ); + FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_libdir->string) ); // // then add a '.quake2/baseq2' directory in home directory by default Index: src/qcommon/qcommon.h =================================================================== RCS file: /cvs/cvsroot/quake2/src/qcommon/qcommon.h,v retrieving revision 1.5 diff -u -p -r1.5 qcommon.h --- src/qcommon/qcommon.h 12 Apr 2005 13:12:21 -0000 1.5 +++ src/qcommon/qcommon.h 29 Aug 2005 22:52:29 -0000 @@ -74,6 +74,13 @@ Foundation, Inc., 59 Temple Place - Suit #endif +#ifndef DEFAULT_BASEDIR +# define DEFAULT_BASEDIR "." +#endif +#ifndef DEFAULT_LIBDIR +# define DEFAULT_LIBDIR DEFAULT_BASEDIR +#endif + //============================================================================ typedef struct sizebuf_s