From 85da162f4937db0dabf6c1f3ad4b5ed86d39465f Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 29 Apr 2017 02:45:21 +0000 Subject: [PATCH] Try to fix up some linux / build script stuff. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5095 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- build_setup.sh | 18 ++-- engine/Makefile | 55 ++++++---- engine/client/m_download.c | 2 +- engine/client/sys_linux.c | 190 ++++++++++++++++++++++++--------- engine/common/common.c | 42 +++++--- engine/common/fs.c | 17 ++- engine/common/net_ssl_gnutls.c | 14 +-- engine/qclib/pr_edict.c | 4 +- iqm/Makefile | 3 + 9 files changed, 235 insertions(+), 110 deletions(-) diff --git a/build_setup.sh b/build_setup.sh index b598001b3..fa55cf5bf 100755 --- a/build_setup.sh +++ b/build_setup.sh @@ -23,11 +23,11 @@ NACLSDKVERSION=pepper_49 #android defaults ANDROIDROOT=$FTEROOT/android -ifneq ($(shell uname -o 2>&1 | grep Cygwin),) - ANDROID_HOSTSYSTEM?=windows-x86_64 +if [ ! -z "$(uname -o 2>&1 | grep Cygwin)" ]; then + ANDROID_HOSTSYSTEM=windows-x86_64 else - ANDROID_HOSTSYSTEM?=linux-$(shell uname -m) -endif + ANDROID_HOSTSYSTEM=linux-$(uname -m) +fi ANDROIDBUILDTOOLS=25.0.0 ANDROID_ZIPALIGN=$ANDROIDROOT/build-tools/$ANDROIDBUILDTOOLS/zipalign #relative to ndk tools @@ -233,7 +233,7 @@ debianpackages subversion make automake libtool p7zip-full zip || otherpackages if [ "$BUILD_LINUXx86" == "y" ]; then #for building linux targets debianpackages gcc-multilib g++-multilib mesa-common-dev libasound2-dev libvorbis-dev || otherpackages gcc || exit - jessiepackages libgnutls28-dev || debianpackages libgnutls-dev || otherpackages gcc || exit + jessiepackages libgnutls28-dev || debianpackages libgnutls28-dev || otherpackages gcc || exit if [[ "$PLUGINS_LINUXx86" =~ "avplug" ]]; then debianpackages libswscale-dev libavcodec-dev || otherpackages || exit fi @@ -241,7 +241,7 @@ fi if [ "$BUILD_LINUXx64" == "y" ]; then #for building linux targets debianpackages gcc-multilib g++-multilib mesa-common-dev libasound2-dev || otherpackages gcc || exit - jessiepackages libgnutls28-dev || debianpackages libgnutls-dev || otherpackages gcc || exit + jessiepackages libgnutls28-dev || debianpackages libgnutls28-dev || otherpackages gcc || exit if [[ "$PLUGINS_LINUXx64" =~ "avplug" ]]; then debianpackages libswscale-dev libavcodec-dev || otherpackages || exit fi @@ -249,12 +249,12 @@ fi if [ "$BUILD_LINUXx32" == "y" ]; then #for building linux targets debianpackages gcc-multilib g++-multilib mesa-common-dev libasound2-dev || otherpackages gcc || exit - jessiepackages libgnutls28-dev || debianpackages libgnutls-dev || otherpackages gcc || exit + jessiepackages libgnutls28-dev || debianpackages libgnutls28-dev || otherpackages gcc || exit fi if [ "$BUILD_LINUXarmhf" == "y" ]; then #for building linux targets debianpackages gcc-multilib-arm-linux-gnueabihf g++-multilib-arm-linux-gnueabihf mesa-common-dev libasound2-dev || otherpackages gcc || exit - jessiepackages libgnutls28-dev || debianpackages libgnutls-dev || otherpackages gcc || exit + jessiepackages libgnutls28-dev || debianpackages libgnutls28-dev || otherpackages gcc || exit fi if [ "$BUILD_SDL" == "y" ]; then #for building SDL targets @@ -368,7 +368,7 @@ if [ $UID -ne 0 ] && [ $REBUILD_TOOLCHAINS == "y" ]; then echo "Making libraries (x86)..." make FTE_TARGET=linux32 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null fi - if [ "$BUILD_LINUx64" == "y" ]; then + if [ "$BUILD_LINUXx64" == "y" ]; then echo "Making libraries (linux x86_64)..." make FTE_TARGET=linux64 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null fi diff --git a/engine/Makefile b/engine/Makefile index c38eef3d1..ebc57d55c 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -1218,6 +1218,12 @@ ifneq (,$(findstring linux,$(FTE_TARGET))) SV_LDFLAGS= SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -DMULTITHREAD + CL_CFLAGS=$(SPEEXCFLAGS) -DMULTITHREAD -DDYNAMIC_SDL + + #one of these two + IMAGELDFLAGS=-lpng -ljpeg + #CL_CFLAGS+= -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG + QCC_DIR=linqcc$(BITS) NPFTE_OBJS=httpclient.o image.o sys_linux_threads.o sys_npfte.o sys_axfte.o sys_plugfte.o @@ -1230,7 +1236,7 @@ ifneq (,$(findstring linux,$(FTE_TARGET))) GL_EXE_NAME=../$(EXE_NAME)-gl$(BITS) GLCL_EXE_NAME=../$(EXE_NAME)-glcl$(BITS) GL_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(OGGVORBISLDFLAGS) - GL_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include $(SPEEXCFLAGS) -DMULTITHREAD -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG -DDYNAMIC_SDL + GL_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include $(CL_CFLAGS) GLB_DIR=gl_linux$(BITS) GLCL_DIR=glcl_linux$(BITS) @@ -1238,7 +1244,7 @@ ifneq (,$(findstring linux,$(FTE_TARGET))) VK_EXE_NAME=../$(EXE_NAME)-vk$(BITS) VKCL_EXE_NAME=../$(EXE_NAME)-vkcl$(BITS) VK_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(OGGVORBISLDFLAGS) - VK_CFLAGS=$(VKCFLAGS) -I/usr/X11R6/include $(SPEEXCFLAGS) -DMULTITHREAD -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG -DDYNAMIC_SDL + VK_CFLAGS=$(VKCFLAGS) -I/usr/X11R6/include $(CL_CFLAGS) VKB_DIR=vk_linux$(BITS) VKCL_DIR=vkcl_linux$(BITS) @@ -1250,8 +1256,6 @@ ifneq (,$(findstring linux,$(FTE_TARGET))) MB_DIR=m_linux$(BITS) MCL_DIR=mcl_linux$(BITS) - IMAGELDFLAGS= - ifeq (,$(findstring NO_ZLIB,$(CFLAGS))) SV_LDFLAGS+= -lz GL_LDFLAGS+= -lz @@ -2001,29 +2005,40 @@ CONFIGARGS+= -host=$(ARCH) --enable-shared=no CC="$(CC)" CONFIGARGS:= $(CONFIGARGS) #--disable-silent-rules -makelibs: -ifndef ARCH - $(MAKE) makelibs ARCH=$(shell $(CC) -dumpmachine) -else - mkdir -p libs-$(ARCH) + +libs-$(ARCH)/libjpeg.a: test -f jpegsrc.v$(JPEGVER).tar.gz || wget http://www.ijg.org/files/jpegsrc.v$(JPEGVER).tar.gz - -test -f libs-$(ARCH)/libjpeg.a || (cd libs-$(ARCH) && tar -xvzf ../jpegsrc.v$(JPEGVER).tar.gz && cd jpeg-$(JPEGVER) && $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp .libs/libjpeg.a ../ && $(TOOLOVERRIDES) $(AR) -s ../libjpeg.a && cp jconfig.h jerror.h jmorecfg.h jpeglib.h jversion.h ../ ) - + -test -f libs-$(ARCH)/libjpeg.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../jpegsrc.v$(JPEGVER).tar.gz && cd jpeg-$(JPEGVER) && $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp .libs/libjpeg.a ../ && $(TOOLOVERRIDES) $(AR) -s ../libjpeg.a && cp jconfig.h jerror.h jmorecfg.h jpeglib.h jversion.h ../ ) + +libs-$(ARCH)/libz.a: test -f zlib-$(ZLIBVER).tar.gz || wget http://zlib.net/zlib-$(ZLIBVER).tar.gz - -test -f libs-$(ARCH)/libz.a || (cd libs-$(ARCH) && tar -xvzf ../zlib-$(ZLIBVER).tar.gz && cd zlib-$(ZLIBVER) && $(TOOLOVERRIDES) ./configure --static && $(TOOLOVERRIDES) $(MAKE) libz.a CC="$(CC) $(W32_CFLAGS) -fPIC" && cp libz.a ../ && $(TOOLOVERRIDES) $(AR) -s ../libz.a && cp zlib.h zconf.h zutil.h ../ ) - + -test -f libs-$(ARCH)/libz.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../zlib-$(ZLIBVER).tar.gz && cd zlib-$(ZLIBVER) && $(TOOLOVERRIDES) ./configure --static && $(TOOLOVERRIDES) $(MAKE) libz.a CC="$(CC) $(W32_CFLAGS) -fPIC" && cp libz.a ../ && $(TOOLOVERRIDES) $(AR) -s ../libz.a && cp zlib.h zconf.h zutil.h ../ ) + +libs-$(ARCH)/libpng.a: libs-$(ARCH)/libz.a test -f libpng-$(PNGVER).tar.gz || wget http://prdownloads.sourceforge.net/libpng/libpng-$(PNGVER).tar.gz?download -O libpng-$(PNGVER).tar.gz - -test -f libs-$(ARCH)/libpng.a || (cd libs-$(ARCH) && tar -xvzf ../libpng-$(PNGVER).tar.gz && cd libpng-$(PNGVER) && $(TOOLOVERRIDES) ./configure CPPFLAGS=-I$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/ LDFLAGS=-L$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/ $(CONFIGARGS) --enable-static && $(TOOLOVERRIDES) $(MAKE) && cp .libs/libpng16.a ../libpng.a && cp png*.h ../ ) - + -test -f libs-$(ARCH)/libpng.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../libpng-$(PNGVER).tar.gz && cd libpng-$(PNGVER) && $(TOOLOVERRIDES) ./configure CPPFLAGS=-I$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/ LDFLAGS=-L$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/ $(CONFIGARGS) --enable-static && $(TOOLOVERRIDES) $(MAKE) && cp .libs/libpng16.a ../libpng.a && cp png*.h ../ ) + +libs-$(ARCH)/libogg.a: test -f libogg-$(OGGVER).tar.gz || wget http://downloads.xiph.org/releases/ogg/libogg-$(OGGVER).tar.gz - -test -f libs-$(ARCH)/libogg.a || (cd libs-$(ARCH) && tar -xvzf ../libogg-$(OGGVER).tar.gz && cd libogg-$(OGGVER) && $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp src/.libs/libogg.a ../ && $(TOOLOVERRIDES) $(AR) -s ../libogg.a) + -test -f libs-$(ARCH)/libogg.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../libogg-$(OGGVER).tar.gz && cd libogg-$(OGGVER) && $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp src/.libs/libogg.a ../ && $(TOOLOVERRIDES) $(AR) -s ../libogg.a && mkdir ../ogg && cp include/ogg/*.h ../ogg) +libs-$(ARCH)/libvorbis.a: test -f libvorbis-$(VORBISVER).tar.gz || wget http://downloads.xiph.org/releases/vorbis/libvorbis-$(VORBISVER).tar.gz - -test -f libs-$(ARCH)/libvorbisfile.a || (cd libs-$(ARCH) && tar -xvzf ../libvorbis-$(VORBISVER).tar.gz && cd libvorbis-$(VORBISVER) && $(TOOLOVERRIDES) ./configure PKG_CONFIG= $(CONFIGARGS) --disable-oggtest --with-ogg-libraries=.. --with-ogg-includes=$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/libogg-$(OGGVER)/include && $(TOOLOVERRIDES) $(MAKE) && cp lib/.libs/libvorbis.a ../ && cp lib/.libs/libvorbisfile.a ../ ) -endif + -test -f libs-$(ARCH)/libvorbisfile.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../libvorbis-$(VORBISVER).tar.gz && cd libvorbis-$(VORBISVER) && $(TOOLOVERRIDES) ./configure PKG_CONFIG= $(CONFIGARGS) --disable-oggtest --with-ogg-libraries=.. --with-ogg-includes=$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)/libogg-$(OGGVER)/include && $(TOOLOVERRIDES) $(MAKE) && cp lib/.libs/libvorbis.a ../ && cp lib/.libs/libvorbisfile.a ../ && mkdir ../vorbis && cp include/vorbis/*.h ../vorbis) -httpserver: - $(CC) -o release/httpserver http/httpserver.c http/iwebiface.c common/fs_stdio.c -Icommon -Iclient -Iqclib -Igl -Iserver -DWEBSVONLY -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp +makelibs: libs-$(ARCH)/libjpeg.a libs-$(ARCH)/libz.a libs-$(ARCH)/libpng.a libs-$(ARCH)/libogg.a libs-$(ARCH)/libvorbis.a + +HTTP_OBJECTS=http/httpserver.c http/iwebiface.c common/fs_stdio.c +$(RELEASE_DIR)/httpserver$(BITS): $(HTTP_OBJECTS) + $(CC) -o $(RELEASE_DIR)/httpserver$(BITS) $(HTTP_OBJECTS) -Icommon -Iclient -Iqclib -Igl -Iserver -DWEBSVONLY -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNO_PNG +httpserver: $(RELEASE_DIR)/httpserver$(BITS) + +IQM_OBJECTS=../iqm/iqm.cpp +$(RELEASE_DIR)/iqm$(BITS): $(IQM_OBJECTS) + $(CC) -o $(RELEASE_DIR)/iqm$(BITS) $(IQM_OBJECTS) -lstdc++ -lm +iqm: $(RELEASE_DIR)/iqm$(BITS) + +utils: httpserver iqm prefix ?= /usr/local exec_prefix ?= $(prefix) diff --git a/engine/client/m_download.c b/engine/client/m_download.c index 07821d4d6..7676711d9 100644 --- a/engine/client/m_download.c +++ b/engine/client/m_download.c @@ -1091,7 +1091,7 @@ static void PM_PreparePackageList(void) { pluginpromptshown = true; #ifndef SERVERONLY - M_Menu_Prompt(PM_PluginDetected, NULL, "Plugin(s) appears to have\nbeen installed externally.\nUse the updates menu\ntoenable them.", "View", NULL, "Disable"); + M_Menu_Prompt(PM_PluginDetected, NULL, "Plugin(s) appears to have\nbeen installed externally.\nUse the updates menu\nto enable them.", "View", NULL, "Disable"); #endif } } diff --git a/engine/client/sys_linux.c b/engine/client/sys_linux.c index cc275cf3b..d97a35cfe 100644 --- a/engine/client/sys_linux.c +++ b/engine/client/sys_linux.c @@ -264,8 +264,132 @@ void Sys_Quit (void) exit(0); } +static void Sys_Register_File_Associations_f(void) +{ + char xdgbase[MAX_OSPATH]; + + if (1) + { + const char *e = getenv("XDG_DATA_HOME"); + if (e && *e) + Q_strncpyz(xdgbase, e, sizeof(xdgbase)); + else + { + e = getenv("HOME"); + if (e && *e) + Q_snprintfz(xdgbase, sizeof(xdgbase), "%s/.local/share", e); + else + { + Con_Printf("homedir not known\n"); + return; + } + } + } + else + { + const char *e = getenv("XDG_DATA_DIRS"); + while (e && *e == ':') + e++; + if (e && *e) + { + char *c; + Q_strncpyz(xdgbase, e, sizeof(xdgbase)); + c = strchr(xdgbase, ':'); + if (*c) + *c = 0; + } + else + Q_strncpyz(xdgbase, "/usr/local/share/", sizeof(xdgbase)); + } + + //we need to create some .desktop file first, so stuff knows how to start us up. + { + char *exe = realpath(host_parms.argv[0], NULL); + char *basedir = realpath(com_gamepath, NULL); + const char *desktopfile = + "[Desktop Entry]\n" + "Type=Application\n" + "Encoding=UTF-8\n" + "Name=FTE QuakeWorld\n" //FIXME: needs to come from the manifest + "Comment=Awesome First Person Shooter\n" //again should be a manicfest item + "Exec=\"%s\" %%u\n" //FIXME: FS_GetManifestArgs! etc! + "Path=%s\n" + "Icon=quake\n" //FIXME: fix me! + "Terminal=false\n" + "Categories=Game;\n" + "MimeType=application/x-quakeworlddemo;x-scheme-handler/qw;\n" + ; + desktopfile = va(desktopfile, + exe, basedir); + free(exe); + free(basedir); + FS_WriteFile(va("%s/applications/fteqw.desktop", xdgbase), desktopfile, strlen(desktopfile), FS_SYSTEM); + } + + //we need to set some default applications. + //write out a new file and rename the new over the top of the old + { + char *foundassoc = NULL; + vfsfile_t *out = FS_OpenVFS(va("%s/applications/.mimeapps.list.new", xdgbase), "wb", FS_SYSTEM); + if (out) + { + qofs_t insize; + char *in = FS_MallocFile(va("%s/applications/mimeapps.list", xdgbase), FS_SYSTEM, &insize); + if (in) + { + qboolean inadded = false; + char *l = in; + while(*l) + { + char *le; + while(*l == ' ' || *l == '\n') + l++; + le = strchr(l, '\n'); + if (le) + le = le+1; + else + le = l + strlen(l); + if (!strncmp(l, "[Added Associations]", 20)) + { + inadded = true; + if (!foundassoc) + foundassoc = le; + } + else if (!strncmp(l, "[", 1)) + inadded = false; + else if (inadded && !strncmp(l, "x-scheme-handler/qw=", 20)) + { + foundassoc = l; + insize -= strlen(le); + memmove(l, le, strlen(le)); //remove the line + } + l = le; + } + if (foundassoc) + { //if we found it, or somewhere to insert it, then insert it. + VFS_WRITE(out, in, foundassoc-in); + VFS_PRINTF(out, "x-scheme-handler/qw=fteqw.desktop\n"); + VFS_WRITE(out, foundassoc, insize - (foundassoc-in)); + } + else + VFS_WRITE(out, in, insize); //not found, just write everything as-is + Z_Free(in); + } + if (!foundassoc) + { //if file not found, or no appropriate section, just concat it on the end. + VFS_PRINTF(out, "[Added Associations]\n"); + VFS_PRINTF(out, "x-scheme-handler/qw=fteqw.desktop\n"); + } + VFS_FLUSH(out); + VFS_CLOSE(out); + FS_Rename2(va("%s/applications/.mimeapps.list.new", xdgbase), va("%s/applications/mimeapps.list", xdgbase), FS_SYSTEM, FS_SYSTEM); + } + } +} + void Sys_Init(void) { + Cmd_AddCommandD("sys_register_file_associations", Sys_Register_File_Associations_f, "Register FTE as the default handler for various file+protocol types, using FreeDesktop standards.\n"); } void Sys_Shutdown(void) { @@ -336,56 +460,6 @@ qboolean Sys_Rename (char *oldfname, char *newfname) return !rename(oldfname, newfname); } -int Sys_FileOpenRead (char *path, int *handle) -{ - int h; - struct stat fileinfo; - - h = open (path, O_RDONLY, 0666); - *handle = h; - if (h == -1) - return -1; - - if (fstat (h,&fileinfo) == -1) - Sys_Error ("Error fstating %s", path); - - return fileinfo.st_size; -} - -int Sys_FileOpenWrite (char *path) -{ - int handle; - - umask (0); - - handle = open(path,O_RDWR | O_CREAT | O_TRUNC, 0666); - - if (handle == -1) - Sys_Error ("Error opening %s: %s", path,strerror(errno)); - - return handle; -} - -int Sys_FileWrite (int handle, void *src, int count) -{ - return write (handle, src, count); -} - -void Sys_FileClose (int handle) -{ - close (handle); -} - -void Sys_FileSeek (int handle, int position) -{ - lseek (handle, position, SEEK_SET); -} - -int Sys_FileRead (int handle, void *dest, int count) -{ - return read (handle, dest, count); -} - int Sys_DebugLog(char *file, char *fmt, ...) { va_list argptr; @@ -800,6 +874,7 @@ int main (int c, const char **v) { double time, oldtime, newtime; quakeparms_t parms; + int i; // char cwd[1024]; char bindir[1024]; @@ -815,6 +890,9 @@ int main (int c, const char **v) parms.argc = c; parms.argv = v; +#ifdef CONFIG_MANIFEST_TEXT + parms.manifest = CONFIG_MANIFEST_TEXT; +#endif COM_InitArgv(parms.argc, parms.argv); #ifdef __linux__ @@ -831,7 +909,7 @@ int main (int c, const char **v) } #endif - parms.basedir = basedir; + parms.basedir = realpath(".", NULL); memset(bindir, 0, sizeof(bindir)); //readlink does NOT null terminate, apparently. #ifdef __linux__ //attempt to figure out where the exe is located @@ -876,6 +954,16 @@ int main (int c, const char **v) Host_Init(&parms); + for (i = 1; i < parms.argc; i++) + { + Con_Printf("Arg%i == %s\n", i, parms.argv[i]); + if (!parms.argv[i]) + continue; + if (*parms.argv[i] == '+' || *parms.argv[i] == '-') + break; + Host_RunFile(parms.argv[i], strlen(parms.argv[i]), NULL); + } + oldtime = Sys_DoubleTime (); while (1) { diff --git a/engine/common/common.c b/engine/common/common.c index 4fd43f5b8..f2fd45c9c 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -4796,12 +4796,20 @@ void COM_Version_f (void) #ifndef AVAIL_PNGLIB Con_Printf("libpng disabled\n"); #else - Con_Printf("libPNG %s -%s", PNG_LIBPNG_VER_STRING, PNG_HEADER_VERSION_STRING); + #ifdef DYNAMIC_LIBPNG + Con_Printf("libPNG(dynamic) %s -%s", PNG_LIBPNG_VER_STRING, PNG_HEADER_VERSION_STRING); + #else + Con_Printf("libPNG %s -%s", PNG_LIBPNG_VER_STRING, PNG_HEADER_VERSION_STRING); + #endif #endif #ifndef AVAIL_JPEGLIB Con_Printf("libjpeg disabled\n"); #else - Con_Printf("libjpeg: %i (%d series)\n", JPEG_LIB_VERSION, ( JPEG_LIB_VERSION / 10 ) ); + #ifdef DYNAMIC_LIBJPEG + Con_Printf("libjpeg(dynamic): %i (%d series)\n", JPEG_LIB_VERSION, ( JPEG_LIB_VERSION / 10 ) ); + #else + Con_Printf("libjpeg: %i (%d series)\n", JPEG_LIB_VERSION, ( JPEG_LIB_VERSION / 10 ) ); + #endif #endif Con_Printf("VoiceChat:"); @@ -4809,12 +4817,12 @@ void COM_Version_f (void) Con_Printf(" disabled"); #else #ifdef SPEEX_STATIC - Con_Printf(" speex(static)"); + Con_Printf(" speex"); #else Con_Printf(" speex(dynamic)"); #endif #ifdef OPUS_STATIC - Con_Printf(" opus(static)"); + Con_Printf(" opus"); #else Con_Printf(" opus(dynamic)"); #endif @@ -4823,9 +4831,9 @@ void COM_Version_f (void) Con_Printf("Audio Decoders:"); #ifndef AVAIL_OGGVORBIS - Con_Printf(" ^h(disabled: Ogg Vorbis)^7"); + Con_DPrintf(" ^h(disabled: Ogg Vorbis)^7"); #elif defined(LIBVORBISFILE_STATIC) - Con_Printf(" Ogg Vorbis(static)"); + Con_Printf(" Ogg Vorbis"); #else Con_Printf(" Ogg Vorbis(dynamic)"); #endif @@ -4840,12 +4848,12 @@ void COM_Version_f (void) #ifdef USE_MYSQL Con_Printf(" mySQL(dynamic)"); #else - Con_Printf(" ^h(disabled: mySQL)^7"); + Con_DPrintf(" ^h(disabled: mySQL)^7"); #endif #ifdef USE_SQLITE Con_Printf(" sqlite(dynamic)"); #else - Con_Printf(" ^h(disabled: sqlite)^7"); + Con_DPrintf(" ^h(disabled: sqlite)^7"); #endif Con_Printf("\n"); #endif @@ -4854,28 +4862,28 @@ void COM_Version_f (void) #ifdef SUBSERVERS Con_Printf(" mapcluster(enabled)"); #else - Con_Printf(" ^h(disabled: mapcluster)^7"); + Con_DPrintf(" ^h(disabled: mapcluster)^7"); #endif #ifndef SERVERONLY #ifdef AVAIL_FREETYPE Con_Printf(" freetype2"); #else - Con_Printf(" ^h(disabled: freetype2)^7"); + Con_DPrintf(" ^h(disabled: freetype2)^7"); #endif #ifdef AVAIL_OPENAL Con_Printf(" openal"); #else - Con_Printf(" ^h(disabled: openal)^7"); + Con_DPrintf(" ^h(disabled: openal)^7"); #endif #endif Con_Printf("\n"); #ifdef _WIN32 #ifndef AVAIL_DINPUT - Con_Printf("DirectInput disabled\n"); + Con_DPrintf("DirectInput disabled\n"); #endif #ifndef AVAIL_DSOUND - Con_Printf("DirectSound disabled\n"); + Con_DPrintf("DirectSound disabled\n"); #endif #endif @@ -4889,7 +4897,7 @@ void COM_Version_f (void) #elif defined(Q3BSPS) Con_Printf(" Quake3(bsp only)"); #else - Con_Printf(" ^h(disabled: Quake3)^7"); + Con_DPrintf(" ^h(disabled: Quake3)^7"); #endif #if defined(Q2SERVER) && defined(Q2CLIENT) Con_Printf(" Quake2"); @@ -4900,17 +4908,17 @@ void COM_Version_f (void) #elif defined(Q2BSPS) Con_Printf(" Quake2(bsp only)"); #else - Con_Printf(" ^h(disabled: Quake2)^7"); + Con_DPrintf(" ^h(disabled: Quake2)^7"); #endif #if defined(HEXEN2) Con_Printf(" Hexen2"); #else - Con_Printf(" ^h(disabled: Hexen2)^7"); + Con_DPrintf(" ^h(disabled: Hexen2)^7"); #endif #if defined(NQPROT) Con_Printf(" NetQuake"); #else - Con_Printf(" ^h(disabled: NetQuake)"); + Con_DPrintf(" ^h(disabled: NetQuake)"); #endif #if defined(VM_Q1) Con_Printf(" ssq1qvm"); diff --git a/engine/common/fs.c b/engine/common/fs.c index cc06f2128..337199262 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -4036,6 +4036,15 @@ qboolean Sys_FindGameData(const char *poshname, const char *gamename, char *base return true; } } + s = va("/usr/share/games/%s-demo/", gamename); + if (stat(s, &sb) == 0) + { + if (S_ISDIR(sb.st_mode)) + { + Q_strncpyz(basepath, s, basepathlen); + return true; + } + } #endif return false; } @@ -5185,7 +5194,13 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs, qboolean } } if (!fixedbasedir && !com_installer) - Q_strncpyz (com_gamepath, newbasedir, sizeof(com_gamepath)); + { + if (strcmp(com_gamepath, newbasedir)) + { + PM_Shutdown(); + Q_strncpyz (com_gamepath, newbasedir, sizeof(com_gamepath)); + } + } //make sure it has a trailing slash, or is empty. woo. FS_CleanDir(com_gamepath, sizeof(com_gamepath)); diff --git a/engine/common/net_ssl_gnutls.c b/engine/common/net_ssl_gnutls.c index 167cafb04..ba24ac2ac 100644 --- a/engine/common/net_ssl_gnutls.c +++ b/engine/common/net_ssl_gnutls.c @@ -135,11 +135,10 @@ static void (VARGS *qgnutls_transport_set_pull_function)(gnutls_session_t sessio static void (VARGS *qgnutls_transport_set_errno)(gnutls_session_t session, int err); static int (VARGS *qgnutls_error_is_fatal)(int error); static int (VARGS *qgnutls_credentials_set)(gnutls_session_t, gnutls_credentials_type_t type, void* cred); -static int (VARGS *qgnutls_kx_set_priority)(gnutls_session_t session, const int*); +//static int (VARGS *qgnutls_kx_set_priority)(gnutls_session_t session, const int*); static int (VARGS *qgnutls_init)(gnutls_session_t * session, gnutls_connection_end_t con_end); static int (VARGS *qgnutls_set_default_priority)(gnutls_session_t session); static int (VARGS *qgnutls_certificate_allocate_credentials)(gnutls_certificate_credentials_t *sc); -static int (VARGS *qgnutls_certificate_type_set_priority)(gnutls_session_t session, const int*); static int (VARGS *qgnutls_anon_allocate_client_credentials)(gnutls_anon_client_credentials_t *sc); static int (VARGS *qgnutls_global_init)(void); static ssize_t (VARGS *qgnutls_record_send)(gnutls_session_t session, const void *data, size_t sizeofdata); @@ -197,9 +196,7 @@ static qboolean Init_GNUTLS(void) GNUTLS_FUNC(gnutls_transport_set_pull_function) \ GNUTLS_FUNC(gnutls_transport_set_errno) \ GNUTLS_FUNC(gnutls_error_is_fatal) \ - GNUTLS_FUNC(gnutls_certificate_type_set_priority) \ GNUTLS_FUNC(gnutls_credentials_set) \ - GNUTLS_FUNC(gnutls_kx_set_priority) \ GNUTLS_FUNC(gnutls_init) \ GNUTLS_FUNC(gnutls_set_default_priority) \ GNUTLS_FUNC(gnutls_certificate_allocate_credentials) \ @@ -232,9 +229,8 @@ static qboolean Init_GNUTLS(void) {(void**)&qgnutls_transport_set_pull_function, "gnutls_transport_set_pull_function"}, {(void**)&qgnutls_transport_set_errno, "gnutls_transport_set_errno"}, {(void**)&qgnutls_error_is_fatal, "gnutls_error_is_fatal"}, - {(void**)&qgnutls_certificate_type_set_priority, "gnutls_certificate_type_set_priority"}, {(void**)&qgnutls_credentials_set, "gnutls_credentials_set"}, - {(void**)&qgnutls_kx_set_priority, "gnutls_kx_set_priority"}, +// {(void**)&qgnutls_kx_set_priority, "gnutls_kx_set_priority"}, {(void**)&qgnutls_init, "gnutls_init"}, {(void**)&qgnutls_set_default_priority, "gnutls_set_default_priority"}, {(void**)&qgnutls_certificate_allocate_credentials, "gnutls_certificate_allocate_credentials"}, @@ -396,7 +392,7 @@ static int QDECL SSL_CheckCert(gnutls_session_t session) gnutls_datum_t out; gnutls_certificate_type_t type; - if (preverified && certstatus == (GNUTLS_CERT_INVALID|GNUTLS_CERT_SIGNER_NOT_FOUND)) + if (preverified && (certstatus&~GNUTLS_CERT_EXPIRED) == (GNUTLS_CERT_INVALID|GNUTLS_CERT_SIGNER_NOT_FOUND)) return 0; if (certstatus == 0) return 0; @@ -699,7 +695,7 @@ vfsfile_t *FS_OpenSSL(const char *hostname, vfsfile_t *source, qboolean server, qgnutls_set_default_priority (newf->session); if (anon) { - qgnutls_kx_set_priority (newf->session, kx_prio); + //qgnutls_kx_set_priority (newf->session, kx_prio); qgnutls_credentials_set (newf->session, GNUTLS_CRD_ANON, anoncred); } else @@ -707,7 +703,7 @@ vfsfile_t *FS_OpenSSL(const char *hostname, vfsfile_t *source, qboolean server, //#if GNUTLS_VERSION_MAJOR >= 3 //gnutls_priority_set_direct(); //#else - qgnutls_certificate_type_set_priority (newf->session, cert_type_priority); + //qgnutls_certificate_type_set_priority (newf->session, cert_type_priority); //#endif qgnutls_credentials_set (newf->session, GNUTLS_CRD_CERTIFICATE, xcred); } diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 6a8d11bf0..33000b4e3 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -10,7 +10,7 @@ struct edict_s; #define NOENDIAN #endif -pbool ED_ParseEpair (progfuncs_t *progfuncs, int qcptr, unsigned int fldofs, int fldtype, char *s); +pbool ED_ParseEpair (progfuncs_t *progfuncs, size_t qcptr, unsigned int fldofs, int fldtype, char *s); /* ================= @@ -1237,7 +1237,7 @@ pbool PDECL ED_ParseEval (pubprogfuncs_t *ppf, eval_t *eval, int type, const cha return true; } -pbool ED_ParseEpair (progfuncs_t *progfuncs, int qcptr, unsigned int fldofs, int fldtype, char *s) +pbool ED_ParseEpair (progfuncs_t *progfuncs, size_t qcptr, unsigned int fldofs, int fldtype, char *s) { int i; char string[128]; diff --git a/iqm/Makefile b/iqm/Makefile index 2463b931a..d891ff583 100644 --- a/iqm/Makefile +++ b/iqm/Makefile @@ -17,3 +17,6 @@ iqm: $(IQM_OBJS) $(CXX) $(CXXFLAGS) -o iqm $(IQM_OBJS) upgrade: $(UPGRADE_OBJS) $(CXX) $(CXXFLAGS) -o upgrade $(UPGRADE_OBJS) + +%.o : %.cpp + $(CXX) -o $@ -c $<