From 63a8f40e67d74575af505e16b44230607c10a17a Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 14 Jul 2026 00:59:01 +0300 Subject: [PATCH] ports/quake2: Clenaup build script and patches --- ports/quake2/build.sh | 12 ++-- ...custom-SDL-path-and-add-sound-suppor.patch | 52 --------------- ...1-cleanup-makefile-for-cross-compile.patch | 66 +++++++++++++++++++ .../patches/0002-fix-socket-creation.patch | 42 ------------ 4 files changed, 73 insertions(+), 99 deletions(-) delete mode 100644 ports/quake2/patches/0001-add-support-for-custom-SDL-path-and-add-sound-suppor.patch create mode 100644 ports/quake2/patches/0001-cleanup-makefile-for-cross-compile.patch delete mode 100644 ports/quake2/patches/0002-fix-socket-creation.patch diff --git a/ports/quake2/build.sh b/ports/quake2/build.sh index 995a28f8..65d9b9fa 100755 --- a/ports/quake2/build.sh +++ b/ports/quake2/build.sh @@ -10,8 +10,13 @@ configure() { } build() { - baseq2_tar=../baseq2.tar.gz - baseq2_hash=9660c306d9440ff7d534f165ae4a7f550b9e879d5190830953034ebda10e873a + local cflags='-Dstricmp=strcasecmp -O2 -ffast-math -Wno-incompatible-pointer-types -Wno-pointer-to-int-cast' + make -j$(nproc) createdirs build/quake2-soft CC="$CC" CFLAGS="$cflags" SDL_PREFIX="$BANAN_SYSROOT/usr/bin/" || exit 1 +} + +pre_install() { + local baseq2_tar='../baseq2.tar.gz' + local baseq2_hash='9660c306d9440ff7d534f165ae4a7f550b9e879d5190830953034ebda10e873a' if [ -f $baseq2_tar ]; then if ! echo "$baseq2_hash $baseq2_tar" | sha256sum --check >/dev/null; then @@ -25,9 +30,6 @@ build() { echo "File hash does not match" >&2 exit 1 fi - - cflags='-Dstricmp=strcasecmp -O3 -ffast-math -Wno-incompatible-pointer-types -Wno-pointer-to-int-cast' - make CC="$CC" CFLAGS="$cflags" SDL_PATH="$BANAN_SYSROOT/usr/bin/" -j$(nproc) createdirs build/quake2-soft || exit 1 } install() { diff --git a/ports/quake2/patches/0001-add-support-for-custom-SDL-path-and-add-sound-suppor.patch b/ports/quake2/patches/0001-add-support-for-custom-SDL-path-and-add-sound-suppor.patch deleted file mode 100644 index ed2f0294..00000000 --- a/ports/quake2/patches/0001-add-support-for-custom-SDL-path-and-add-sound-suppor.patch +++ /dev/null @@ -1,52 +0,0 @@ -From fd08d90bb7ee8388a9e005bae23edcccbfc73dbb Mon Sep 17 00:00:00 2001 -From: Oskari Alaranta -Date: Sun, 10 Aug 2025 19:52:20 +0300 -Subject: [PATCH] add support for custom SDL path and add sound support - ---- - Makefile | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/Makefile b/Makefile -index 8edbffa..de2f605 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - --SDL_CFLAGS = `sdl2-config --cflags` --SDL_LIBS = `sdl2-config --cflags --libs` -lSDL2_mixer -+SDL_CFLAGS = `$(SDL_PATH)sdl2-config --cflags` -+SDL_LIBS = `$(SDL_PATH)sdl2-config --cflags --libs` -lSDL2_mixer - - MOUNT_DIR=. - -@@ -124,7 +124,7 @@ QUAKE2_OBJS = \ - \ - $(BUILDDIR)/net/net_unix.o \ - \ -- $(BUILDDIR)/sound/snddma_null.o \ -+ $(BUILDDIR)/sound/snd_sdl.o \ - \ - $(BUILDDIR)/port_platform_unix.o - -@@ -353,7 +353,7 @@ $(BUILDDIR)/client/vid_menu.o : $(OTHER_DIR)/vid_menu.c - $(BUILDDIR)/client/vid_lib.o : $(OTHER_DIR)/vid_lib.c - $(DO_CC) - --$(BUILDDIR)/client/snddma_null.o : $(NULL_DIR)/snddma_null.c -+$(BUILDDIR)/client/snd_sdl.o : $(NULL_DIR)/snd_sdl.c - $(DO_CC) - - $(BUILDDIR)/client/q_system.o : $(OTHER_DIR)/q_system.c -@@ -368,7 +368,7 @@ $(BUILDDIR)/net/net_unix.o : $(NET_DIR)/net_unix.c - $(BUILDDIR)/port_platform_unix.o : $(MOUNT_DIR)/port_platform_unix.c - $(DO_CC) - --$(BUILDDIR)/sound/snddma_null.o : $(SOUND_DIR)/snddma_null.c -+$(BUILDDIR)/sound/snd_sdl.o : $(SOUND_DIR)/snd_sdl.c - $(DO_GL_SHLIB_CC) - - --- -2.50.1 - diff --git a/ports/quake2/patches/0001-cleanup-makefile-for-cross-compile.patch b/ports/quake2/patches/0001-cleanup-makefile-for-cross-compile.patch new file mode 100644 index 00000000..261f267d --- /dev/null +++ b/ports/quake2/patches/0001-cleanup-makefile-for-cross-compile.patch @@ -0,0 +1,66 @@ +From e93c43f5c55e67cd3fb79bc890d698492cb5861d Mon Sep 17 00:00:00 2001 +From: Oskari Alaranta +Date: Mon, 13 Jul 2026 23:05:59 +0300 +Subject: [PATCH] cleanup-makefile-for-cross-compile + +--- + Makefile | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/Makefile b/Makefile +index 8edbffa..88709bd 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + +-SDL_CFLAGS = `sdl2-config --cflags` +-SDL_LIBS = `sdl2-config --cflags --libs` -lSDL2_mixer ++SDL_CFLAGS = `$(SDL_PREFIX)sdl2-config --cflags` ++SDL_LIBS = `$(SDL_PREFIX)sdl2-config --cflags --libs` -lSDL2_mixer + + MOUNT_DIR=. + +@@ -28,10 +28,9 @@ RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -ffast-math -funroll-loops \ + + DEBUG_CFLAGS=$(BASE_CFLAGS) -g + LDFLAGS=-ldl -lm +-XCFLAGS=-I/opt/X11/include ++XCFLAGS= + +-GLLDFLAGS=-L/usr/X11/lib -L/usr/local/lib \ +- $(SDL_LIBS) -lGL ++GLLDFLAGS=$(SDL_LIBS) -lGL + GLCFLAGS=$(SDL_CFLAGS) + + SHLIBEXT=so +@@ -124,7 +123,7 @@ QUAKE2_OBJS = \ + \ + $(BUILDDIR)/net/net_unix.o \ + \ +- $(BUILDDIR)/sound/snddma_null.o \ ++ $(BUILDDIR)/sound/snd_sdl.o \ + \ + $(BUILDDIR)/port_platform_unix.o + +@@ -227,7 +226,7 @@ REF_GL_OBJS = \ + + + $(BUILDDIR)/quake2-soft : $(QUAKE2_OBJS) $(GAME_OBJS) $(REF_SOFT_OBJS) $(REF_SOFT_SDL_OBJS) +- $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(GAME_OBJS) $(REF_SOFT_OBJS) $(REF_SOFT_SDL_OBJS) $(LDFLAGS) $(GLLDFLAGS) ++ $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(GAME_OBJS) $(REF_SOFT_OBJS) $(REF_SOFT_SDL_OBJS) $(LDFLAGS) $(SDL_LIBS) + + $(BUILDDIR)/quake2-gl : $(QUAKE2_OBJS) $(GAME_OBJS) $(REF_GL_OBJS) + $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(GAME_OBJS) $(REF_GL_OBJS) $(LDFLAGS) $(GLLDFLAGS) +@@ -368,6 +367,9 @@ $(BUILDDIR)/net/net_unix.o : $(NET_DIR)/net_unix.c + $(BUILDDIR)/port_platform_unix.o : $(MOUNT_DIR)/port_platform_unix.c + $(DO_CC) + ++$(BUILDDIR)/sound/snd_sdl.o : $(SOUND_DIR)/snd_sdl.c ++ $(DO_GL_SHLIB_CC) ++ + $(BUILDDIR)/sound/snddma_null.o : $(SOUND_DIR)/snddma_null.c + $(DO_GL_SHLIB_CC) + +-- +2.55.0 + diff --git a/ports/quake2/patches/0002-fix-socket-creation.patch b/ports/quake2/patches/0002-fix-socket-creation.patch deleted file mode 100644 index 961ffc3e..00000000 --- a/ports/quake2/patches/0002-fix-socket-creation.patch +++ /dev/null @@ -1,42 +0,0 @@ -From fbdf3e7c40c1de83a2361bb904d8dbd3464ccebd Mon Sep 17 00:00:00 2001 -From: Oskari Alaranta -Date: Sun, 10 Aug 2025 19:54:38 +0300 -Subject: [PATCH 2/2] fix socket creation - ---- - net/net_unix.c | 10 +--------- - 1 file changed, 1 insertion(+), 9 deletions(-) - -diff --git a/net/net_unix.c b/net/net_unix.c -index a92e57c..f297dff 100644 ---- a/net/net_unix.c -+++ b/net/net_unix.c -@@ -451,24 +451,16 @@ int NET_Socket (char *net_interface, int port) - qboolean _true = true; - int i = 1; - -- if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) -+ if ((newsocket = socket (PF_INET, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP)) == -1) - { - Com_Printf ("ERROR: UDP_OpenSocket: socket:", NET_ErrorString()); - return 0; - } - -- // make it non-blocking -- if (ioctl (newsocket, FIONBIO, &_true) == -1) -- { -- Com_Printf ("ERROR: UDP_OpenSocket: ioctl FIONBIO:%s\n", NET_ErrorString()); -- return 0; -- } -- - // make it broadcast capable - if (setsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i)) == -1) - { - Com_Printf ("ERROR: UDP_OpenSocket: setsockopt SO_BROADCAST:%s\n", NET_ErrorString()); -- return 0; - } - - if (!net_interface || !net_interface[0] || !stricmp(net_interface, "localhost")) --- -2.50.1 -