1
0
Fork 0
forked from fte/fteqw

Makefile tweaks to make building more robust with respect to android sdk changes.\nFix video capture on linux.\nSupport a few more jpegs.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5088 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-04-10 07:52:18 +00:00
parent 9efb2c5c0e
commit aef821b9c6
6 changed files with 71 additions and 72 deletions

View file

@ -142,57 +142,68 @@ USER_TARGET:=$(FTE_TARGET)
#make droid-rel doesn't get the right stuff
#add a small default config file. its only small. and some other stuff, because we can. This makes it much easier to get it up and running.
DROID_PACKSU?= $(BASE_DIR)/droid/fte.cfg $(BASE_DIR)/droid/default.fmf $(BASE_DIR)/droid/configs/touch.cfg
ANDROID_NDK_ROOT?=~/android-ndk-r8e
ANDROID_HOME?=~/android-sdk-linux
#ANDROID_NDK_ROOT?=~/android-ndk-r8e
ANDROID_NDK_ROOT?=$(ANDROID_HOME)/ndk-bundle
ANDROID_TOOLS?=$(ANDROID_HOME)/tools
ANT?=ant
JAVA_HOME?=/usr
JAVATOOL=$(JAVA_HOME)/bin/
ANDROID_SCRIPT=android
ifeq ($(DROID_ARCH),)
DROID_ARCH=armeabi
DROID_ARCH=arm
endif
ifeq ($(FTE_TARGET),droid)
DROID_API_LEVEL=4
#figure out the host system, required to find a usable compiler
ifneq ($(shell uname -o 2>&1 | grep Cygwin),)
# ifeq ($(shell uname -m 2>&1), i686)
# ANDROID_HOSTSYSTEM=windows
# else
# ANDROID_HOSTSYSTEM=windows-$(shell uname -m)
# endif
ANDROID_HOSTSYSTEM=windows-x86_64
else
ANDROID_HOSTSYSTEM=linux-$(shell uname -m)
endif
#ask the android ndk which compiler version strings we should be using
ANDROID_TOOLCHAINNAME:=$(shell ANDROID_NDK_ROOT=$(ANDROID_NDK_ROOT) . $(ANDROID_NDK_ROOT)/build/tools/dev-defaults.sh && get_default_toolchain_name_for_arch $(DROID_ARCH))
ANDROID_TOOLCHAINPREFIX:=$(shell ANDROID_NDK_ROOT=$(ANDROID_NDK_ROOT) . $(ANDROID_NDK_ROOT)/build/tools/dev-defaults.sh && get_default_toolchain_prefix_for_arch $(DROID_ARCH))
TOOLCHAINPATH:=$(ANDROID_NDK_ROOT)/toolchains/$(ANDROID_TOOLCHAINNAME)/prebuilt/$(ANDROID_HOSTSYSTEM)/bin/
TOOLCHAIN:=$(TOOLCHAINPATH)$(ANDROID_TOOLCHAINPREFIX)-
#4 is the min that fte requires
DROID_API_LEVEL?=4
DROID_API_NAME?=android-$(DROID_API_LEVEL)
DROID_PLAT_INC=arch-$(DROID_ARCH)
ifeq ($(DROID_ARCH),x86)
DROID_PLAT_INC=arch-x86
#google fecked up. anything before api_level 9 will fail to compile on x86
DROID_API_LEVEL=9
else
DROID_PLAT_INC=arch-arm
#there are 3 ABI targets
#armv5 (works on all arm droids)
#armv7 (more common on 2.2+ droids)
#armv7+neon
DROID_ABI?=-mfloat-abi=softfp
endif
DROIDSYSROOT=$(realpath $(ANDROID_NDK_ROOT)/platforms/android-$(DROID_API_LEVEL)/$(DROID_PLAT_INC))
DROIDSYSROOT=$(realpath $(ANDROID_NDK_ROOT)/platforms/$(DROID_API_NAME)/$(DROID_PLAT_INC))
ifeq ($(DROIDSYSROOT),) #its possible that google removed whatever api we're trying to target, just switch up to the new default.
DROID_API_NAME:=$(shell ANDROID_NDK_ROOT=$(ANDROID_NDK_ROOT) . $(ANDROID_NDK_ROOT)/build/tools/dev-defaults.sh && echo -n $$DEFAULT_PLATFORM)
BITCHANDMOAN:=$(shell echo targetting \"$(DROID_API_NAME)\" instead of \"android-$(DROID_API_LEVEL)\" 1>&2)
endif
DROIDSYSROOT:=$(DROIDSYSROOT)
#if we're running under windows, then we want to run some other binary
ifeq ($(shell uname -o 2>&1 | grep Cygwin),)
#set up for linux
ifeq ($(DROID_ARCH),x86)
TOOLCHAINPATH:=$(ANDROID_NDK_ROOT)/toolchains/x86-4.7/prebuilt/linux-x86/bin/
TOOLCHAIN:=$(TOOLCHAINPATH)i686-linux-androideabi-
else
TOOLCHAINPATH:=$(ANDROID_NDK_ROOT)/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86/bin/
TOOLCHAIN:=$(TOOLCHAINPATH)arm-linux-androideabi-
endif
TOOLOVERRIDES=PATH="/usr/bin:$(realpath $(TOOLCHAINPATH))" CFLAGS=--sysroot="$(realpath $(ANDROID_NDK_ROOT)/platforms/android-$(DROID_API_LEVEL)/$(DROID_PLAT_INC))" CPPFLAGS=--sysroot="$(realpath $(ANDROID_NDK_ROOT)/platforms/android-$(DROID_API_LEVEL)/$(DROID_PLAT_INC))"
CONFIGARGS= --with-sysroot="$(realpath $(ANDROID_NDK_ROOT)/platforms/android-$(DROID_API_LEVEL)/$(DROID_PLAT_INC))"
#set up for linux/mingw
TOOLOVERRIDES=PATH="/usr/bin:$(realpath $(TOOLCHAINPATH))" CFLAGS=--sysroot="$(realpath $(ANDROID_NDK_ROOT)/platforms/$(DROID_API_NAME)/$(DROID_PLAT_INC))" CPPFLAGS=--sysroot="$(realpath $(ANDROID_NDK_ROOT)/platforms/$(DROID_API_NAME)/$(DROID_PLAT_INC))"
CONFIGARGS= --with-sysroot="$(realpath $(ANDROID_NDK_ROOT)/platforms/$(DROID_API_NAME)/$(DROID_PLAT_INC))"
else
#we're running upon cygwin
#FIXME: support mingw too...
#we're running upon windows
ifeq ($(DROID_ARCH),x86)
TOOLCHAINPATH:=$(ANDROID_NDK_ROOT)/toolchains/x86-4.7/prebuilt/windows-x86_64/bin/
TOOLCHAIN:=$(TOOLCHAINPATH)i686-linux-android-
else
TOOLCHAINPATH:=$(ANDROID_NDK_ROOT)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows-x86_64/bin/
TOOLCHAIN:=$(TOOLCHAINPATH)arm-linux-androideabi-
endif
ANDROID_SCRIPT=android.bat
#make can't cope with absolute win32 paths in dependancy files
DEPCC=
@ -200,7 +211,7 @@ ifeq ($(FTE_TARGET),droid)
#configure hates android, with its broken default sysroot and lack of path etc
DROIDSYSROOT:=$(shell cygpath -m $(DROIDSYSROOT))
TOOLOVERRIDES=PATH="/usr/bin:$(shell cygpath -u $(realpath $(TOOLCHAINPATH)))" CFLAGS=--sysroot="$(DROIDSYSROOT)" CPPFLAGS=--sysroot="$(DROIDSYSROOT)"
CONFIGARGS= --with-sysroot="$(shell cygpath -u $(realpath $(ANDROID_NDK_ROOT)/platforms/android-$(DROID_API_LEVEL)/$(DROID_PLAT_INC)))"
CONFIGARGS= --with-sysroot="$(shell cygpath -u $(realpath $(ANDROID_NDK_ROOT)/platforms/$(DROID_API_NAME)/$(DROID_PLAT_INC)))"
endif
CC:=$(TOOLCHAIN)gcc --sysroot="$(DROIDSYSROOT)" -DANDROID $(DROID_ABI) -fno-strict-aliasing
@ -1826,12 +1837,16 @@ nacl-dbg:
#################################################
#webgl helpers
ifeq (,$(EMSDK))
#just adds some extra paths (WINDOWS HOST ONLY)
#assumes you installed the emscripten 1.22.0 sdk to EMSCRIPTENROOT
#if you have a different version installed, you will need to fix up the paths yourself (or just use fte_target explicitly yourself).
EMSCRIPTENROOT?=C:/Games/tools/Emscripten
#EMSCRIPTENPATH=$(realpath $(EMSCRIPTENROOT)):$(realpath $(EMSCRIPTENROOT)/clang/e1.22.0_64bit):$(realpath $(EMSCRIPTENROOT)/node/0.10.17_64bit):$(realpath $(EMSCRIPTENROOT)/python/2.7.5.3_64bit):$(realpath $(EMSCRIPTENROOT)/emscripten/1.22.0):$(PATH)
EMSCRIPTENPATH=$(realpath $(EMSCRIPTENROOT)):$(realpath $(EMSCRIPTENROOT)/clang/e1.35.0_64bit):$(realpath $(EMSCRIPTENROOT)/node/4.1.1_64bit/bin):$(realpath $(EMSCRIPTENROOT)/python/2.7.5.3_64bit):$(realpath $(EMSCRIPTENROOT)/emscripten/1.35.0):$(PATH)
else
EMSCRIPTENPATH=$(PATH)
endif
#EMCC?=/opt/emsdk_portable/emscripten/master/emcc
EMCC?=emcc.bat --em-config $(shell cygpath -m $(USERPROFILE))/.emscripten
@ -1906,7 +1921,7 @@ endif
@echo
@$(JAVATOOL)jarsigner $(JARSIGNARGS) -digestalg SHA1 -sigalg MD5withRSA -keystore droid/ftekeystore droid/bin/FTEDroid-release-unsigned.apk autogen
-rm -f $(RELEASE_DIR)/FTEDroid.apk
$(ANDROID_HOME)/tools/zipalign 4 droid/bin/FTEDroid-release-unsigned.apk $(NATIVE_RELEASE_DIR)/FTEDroid.apk
$(ANDROID_TOOLS)/zipalign 4 droid/bin/FTEDroid-release-unsigned.apk $(NATIVE_RELEASE_DIR)/FTEDroid.apk
droid-opt:
$(MAKE) FTE_TARGET=droid droid/build.xml droid/ftekeystore
@ -1987,6 +2002,8 @@ else
-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
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
prefix ?= /usr/local
exec_prefix ?= $(prefix)

View file

@ -1254,6 +1254,8 @@ qboolean LibJPEG_Init(void)
#endif
#endif
if (!LIBJPEG_LOADED())
Con_Printf("Unable to init libjpeg\n");
return LIBJPEG_LOADED();
}
@ -1430,7 +1432,10 @@ qbyte *ReadJPEGFile(qbyte *infile, int length, int *width, int *height)
memset(&cinfo, 0, sizeof(cinfo));
if (!LIBJPEG_LOADED())
{
Con_DPrintf("libjpeg not available.\n");
return NULL;
}
/* Step 1: allocate and initialize JPEG decompression object */
@ -1445,6 +1450,7 @@ qbyte *ReadJPEGFile(qbyte *infile, int length, int *width, int *height)
if (setjmp(jerr.setjmp_buffer))
{
// If we get here, the JPEG code has signaled an error.
Con_DPrintf("libjpeg failed to decode a file.\n");
badjpeg:
#ifdef DYNAMIC_LIBJPEG
qjpeg_destroy_decompress(&cinfo);
@ -1454,7 +1460,7 @@ badjpeg:
if (mem)
BZ_Free(mem);
return 0;
return NULL;
}
#ifdef DYNAMIC_LIBJPEG
qjpeg_create_decompress(&cinfo);
@ -1479,16 +1485,12 @@ badjpeg:
if (cinfo.output_components == 0)
{
#ifdef _DEBUG
Con_Printf("No JPEG Components, not a JPEG.\n");
#endif
Con_DPrintf("No JPEG Components, not a JPEG.\n");
goto badjpeg;
}
if (cinfo.output_components!=3 && cinfo.output_components != 1)
{
#ifdef _DEBUG
Con_Printf("Bad number of components in JPEG: '%d', should be '3'.\n",cinfo.output_components);
#endif
Con_DPrintf("Bad number of components in JPEG: '%d', should be '3'.\n",cinfo.output_components);
goto badjpeg;
}
size_stride = cinfo.output_width * cinfo.output_components;
@ -2770,7 +2772,7 @@ qbyte *Read32BitImageFile(qbyte *buf, int len, int *width, int *height, qboolean
#endif
#ifdef AVAIL_JPEGLIB
//jpeg jfif only.
if (len > 4 && (buf[0] == 0xff && buf[1] == 0xd8 && buf[2] == 0xff && buf[3] == 0xe0) && (data = ReadJPEGFile(buf, len, width, height)))
if (len > 4 && (buf[0] == 0xff && buf[1] == 0xd8 && buf[2] == 0xff /*&& buf[3] == 0xe0*/) && (data = ReadJPEGFile(buf, len, width, height)))
{
TRACE(("dbg: Read32BitImageFile: jpeg\n"));
return data;
@ -4329,7 +4331,7 @@ qboolean Image_LoadTextureFromMemory(texid_t tex, int flags, const char *iname,
}
#endif
else
Sys_Printf("Unable to read file %s (format unsupported)\n", fname);
Con_Printf("Unable to read file %s (format unsupported)\n", fname);
BZ_Free(filedata);
return false;

View file

@ -3681,6 +3681,7 @@ void Media_InitFakeSoundDevice (int speed, int channels, int samplebits)
sc->sn.buffer = (unsigned char *) BZ_Malloc(sc->sn.samples*sc->sn.numchannels*(sc->sn.samplebits/8));
Z_ReallocElements((void**)&sc->channel, &sc->max_chans, MAX_DYNAMIC_CHANNELS+NUM_AMBIENTS+NUM_MUSICS, sizeof(*sc->channel));
sc->Lock = MSD_Lock;
sc->Unlock = MSD_Unlock;

View file

@ -1635,6 +1635,7 @@ static soundcardinfo_t *SNDDMA_Init(char *driver, char *device, int seat)
st = (**sd->InitCard)(sc, device);
if (st)
{
cardinited:
S_DefaultSpeakerConfiguration(sc);
if (snd_speed)
{ //if the sample speeds of multiple soundcards do not match, it'll fail.
@ -1650,6 +1651,8 @@ static soundcardinfo_t *SNDDMA_Init(char *driver, char *device, int seat)
if (sc->seat == -1 && sc->ListenerUpdate)
sc->seat = 0; //hardware rendering won't cope with seat=-1
Z_ReallocElements((void**)&sc->channel, &sc->max_chans, MAX_DYNAMIC_CHANNELS+NUM_AMBIENTS+NUM_MUSICS, sizeof(*sc->channel));
return sc;
}
}
@ -1666,25 +1669,7 @@ static soundcardinfo_t *SNDDMA_Init(char *driver, char *device, int seat)
st = (**od->ptr)(sc, device?atoi(device):0);
if (st == 1)
{
S_DefaultSpeakerConfiguration(sc);
if (snd_speed)
{ //if the sample speeds of multiple soundcards do not match, it'll fail.
if (snd_speed != sc->sn.speed)
{
Con_TPrintf("S_Startup: Ignoring soundcard %s due to mismatched sample speeds.\nTry running Quake with -singlesound to use just the primary soundcard\n", sc->name);
S_ShutdownCard(sc);
continue;
}
}
else
snd_speed = sc->sn.speed;
if (sc->seat == -1 && sc->ListenerUpdate)
sc->seat = 0; //hardware rendering won't cope with seat=-1
return sc;
}
goto cardinited;
}
}

View file

@ -497,7 +497,7 @@ static int QDECL SSL_Read(struct vfsfile_s *f, void *buffer, int bytestoread)
{
if (read == GNUTLS_E_PREMATURE_TERMINATION)
{
Con_Printf("TLS Premature Termination\n");
Con_Printf("TLS Premature Termination from %s\n", file->certname);
return -1;
}
else if (read == GNUTLS_E_REHANDSHAKE)
@ -506,7 +506,7 @@ static int QDECL SSL_Read(struct vfsfile_s *f, void *buffer, int bytestoread)
//if false, 'recommended' to send an GNUTLS_A_NO_RENEGOTIATION alert, no idea how.
}
else if (!qgnutls_error_is_fatal(read))
return 0;
return 0; //caller is expected to try again later, no real need to loop here, just in case it repeats (eg E_AGAIN)
else
{
Con_Printf("TLS Read Error %i (bufsize %i)\n", read, bytestoread);
@ -570,9 +570,9 @@ static ssize_t SSL_Push(gnutls_transport_ptr_t p, const void *data, size_t size)
qgnutls_transport_set_errno(file->session, EAGAIN);
return -1;
}
qgnutls_transport_set_errno(file->session, done<0?errno:0);
if (done < 0)
return 0;
qgnutls_transport_set_errno(file->session, done<0?errno:0);
return done;
}
/*static ssize_t SSL_PushV(gnutls_transport_ptr_t p, giovec_t *iov, int iovcnt)
@ -607,11 +607,11 @@ static ssize_t SSL_Pull(gnutls_transport_ptr_t p, void *data, size_t size)
qgnutls_transport_set_errno(file->session, EAGAIN);
return -1;
}
qgnutls_transport_set_errno(file->session, done<0?errno:0);
if (done < 0)
{
return 0;
}
qgnutls_transport_set_errno(file->session, done<0?errno:0);
return done;
}

View file

@ -114,9 +114,7 @@ qboolean GLSCR_UpdateScreen (void)
{
Editor_Draw();
V_UpdatePalette (false);
#if defined(_WIN32) && defined(GLQUAKE)
Media_RecordFrame();
#endif
R2D_BrightenScreen();
if (key_dest_mask & kdm_console)
@ -135,9 +133,7 @@ qboolean GLSCR_UpdateScreen (void)
M_Draw(0);
V_UpdatePalette (false);
R2D_BrightenScreen();
#if defined(_WIN32) && defined(GLQUAKE)
Media_RecordFrame();
#endif
if (R2D_Flush)
R2D_Flush();
GL_Set2D (false);
@ -206,9 +202,7 @@ qboolean GLSCR_UpdateScreen (void)
V_UpdatePalette (false);
R2D_BrightenScreen();
#if defined(_WIN32) && defined(GLQUAKE)
Media_RecordFrame();
#endif
RSpeedShow();