From 6a7f1d5eff5d3af429e20501eb77be9f8693cc9d Mon Sep 17 00:00:00 2001 From: Spoike Date: Sun, 20 Oct 2019 05:02:37 +0000 Subject: [PATCH] Build fixup: separate BUILD_WINDOWS into BUILD_WIN32 and BUILD_WIN64. Don't use outdated header versions (png versions were conflicting, causing errors). git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5572 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- build_setup.sh | 27 ++++++---- build_wip.sh | 115 +++++++++++++++++++++++++---------------- engine/Makefile | 4 -- engine/client/image.c | 14 ++--- engine/common/common.c | 9 +--- 5 files changed, 97 insertions(+), 72 deletions(-) diff --git a/build_setup.sh b/build_setup.sh index b60187b22..91076dc7c 100755 --- a/build_setup.sh +++ b/build_setup.sh @@ -113,7 +113,8 @@ if [ "$REUSE_CONFIG" != "y" ]; then else echo "Skipping Cygwin options." fi - read -n 1 -p "Build for Windows? [Y/n] " BUILD_WINDOWS && echo + read -n 1 -p "Build for Windows x86? [Y/n] " BUILD_WIN32 && echo + read -n 1 -p "Build for Windows x86_64? [Y/n] " BUILD_WIN64 && echo read -n 1 -p "Build for Dos? [y/N] " BUILD_DOS && echo read -n 1 -p "Build for SDL? [y/N] " BUILD_SDL && echo read -n 1 -p "Build for Android? [y/N] " BUILD_ANDROID && echo @@ -131,7 +132,8 @@ BUILD_LINUXx64=${BUILD_LINUXx64:-y} BUILD_LINUXx32=${BUILD_LINUXx32:-n} BUILD_LINUXarmhf=${BUILD_LINUXarmhf:-n} BUILD_CYGWIN=${BUILD_CYGWIN:-n} -BUILD_WINDOWS=${BUILD_WINDOWS:-y} +BUILD_WIN32=${BUILD_WIN32:-y} +BUILD_WIN64=${BUILD_WIN64:-y} BUILD_DOS=${BUILD_DOS:-n} BUILD_MSVC=${BUILD_MSVC:-n} BUILD_SDL=${BUILD_SDL:-n} @@ -160,7 +162,8 @@ if [ "$UID" != "0" ]; then echo "BUILD_LINUXx32=\"$BUILD_LINUXx32\"" >>$FTECONFIG echo "BUILD_LINUXarmhf=\"$BUILD_LINUXarmhf\"" >>$FTECONFIG echo "BUILD_CYGWIN=\"$BUILD_CYGWIN\"" >>$FTECONFIG - echo "BUILD_WINDOWS=\"$BUILD_WINDOWS\"" >>$FTECONFIG + echo "BUILD_WIN32=\"$BUILD_WIN32\"" >>$FTECONFIG + echo "BUILD_WIN64=\"$BUILD_WIN64\"" >>$FTECONFIG echo "BUILD_DOS=\"$BUILD_DOS\"" >>$FTECONFIG echo "BUILD_MSVC=\"$BUILD_MSVC\"" >>$FTECONFIG echo "BUILD_ANDROID=\"$BUILD_ANDROID\"" >>$FTECONFIG @@ -270,7 +273,7 @@ if [ "$BUILD_SDL" == "y" ]; then debianpackages libSDL1.2-dev libSDL2-dev libspeex-dev libspeexdsp-dev || otherpackages || exit fi -if [ "$BUILD_WINDOWS" == "y" ]; then +if [ "$BUILD_WIN32" == "y" ] || [ "$BUILD_WIN64" == "y" ]; then #for building windows targets #python is needed to configure scintilla properly. debianpackages mingw-w64 python || otherpackages x86_64-w64-mingw32-gcc python || exit @@ -395,15 +398,19 @@ if [ $UID -ne 0 ] && [ $REBUILD_TOOLCHAINS == "y" ]; then echo "Making libraries (linux armhf)..." make FTE_TARGET=linuxarmhf makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null fi - if [ "$BUILD_WINDOWS" == "y" ]; then - echo "Making libraries (linux armhf)..." + if [ "$BUILD_WIN32" == "y" ]; then + echo "Making libraries (win32)..." make FTE_TARGET=win32 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null - echo "Making libraries (linux armhf)..." + fi + if [ "$BUILD_WIN64" == "y" ]; then + echo "Making libraries (win64)..." make FTE_TARGET=win64 makelibs CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null fi - if [ "$BUILD_WINDOWS" == "y" ] && [[ "$PLUGINS_WINDOWS" =~ "ode" ]]; then + if [ "$BUILD_WIN32" == "y" ] && [[ "$PLUGINS_WINDOWS" =~ "ode" ]]; then echo "Prebuilding ODE library (win32)..." make FTE_TARGET=win32 plugins-rel NATIVE_PLUGINS=ode 2>&1 >>/dev/null + fi + if [ "$BUILD_WIN64" == "y" ] && [[ "$PLUGINS_WINDOWS" =~ "ode" ]]; then echo "Prebuilding ODE library (win64)..." make FTE_TARGET=win64 plugins-rel NATIVE_PLUGINS=ode 2>&1 >>/dev/null fi @@ -415,9 +422,11 @@ if [ $UID -ne 0 ] && [ $REBUILD_TOOLCHAINS == "y" ]; then echo "Prebuilding ODE library (linux x86_64)..." make FTE_TARGET=linux64 plugins-rel NATIVE_PLUGINS=ode CPUOPTIMISATIONS=-fno-finite-math-only 2>&1 >>/dev/null fi - if [ "$BUILD_WINDOWS" == "y" ]; then + if [ "$BUILD_WIN32" == "y" ]; then echo "Obtaining ffmpeg library (win32)..." make FTE_TARGET=win32 plugins-rel NATIVE_PLUGINS=ffmpeg 2>&1 >>/dev/null + fi + if [ "$BUILD_WIN64" == "y" ]; then echo "Obtaining ffmpeg library (win64)..." make FTE_TARGET=win64 plugins-rel NATIVE_PLUGINS=ffmpeg 2>&1 >>/dev/null fi diff --git a/build_wip.sh b/build_wip.sh index fd183f45f..2165a3b4c 100755 --- a/build_wip.sh +++ b/build_wip.sh @@ -16,7 +16,8 @@ BUILDLOGFOLDER=$BUILDFOLDER/build_logs SVNROOT=$BASE/fteqw-code BUILD_LINUXx86=y BUILD_LINUXx64=y -BUILD_WINDOWS=y +BUILD_WIN32=y +BUILD_WIN64=y BUILD_ANDROID=y BUILD_WEB=y PLUGINS_LINUXx86="qi ezhud xmpp irc" @@ -88,8 +89,10 @@ fi cd $SVNROOT/ -echo "SVN Update" -svn update +if [ "$BUILD_CLEAN" != "n" ]; then + echo "SVN Update" + svn update +fi cd engine @@ -101,7 +104,9 @@ function build { NAME=$1 DEST=$2 shift; shift - make clean >> /dev/null + if [ "$BUILD_CLEAN" != "n" ]; then + make clean >> /dev/null + fi echo -n "Making $NAME... " date > $BUILDLOGFOLDER/$DEST.txt echo make $THREADS $* >> $BUILDLOGFOLDER/$DEST.txt 2>&1 @@ -148,8 +153,10 @@ fi if [ "$BUILD_CYGWIN" != "n" ]; then NATIVE_PLUGINS="qi ezhud" build "Cygwin" cygwin qcc-rel rel dbg plugins-rel plugins-dbg fi -if [ "$BUILD_WINDOWS" != "n" ]; then +if [ "$BUILD_WIN32" != "n" ]; then NATIVE_PLUGINS="$PLUGINS_WINDOWS" build "Windows 32-bit" win32 FTE_TARGET=win32 CFLAGS="$WARNINGLEVEL" $TARGETS_WINDOWS +fi +if [ "$BUILD_WIN64" != "n" ]; then NATIVE_PLUGINS="$PLUGINS_WINDOWS" build "Windows 64-bit" win64 FTE_TARGET=win64 CFLAGS="$WARNINGLEVEL" $TARGETS_WINDOWS fi if [ "$BUILD_MSVC" != "n" ]; then @@ -160,7 +167,7 @@ export NATIVE_PLUGINS="qi ezhud xmpp irc" if [ "$BUILD_ANDROID" != "n" ]; then NATIVE_PLUGINS="$PLUGINS_DROID" build "Android" android droid-rel fi -#if [ "$BUILD_WINDOWS" != "n" ]; then +#if [ "$BUILD_WIN32" != "n" ]; then # build "NPFTE" npfte npfte-rel #fi if [ "$BUILD_DOS" == "y" ]; then @@ -178,11 +185,13 @@ fi if [ "$BUILD_LINUX" != "n" ] && [ "$BUILD_SDL" != "n" ] && [ "$(uname -m)" == "x86_64" ]; then build "Linux 64-bit (SDL)" linux_amd64_sdl FTE_TARGET=SDL BITS=64 LDFLAGS="-Llibs/64" LTO=1 fi -if [ "$BUILD_WINDOWS" != "n" ] && [ "$BUILD_SDL" != "n" ]; then +if [ "$BUILD_WIN32" != "n" ] && [ "$BUILD_SDL" != "n" ]; then build "Windows 32-bit (SDL)" win32_sdl FTE_TARGET=win32_SDL gl-rel mingl-rel - build "Windows 64-bit (SDL)" win64_sdl FTE_TARGET=win64_SDL LDFLAGS="-L./libs/mingw64-libs/" gl-rel mingl-rel CFLAGS="$WARNINGLEVEL -DNOLEGACY -DOMIT_QCC" build "Windows 32-bit nocompat" nocompat FTE_TARGET=win32 LTO=1 NOCOMPAT=1 BOTLIB_CFLAGS="" BOTLIB_OBJS="" gl-rel m-rel -k fi +if [ "$BUILD_WIN64" != "n" ] && [ "$BUILD_SDL" != "n" ]; then + build "Windows 64-bit (SDL)" win64_sdl FTE_TARGET=win64_SDL LDFLAGS="-L./libs/mingw64-libs/" gl-rel mingl-rel +fi if [ "$BUILD_NACL" != "n" ]; then #non-pnacl is supported ONLY in chrome's store crap, but pnacl works anywhere. # build "Native Client 64-bit" nacl_amd64 FTE_TARGET=nacl NARCH=x86_64 gl-rel @@ -202,51 +211,65 @@ fi if [ "$BUILD_WEB" != "n" ]; then cp $BASE/3rdparty/web/* $BUILDFOLDER/web/ fi -if [ "$BUILD_WINDOWS" != "n" ]; then - cp $BASE/3rdparty/win32/3rdparty.zip $BUILDFOLDER/win32/3rdparty.zip - cp $BASE/3rdparty/win64/3rdparty.zip $BUILDFOLDER/win64/3rdparty.zip +if [ "$BUILD_WIN32" != "n" ]; then + if [ -e "$BASE/3rdparty/win32/3rdparty.zip" ]; then + cp $BASE/3rdparty/win32/3rdparty.zip $BUILDFOLDER/win32/3rdparty.zip + else + rm -f $BUILDFOLDER/win32/3rdparty.zip + fi if [ "$BUILD_SDL" != "n" ]; then cp $SVNROOT/engine/libs/SDL2-2.0.1/i686-w64-mingw32/bin/SDL2.dll $BUILDFOLDER/win32_sdl + fi +fi +if [ "$BUILD_WIN64" != "n" ]; then + if [ -e "$BASE/3rdparty/win64/3rdparty.zip" ]; then + cp $BASE/3rdparty/win64/3rdparty.zip $BUILDFOLDER/win64/3rdparty.zip + else + rm -f $BUILDFOLDER/win64/3rdparty.zip + fi + if [ "$BUILD_SDL" != "n" ]; then cp $SVNROOT/engine/libs/SDL2-2.0.1/x86_64-w64-mingw32/bin/SDL2.dll $BUILDFOLDER/win64_sdl fi +fi +if [ -e "$HOME/nocompat_readme.html" ]; then cp $HOME/nocompat_readme.html $BUILDFOLDER/nocompat/README.html fi -echo "--- QC builds ---" -rm -rf $QCCBUILDFOLDER 2>&1 -mkdir -p $QCCBUILDFOLDER #this really should use the native cpu type... until then we use 32bit in case anyone's still using a 32bit kernel. -if [ -e "$BUILDFOLDER/linux_x86/fteqw32" ] -then - echo "Making fteextensions.qc" - mkdir -p ~/.fte/fte - echo "pr_dumpplatform -o fteextensions" > ~/.fte/fte/minusargsaresilly.cfg - echo "pr_dumpplatform -o csqcsysdefs -Tcs" >> ~/.fte/fte/minusargsaresilly.cfg - echo "pr_dumpplatform -o menusysdefs -Tmenu" >> ~/.fte/fte/minusargsaresilly.cfg - $BUILDFOLDER/linux_x86/fteqw32 -basedir ~/.fte -nohome -quake +set snd_device none -nosound +set vid_renderer sv +exec minusargsaresilly.cfg +quit >> /dev/null - mv ~/.fte/fte/src/fteextensions.qc $QCCBUILDFOLDER - mv ~/.fte/fte/src/csqcsysdefs.qc $QCCBUILDFOLDER - mv ~/.fte/fte/src/menusysdefs.qc $QCCBUILDFOLDER -else - echo "Skipping FTE Extensions, no Linux x86 (merged) build located" -fi +if [ "$BUILD_LINUXx32" != "n" ]; then + echo "--- QC builds ---" + rm -rf $QCCBUILDFOLDER 2>&1 + mkdir -p $QCCBUILDFOLDER + if [ -e "$BUILDFOLDER/linux_x86/fteqw32" ]; then + echo "Making fteextensions.qc" + mkdir -p ~/.fte/fte + echo "pr_dumpplatform -o fteextensions" > ~/.fte/fte/minusargsaresilly.cfg + echo "pr_dumpplatform -o csqcsysdefs -Tcs" >> ~/.fte/fte/minusargsaresilly.cfg + echo "pr_dumpplatform -o menusysdefs -Tmenu" >> ~/.fte/fte/minusargsaresilly.cfg + $BUILDFOLDER/linux_x86/fteqw32 -basedir ~/.fte -nohome -quake +set snd_device none -nosound +set vid_renderer sv +exec minusargsaresilly.cfg +quit >> /dev/null + mv ~/.fte/fte/src/fteextensions.qc $QCCBUILDFOLDER + mv ~/.fte/fte/src/csqcsysdefs.qc $QCCBUILDFOLDER + mv ~/.fte/fte/src/menusysdefs.qc $QCCBUILDFOLDER + else + echo "Skipping FTE Extensions, no Linux x86 (merged) build located" + fi + if [ -e $BUILDFOLDER/linux_x86/fteqcc32 ]; then + echo "Making csaddon + qcmenu" + mkdir -p $BUILDFOLDER/csaddon/ + cd $SVNROOT/quakec + cd csaddon/src + $BUILDFOLDER/linux_x86/fteqcc32 -srcfile csaddon.src > $BUILDLOGFOLDER/csaddon.txt + mv ../csaddon.dat $BUILDFOLDER/csaddon/ -if [ -e $BUILDFOLDER/linux_x86/fteqcc32 ]; then - echo "Making csaddon + qcmenu" - mkdir -p $BUILDFOLDER/csaddon/ - cd $SVNROOT/quakec - cd csaddon/src - $BUILDFOLDER/linux_x86/fteqcc32 -srcfile csaddon.src > $BUILDLOGFOLDER/csaddon.txt - mv ../csaddon.dat $BUILDFOLDER/csaddon/ - - cd ../../menusys - $BUILDFOLDER/linux_x86/fteqcc32 -srcfile menu.src > $BUILDLOGFOLDER/menu.txt - rm fteqcc.log - zip -q -9 -o -r $BUILDFOLDER/csaddon/menusys_src.zip . - mv ../menu.dat $BUILDFOLDER/csaddon/ -else - echo "Skiping csaddon + qcmenu, no compiler build" + cd ../../menusys + $BUILDFOLDER/linux_x86/fteqcc32 -srcfile menu.src > $BUILDLOGFOLDER/menu.txt + rm -f fteqcc.log + zip -q -9 -o -r $BUILDFOLDER/csaddon/menusys_src.zip . + mv ../menu.dat $BUILDFOLDER/csaddon/ + else + echo "Skiping csaddon + qcmenu, no compiler build" + fi fi cd $SVNROOT/engine/ @@ -264,9 +287,11 @@ fi if [ "$BUILD_LINUXarmhf" != "n" ]; then cp $BUILDFOLDER/linux_armhf/fteqccarmhf $QCCBUILDFOLDER/linuxarmhf-fteqcc fi -if [ "$BUILD_WINDOWS" != "n" ]; then +if [ "$BUILD_WIN32" != "n" ]; then cp $BUILDFOLDER/win32/fteqcc.exe $QCCBUILDFOLDER/win32-fteqcc.exe cp $BUILDFOLDER/win32/fteqccgui.exe $QCCBUILDFOLDER/win32-fteqccgui.exe +fi +if [ "$BUILD_WIN64" != "n" ]; then cp $BUILDFOLDER/win64/fteqcc64.exe $QCCBUILDFOLDER/win64-fteqcc.exe cp $BUILDFOLDER/win64/fteqccgui64.exe $QCCBUILDFOLDER/win64-fteqccgui.exe fi @@ -299,7 +324,7 @@ if [ "$BUILD_NACL" != "n" ]; then rm -rf "$BUILDFOLDER/nacl_portable" fi -if [ "$BUILD_WINDOWS" != "n" ]; then +if [ "$BUILD_WIN32" != "n" ] && [ "$BUILD_WIN64" != "n" ]; then echo Archiving output SVNVER=$(svnversion $SVNROOT) cd $BUILDFOLDER/ diff --git a/engine/Makefile b/engine/Makefile index 0e3c5fc9b..62e6d87e9 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -1088,7 +1088,6 @@ endif #FTE_TARGET=win32_SDL | FTE_TARGET=win64_SDL (MinGW32 + SDL | MinGW64 + SDL) ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET))) - LIBS_DIR=./libs DO_CMAKE+=-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="NEVER" ifneq (,$(findstring win64,$(FTE_TARGET))) @@ -1296,7 +1295,6 @@ ifeq (win,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET))) QTV_LDFLAGS=-lws2_32 -lwinmm - LIBS_DIR = $(BASE_DIR)/libs SV_EXE_NAME=../$(EXE_NAME)sv$(BITS)$(EXEPOSTFIX) SV_LDFLAGS=-lws2_32 -lwinmm SV_DIR=sv_mingw$(BITS) @@ -1602,8 +1600,6 @@ ifeq ($(FTE_TARGET),cyg) MB_DIR=m_cygwin MCL_DIR=mcl_cygwin - LIBS_DIR = $(BASE_DIR)/libs - MINGL_EXE_NAME=../$(EXE_NAME)-cyg-mingl$(EXEPOSTFIX) MINGL_DIR=mingl_cygwin endif diff --git a/engine/client/image.c b/engine/client/image.c index 537b851bf..f65eeba15 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -1520,7 +1520,10 @@ qbyte *ReadPNGFile(const char *fname, qbyte *buf, int length, int *width, int *h struct pngerr errctx; if (!LibPNG_Init()) + { + Con_Printf("libpng not loaded\n"); return NULL; + } memcpy(header, buf, 8); @@ -1533,21 +1536,25 @@ error: if (rowpointers) BZ_Free(rowpointers); qpng_destroy_read_struct(&png, &pnginfo, NULL); + Con_Printf("libpng error\n"); return NULL; } if (qpng_sig_cmp(header, 0, 8)) { + Con_Printf("libpng signature mismatch\n"); //we already checked the first four bytes so this shouldn't be spammy return NULL; } if (!(png = qpng_create_read_struct(PNG_LIBPNG_VER_STRING, &errctx, png_onerror, png_onwarning))) { + Con_Printf("png_create_read_struct failed\n"); //we already checked the first four bytes so this shouldn't be spammy return NULL; } if (!(pnginfo = qpng_create_info_struct(png))) { + Con_Printf("png_create_info_struct failed\n"); //we already checked the first four bytes so this shouldn't be spammy qpng_destroy_read_struct(&png, &pnginfo, NULL); return NULL; } @@ -1911,16 +1918,11 @@ err: #ifdef AVAIL_JPEGLIB #define XMD_H //fix for mingw -#if defined(MINGW) - #define JPEG_API VARGS - #include "./mingw-libs/jpeglib.h" - #include "./mingw-libs/jerror.h" -#elif defined(_WIN32) +#if defined(_MSC_VER) #define JPEG_API VARGS #include "jpeglib.h" #include "jerror.h" #else -// #include #include #include #endif diff --git a/engine/common/common.c b/engine/common/common.c index 52a1dd1ed..9c89cb6aa 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -43,14 +43,7 @@ fte_inlinebody float M_LinearToSRGB(float x, float mag); // These 4 libraries required for the version command -#if defined(MINGW) - #ifdef AVAIL_ZLIB - #include "./mingw-libs/zlib.h" - #endif - #ifdef FTE_SDL - #include - #endif -#elif defined(_WIN32) +#if defined(_MSC_VER) #ifdef AVAIL_ZLIB #include "zlib.h" #endif