From 981b398b497a9bc68165693476c28ede9dcb68d5 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 13 May 2022 08:50:06 -0700 Subject: [PATCH] build_*.sh: minor adjustments for msys2 --- build_editor.sh | 65 ++++++++++++++++++++++++++++++++++++++++--------- build_engine.sh | 29 ++++++++++++++-------- 2 files changed, 72 insertions(+), 22 deletions(-) diff --git a/build_editor.sh b/build_editor.sh index b52352ea..0ba3b561 100755 --- a/build_editor.sh +++ b/build_editor.sh @@ -4,7 +4,15 @@ mv_wsfile() { if [ -f "./build/$1" ] -then + then + cp -v "./build/$1" "../../bin/$1" + fi +} + +mv_msysfile() +{ + if [ -f "./build/$1" ] + then cp -v "./build/$1" "../../bin/$1" fi } @@ -19,6 +27,7 @@ set -e WS_MAKEFILE=./src/worldspawn/Makefile COMPILE_SYS=$(uname) +COMPILE_OS=$(uname -o) # Check how many cores/processors we should use for building if ! [ -x "$(command -v nproc)" ] @@ -59,6 +68,18 @@ else fi fi +# GNU Make is _not_ make!... +if [ "$COMPILE_OS" = "Msys" ]; then + MAKE=make + WS_CC=cc + WS_CXX=c++ + WS_CFLAGS="$WS_CFLAGS -static-libgcc -static-libstdc++" + WS_LDFLAGS="$WS_LDFLAGS -lws2_32" + WS_LIB_EXT=dll +else + MAKE=gmake +fi + mkdir -p ./bin if [ -f "$WS_MAKEFILE" ] @@ -80,10 +101,11 @@ fi if [ "$BUILD_CLEAN" -eq 1 ] then - gmake clean + $MAKE clean fi -gmake -j $BUILD_PROC CC=$WS_CC CXX=$WS_CXX CFLAGS="$WS_CFLAGS" LDFLAGS="$WS_LDFLAGS" +$MAKE -j $BUILD_PROC CC=$WS_CC CXX=$WS_CXX CFLAGS="$WS_CFLAGS" LDFLAGS="$WS_LDFLAGS" LIB_EXT=$WS_LIB_EXT + mkdir -p ../../bin/bitmaps mv_wsfile defaultkeys.ini @@ -199,7 +221,33 @@ mv_wsfile gl/zfill_fp.glp mv_wsfile gl/zfill_fp.glsl mv_wsfile gl/zfill_vp.glp mv_wsfile gl/zfill_vp.glsl + +mkdir -p ../../bin/platform.game +mv_wsfile platform.game/default_build_menu.xml +mkdir -p ../../bin/platform.game/platform +mv_wsfile platform.game/platform/entities.def +mkdir -p ../../bin/goldsrc.game +mv_wsfile goldsrc.game/default_build_menu.xml + mkdir -p ../../bin/plugins +if [ "$COMPILE_OS" = "Msys" ]; then +mv_wsfile plugins/libarchivezip.dll +mv_wsfile plugins/libarchivepak.dll +mv_wsfile plugins/libarchivewad.dll +mv_wsfile plugins/libentity.dll +mv_wsfile plugins/libimage.dll +mv_wsfile plugins/libimagehl.dll +mv_wsfile plugins/libiqmmodel.dll +mv_wsfile plugins/libmapq3.dll +mv_wsfile plugins/libmodel.dll +mv_wsfile plugins/libshaders.dll +mv_wsfile plugins/libmatsys.dll +mv_wsfile plugins/libvfspk3.dll +mv_wsfile plugins/libbrushexport.dll +mv_wsfile plugins/libprtview.dll +mv_wsfile worldspawn.exe +mv_wsfile vmap.exe +else mv_wsfile plugins/libarchivezip.so mv_wsfile plugins/libarchivepak.so mv_wsfile plugins/libarchivewad.so @@ -214,15 +262,8 @@ mv_wsfile plugins/libmatsys.so mv_wsfile plugins/libvfspk3.so mv_wsfile plugins/libbrushexport.so mv_wsfile plugins/libprtview.so - -mkdir -p ../../bin/platform.game -mv_wsfile platform.game/default_build_menu.xml -mkdir -p ../../bin/platform.game/platform -mv_wsfile platform.game/platform/entities.def - -mkdir -p ../../bin/goldsrc.game -mv_wsfile goldsrc.game/default_build_menu.xml - mv_wsfile worldspawn mv_wsfile vmap +fi + printf "Built the editor successfully.\nInsert './worldspawn' to run.\n" diff --git a/build_engine.sh b/build_engine.sh index 0b728d4d..9c0c7bd6 100755 --- a/build_engine.sh +++ b/build_engine.sh @@ -11,6 +11,7 @@ set -e FTE_MAKEFILE=./src/engine/engine/Makefile COMPILE_SYS=$(uname) +COMPILE_OS=$(uname -o) # Check how many cores/processors we should use for building if ! [ -x "$(command -v nproc)" ] @@ -81,6 +82,14 @@ else fi fi +# GNU Make is _not_ make!... +if [ "$COMPILE_OS" = "Msys" ]; then + MAKE=make + PLATFORM=win64 +else + MAKE=gmake +fi + mkdir -p ./bin if [ -f "$FTE_MAKEFILE" ] @@ -116,32 +125,32 @@ fi if [ "$BUILD_CLEAN" -eq 1 ] then - gmake clean + $MAKE clean printf "Cleaned the build directory.\n\n" fi if [ "$BUILD_ENGINE_DEPENDENCIES" -eq 1 ] then - gmake -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX makelibs FTE_TARGET=$PLATFORM + $MAKE -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX makelibs FTE_TARGET=$PLATFORM printf "Built the static dependencies successfully.\n\n" fi -gmake -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX $MAKETARGET CFLAGS=-DMULTITHREAD FTE_TARGET=$PLATFORM +$MAKE -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX $MAKETARGET CFLAGS=-DMULTITHREAD FTE_TARGET=$PLATFORM cp -v "$OUTPUT" ../../../bin/fteqw printf "Built the client engine successfully.\n\n" -gmake -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX sv-dbg +$MAKE -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX sv-dbg cp -v ./debug/fteqw-sv ../../../bin/fteqw-sv printf "Built the dedicated server successfully.\n\n" -gmake -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX qcc-rel +$MAKE -j $BUILD_PROC CC=$ENGINE_CC CXX=$ENGINE_CXX qcc-rel cp -v ./release/fteqcc ../../../bin/fteqcc printf "Built the QuakeC compiler successfully.\n\n" if [ "$BUILD_IMGTOOL" -eq 1 ] then # Note: DOESN'T LIKE CLANG! - gmake -j $BUILD_PROC imgtool-rel + $MAKE -j $BUILD_PROC imgtool-rel cp -v ./release/imgtool ../../../bin/imgtool printf "Built the imgtool successfully.\n\n" fi @@ -149,28 +158,28 @@ fi if [ "$BUILD_SOURCE" -eq 1 ] then # Note: DOESN'T LIKE CLANG! - gmake -j $BUILD_PROC plugins-rel CFLAGS=-DGLQUAKE NATIVE_PLUGINS="hl2" + $MAKE -j $BUILD_PROC plugins-rel CFLAGS=-DGLQUAKE NATIVE_PLUGINS="hl2" find ./release/ -name 'fteplug_hl2_*.so' -exec cp -prv '{}' '../../../bin/' ';' printf "Built the Source Engine plugin successfully.\n\n" fi if [ "$BUILD_BULLET" -eq 1 ] then - CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="bullet" + CC=$ENGINE_CC CXX=$ENGINE_CXX $MAKE -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="bullet" find ./release/ -name 'fteplug_bullet_*.so' -exec cp -prv '{}' '../../../bin/' ';' printf "Built the bullet plugin successfully.\n\n" fi if [ "$BUILD_ODE" -eq 1 ] then - CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ode" + CC=$ENGINE_CC CXX=$ENGINE_CXX $MAKE -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ode" find ./release/ -name 'fteplug_ode_*.so' -exec cp -prv '{}' '../../../bin/' ';' printf "Built the ode plugin successfully.\n\n" fi if [ "$BUILD_FFMPEG" -eq 1 ] then - CC=$ENGINE_CC CXX=$ENGINE_CXX gmake -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ffmpeg" + CC=$ENGINE_CC CXX=$ENGINE_CXX $MAKE -j $BUILD_PROC plugins-rel NATIVE_PLUGINS="ffmpeg" find ./release/ -name 'fteplug_ffmpeg_*.so' -exec cp -prv '{}' '../../../bin/' ';' printf "Built the ffmpeg plugin successfully.\n\n" fi