From e592e300df65b33b81662a557e4044af21247d82 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Sun, 13 Oct 2024 13:07:20 +0300 Subject: [PATCH 1/5] dlls/extdll: fix standard header includes Signed-off-by: Jussi Kivilinna --- dlls/extdll.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/extdll.h b/dlls/extdll.h index b42abc0..1cbc657 100644 --- a/dlls/extdll.h +++ b/dlls/extdll.h @@ -56,9 +56,9 @@ #endif // Misc C-runtime library headers -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +#include +#include +#include // Header file containing definition of globalvars_t and entvars_t typedef int func_t; // From fe829e020ce6624ecab16016bce302e1683bd95f Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Sun, 13 Oct 2024 12:56:58 +0300 Subject: [PATCH 2/5] workflow: clean up after build Signed-off-by: Jussi Kivilinna --- .github/workflows/ccpp.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 88349db..0537985 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -15,5 +15,9 @@ jobs: run: sudo apt-get -y install build-essential g++-multilib gcc-mingw-w64 - name: make run: make + - name: cleanup 1 + run: git clean -xdf - name: make win32 run: make OSTYPE=win32 + - name: cleanup 2 + run: git clean -xdf From 01f4eb797872bf311cf7a9963e05935c975f3591 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Sun, 13 Oct 2024 12:43:05 +0300 Subject: [PATCH 3/5] Makefile: remove trailing whitespace Signed-off-by: Jussi Kivilinna --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a7c28d6..05408af 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ## ## compiling under ubuntu: -## for compiling linux: make +## for compiling linux: make ## for compiling win32: make OSTYPE=win32 ## @@ -41,7 +41,7 @@ INCLUDES = -I"./metamod" \ -I"./pm_shared" CFLAGS = ${BASEFLAGS} ${OPTFLAGS} ${ARCHFLAG} ${INCLUDES} -CPPFLAGS = -fno-rtti -fno-exceptions ${CFLAGS} +CPPFLAGS = -fno-rtti -fno-exceptions ${CFLAGS} SRC = bot.cpp \ bot_chat.cpp \ @@ -66,7 +66,7 @@ SRC = bot.cpp \ OBJ = $(SRC:%.cpp=%.o) -${TARGET}${DLLEND}: zlib/libz.a ${OBJ} +${TARGET}${DLLEND}: zlib/libz.a ${OBJ} ${CPP} -o $@ ${OBJ} zlib/libz.a ${LINKFLAGS} cp $@ addons/jk_botti/dlls/ @@ -74,7 +74,7 @@ zlib/libz.a: (cd zlib; AR="${AR}" RANLIB="${RANLIB}" CC="${CPP} ${OPTFLAGS} ${ARCHFLAG} ${ZLIB_OSFLAGS} -DASMV" ./configure; $(MAKE) OBJA=match.o; cd ..) clean: - rm -f *.o ${TARGET}${DLLEND} Rules.depend zlib/*.exe + rm -f *.o ${TARGET}${DLLEND} Rules.depend zlib/*.exe (cd zlib; $(MAKE) clean; cd ..) rm -f zlib/Makefile From 41424a668997dfc6cea629dfe831f93d5c8320b3 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Sun, 13 Oct 2024 12:52:16 +0300 Subject: [PATCH 4/5] Makefile: use sane compiler flags for old C/C++ code (no lto, no unsafe math, no strict aliasing, no strict overflow) Signed-off-by: Jussi Kivilinna --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 05408af..04c3fac 100644 --- a/Makefile +++ b/Makefile @@ -23,15 +23,13 @@ endif TARGET = jk_botti_mm BASEFLAGS = -Wall -Wno-write-strings +BASEFLAGS += -fno-strict-aliasing -fno-strict-overflow ARCHFLAG += -march=i686 -mtune=generic -msse -msse2 -msse3 ifeq ($(DBG_FLGS),1) OPTFLAGS = -O0 -g else OPTFLAGS = -O2 -fomit-frame-pointer -g - OPTFLAGS += -funsafe-math-optimizations - LTOFLAGS = -flto -fvisibility=hidden - LINKFLAGS += ${OPTFLAGS} ${LTOFLAGS} endif INCLUDES = -I"./metamod" \ @@ -89,10 +87,10 @@ distclean: # ${CPP} ${CPPFLAGS} -funroll-loops -c $< -o $@ %.o: %.cpp - ${CPP} ${CPPFLAGS} ${LTOFLAGS} -c $< -o $@ + ${CPP} ${CPPFLAGS} -c $< -o $@ %.o: %.c - ${CPP} ${CFLAGS} ${LTOFLAGS} -c $< -o $@ + ${CPP} ${CFLAGS} -c $< -o $@ depend: Rules.depend From edf280df63b4b88e71c7d5b5be8e336106d81991 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Sun, 13 Oct 2024 13:07:03 +0300 Subject: [PATCH 5/5] Makefile: use g++ for C++ source files and gcc for C source files Signed-off-by: Jussi Kivilinna --- .github/workflows/ccpp.yml | 2 +- Makefile | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 0537985..bfefcd0 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -12,7 +12,7 @@ jobs: - name: Update package list for i386 run: sudo dpkg --add-architecture i386 && sudo apt-get -y update - name: Install packages - run: sudo apt-get -y install build-essential g++-multilib gcc-mingw-w64 + run: sudo apt-get -y install build-essential g++-multilib gcc-mingw-w64 g++-mingw-w64 - name: make run: make - name: cleanup 1 diff --git a/Makefile b/Makefile index 04c3fac..8008a3d 100644 --- a/Makefile +++ b/Makefile @@ -5,14 +5,16 @@ ## ifeq ($(OSTYPE),win32) - CPP = i686-w64-mingw32-gcc -m32 + CPP = i686-w64-mingw32-g++ -m32 + CC = i686-w64-mingw32-gcc -m32 AR = i686-w64-mingw32-ar rc RANLIB = i686-w64-mingw32-ranlib LINKFLAGS = -mdll -lm -lwsock32 -lws2_32 -Xlinker --add-stdcall-alias -s DLLEND = .dll ZLIB_OSFLAGS = else - CPP = gcc -m32 + CPP = g++ -m32 + CC = gcc -m32 AR = ar rc RANLIB = ranlib ARCHFLAG = -fPIC @@ -65,11 +67,11 @@ SRC = bot.cpp \ OBJ = $(SRC:%.cpp=%.o) ${TARGET}${DLLEND}: zlib/libz.a ${OBJ} - ${CPP} -o $@ ${OBJ} zlib/libz.a ${LINKFLAGS} + ${CC} -o $@ ${OBJ} zlib/libz.a ${LINKFLAGS} cp $@ addons/jk_botti/dlls/ zlib/libz.a: - (cd zlib; AR="${AR}" RANLIB="${RANLIB}" CC="${CPP} ${OPTFLAGS} ${ARCHFLAG} ${ZLIB_OSFLAGS} -DASMV" ./configure; $(MAKE) OBJA=match.o; cd ..) + (cd zlib; AR="${AR}" RANLIB="${RANLIB}" CC="${CC} ${OPTFLAGS} ${ARCHFLAG} ${ZLIB_OSFLAGS} -DASMV" ./configure; $(MAKE) OBJA=match.o; cd ..) clean: rm -f *.o ${TARGET}${DLLEND} Rules.depend zlib/*.exe