git: 6e62185f45b1 - main - games/q3cellshading: cleanup release CFLAGS, take maintainership

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Tue, 28 Nov 2023 14:36:02 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6e62185f45b19d999bbca544969ae9aad563b904

commit 6e62185f45b19d999bbca544969ae9aad563b904
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2023-11-28 14:34:12 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2023-11-28 14:34:12 +0000

    games/q3cellshading: cleanup release CFLAGS, take maintainership
    
    Since we already patch the Makefile, it makes little sense to fix
    it up again in the `post-patch' target.
---
 games/q3cellshading/Makefile                       |  14 +--
 games/q3cellshading/files/patch-code-unix-Makefile | 109 +++++++++++----------
 2 files changed, 61 insertions(+), 62 deletions(-)

diff --git a/games/q3cellshading/Makefile b/games/q3cellshading/Makefile
index 0587ac175a64..545358c1958f 100644
--- a/games/q3cellshading/Makefile
+++ b/games/q3cellshading/Makefile
@@ -5,7 +5,7 @@ CATEGORIES=	games
 MASTER_SITES=	SF
 DISTNAME=	q3cel-${PORTVERSION}-src
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	danfe@FreeBSD.org
 COMMENT=	Quake III engine with Cell Shading capabilities
 WWW=		https://q3cellshading.sourceforge.net/
 
@@ -15,7 +15,7 @@ BROKEN=	ld: error: duplicate symbol: re
 ONLY_FOR_ARCHS=	i386
 ONLY_FOR_ARCHS_REASON=	does not run properly; try games/ioquake3 with option
 
-USES=		compiler dos2unix gmake zip
+USES=		gmake zip
 
 MAKE_ENV=	LIBDIR="${LIBDIR}"
 MAKE_JOBS_UNSAFE=	yes
@@ -74,8 +74,6 @@ USE_XORG=	xxf86dga xxf86vm
 MAKE_ENV+=	GAMELIBS=YES
 .endif
 
-.include <bsd.port.pre.mk>
-
 post-patch:
 	@${REINPLACE_CMD} -e 's|botlib\.log|/dev/null|' \
 		${WRKSRC}/code/botlib/be_interface.c
@@ -83,10 +81,6 @@ post-patch:
 		's|//[[:blank:]]*\(Swap_Init[[:blank:]]*();\)|\1|' \
 		${WRKSRC}/code/botlib/be_interface.c \
 		${WRKSRC}/code/renderer/tr_init.c
-.if ${COMPILER_TYPE} == clang
-	@${REINPLACE_CMD} -E 's,-falign-(jumps|loops)=2,,g; s|-O6||' \
-		${WRKSRC}/code/unix/Makefile
-.endif
 
 do-install:
 .for bin in ${Q3BIN}
@@ -103,4 +97,6 @@ do-install:
 .endif
 
 .include "${.CURDIR}/../quake3-data/Makefile.include"
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
+
+PATCH_ARGS+=	-l
diff --git a/games/q3cellshading/files/patch-code-unix-Makefile b/games/q3cellshading/files/patch-code-unix-Makefile
index e6d174109b7a..0c197e23fe36 100644
--- a/games/q3cellshading/files/patch-code-unix-Makefile
+++ b/games/q3cellshading/files/patch-code-unix-Makefile
@@ -1,6 +1,15 @@
---- code/unix/Makefile.orig	Tue Aug  8 18:19:12 2006
-+++ code/unix/Makefile	Tue Aug  8 18:22:25 2006
-@@ -34,7 +34,7 @@
+--- code/unix/Makefile.orig	2006-07-18 09:52:58 UTC
++++ code/unix/Makefile
+@@ -25,7 +25,7 @@ PLATFORM_RELEASE=$(shell uname -r)
+ ###
+ 
+ # Where we are building from (where the source code should be!)
+-MOUNT_DIR=../
++MOUNT_DIR=..
+ 
+ # Where we are building to, libMesaVoodooGL.so.3.3 should be here, etc.
+ # the demo pk3 file should be here in demoq3/pak0.pk3 or baseq3/pak0.pk3
+@@ -34,7 +34,7 @@ BDIR=$(MOUNT_DIR)/../run
  
  # Build name
  # BUILD_NAME=$(BUILD_NAME)
@@ -9,7 +18,7 @@
  
  
  
-@@ -46,8 +46,8 @@
+@@ -46,8 +46,8 @@ BUILD_NAME=quake3.x86
  
  BASEQ3_DIR=$(BDIR)/baseq3
  
@@ -20,7 +29,7 @@
  CDIR=$(MOUNT_DIR)/client
  SDIR=$(MOUNT_DIR)/server
  RDIR=$(MOUNT_DIR)/renderer
-@@ -65,7 +65,7 @@
+@@ -65,7 +65,7 @@ JPDIR=$(MOUNT_DIR)/jpeg-6
  SPLNDIR=$(MOUNT_DIR)/splines
  
  # extract version info
@@ -29,7 +38,7 @@
  RPM_RELEASE=1
  
  # NOTE: used by dcp rcp targets, not referenced
-@@ -76,7 +76,7 @@
+@@ -76,7 +76,7 @@ RPM_RELEASE=1
  #############################################################################
  
  ## Defaults
@@ -38,28 +47,25 @@
  # bk010215 - TODO - add all defaults / kill Ryan
  
  
-@@ -136,7 +136,7 @@
+@@ -136,7 +136,7 @@ ifeq ($(PLATFORM),linux)
      ifeq ($(ARCH),ppc)
        NEWPGCC=/loki/global/ppc/bin/gcc
        CC=$(NEWPGCC)
 -      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce
-+      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
++      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -ffast-math -falign-functions=2
      else
        #NEWPGCC=/usr/local/gcc-2.95.2/bin/gcc # bk001205
        #NEWPGCC=/loki/global/x86/bin/gcc
-@@ -146,9 +146,9 @@
+@@ -146,7 +146,7 @@ ifeq ($(PLATFORM),linux)
  # TTimo: legacy RELEASE_CFLAGS
  # NOTE: the -fomit-frame-pointer option leads to an unstable binary on my test box if it was built on the main box
  #   but building on the Mdk 7.2 baseline seems to work
 -      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -fomit-frame-pointer -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce
-+      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -fomit-frame-pointer -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
++      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -ffast-math -falign-functions=2
  # TTimo: use this for building on P3 gcc 2.95.3 libc2.2 for all targets (experimental! -fomit-fram-pointer removed)
--#      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce
-+#      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
+ #      RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O6 -mcpu=pentiumpro -march=pentium -pipe -ffast-math -malign-loops=2 -malign-jumps=2 -malign-functions=2 -fno-strict-aliasing -fstrength-reduce
      endif
-   endif
- 
-@@ -162,7 +162,7 @@
+@@ -162,7 +162,7 @@ ifeq ($(PLATFORM),linux)
    RANLIB=ranlib
  
    THREAD_LDFLAGS=-lpthread
@@ -68,7 +74,7 @@
    GLLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm
  
    ifeq ($(ARCH),axp)
-@@ -197,33 +197,29 @@
+@@ -197,33 +197,28 @@ else # ifeq Linux
  
  ifeq ($(PLATFORM),freebsd)
  
@@ -87,23 +93,23 @@
 -RPMARCH=i386
 -VENDOR=unknown
 -endif #alpha test
-+BASE_CFLAGS = $(CFLAGS) -DDATADIR='\"$(Q3DIR)\"' -DLIBDIR='\"$(LIBDIR)\"' -pipe
- 
++BASE_CFLAGS = $(CFLAGS) -DDATADIR='\"$(Q3DIR)\"' -DLIBDIR='\"$(LIBDIR)\"'
 +GL_CFLAGS = -I$(LOCALBASE)/include
  
--BASE_CFLAGS =  -pipe
-+DEBUG_CFLAGS=$(BASE_CFLAGS) -g  -Wall -Werror
++DEBUG_CFLAGS=$(BASE_CFLAGS) -g -Wall -Werror
 +RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG
  
--GL_CFLAGS = -I$(MESADIR)/include -I/usr/X11R6/include
+-BASE_CFLAGS =  -pipe
 +ifdef OPTIMIZED_CFLAGS
 +  ifeq ($(ARCH),i386)
-+RELEASE_CFLAGS+=-O6 -fomit-frame-pointer -pipe -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
++RELEASE_CFLAGS+=-ffast-math -falign-functions=2
 +  else
-+RELEASE_CFLAGS+=-O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations
++RELEASE_CFLAGS+=-ffast-math
 +  endif
 +endif
  
+-GL_CFLAGS = -I$(MESADIR)/include -I/usr/X11R6/include
+-
 -DEBUG_CFLAGS=$(BASE_CFLAGS) -g  -Wall -Werror
 -ifeq ($(ARCH),axp)
 -CC=pgcc
@@ -119,12 +125,9 @@
  endif
  
  LIBEXT=a
-@@ -235,25 +231,33 @@
- ARFLAGS=ar rv
- RANLIB=ranlib
+@@ -237,23 +232,31 @@ RANLIB=ranlib
  
--THREAD_LDFLAGS=-lpthread
-+THREAD_LDFLAGS=-lpthread
+ THREAD_LDFLAGS=-lpthread
  # don't need -ldl (FreeBSD)
 -LDFLAGS=-lm
 +LDFLAGS+=-lm
@@ -168,7 +171,7 @@
  endif
  
  else # ifeq freebsd
-@@ -283,7 +287,7 @@
+@@ -283,7 +286,7 @@ SHLIBLDFLAGS=-shared
  ARFLAGS=ar rv
  RANLIB=ranlib
  
@@ -177,7 +180,7 @@
  GLLDFLAGS=-L/usr/X11/lib -lGL -lX11 -lXext -lm
  
  TARGETS=$(B)/sgiquake3 \
-@@ -310,9 +314,9 @@
+@@ -310,9 +313,9 @@ ARFLAGS=ar rv
  RANLIB=ranlib
  
  ifeq ($(PLATFORM),freebsd)
@@ -189,7 +192,7 @@
  endif # ifeq freebsd
  
  TARGETS=\
-@@ -348,7 +352,7 @@
+@@ -348,7 +351,7 @@ build_release:
  	$(MAKE)  targets B=$(BR) CFLAGS="$(RELEASE_CFLAGS)"
  
  #Build both debug and release builds
@@ -198,7 +201,7 @@
  
  targets:makedirs $(TARGETS)
  
-@@ -516,20 +520,6 @@
+@@ -516,20 +519,6 @@ Q3OBJ = \
  	$(B)/client/unix_net.o \
  	$(B)/client/unix_shared.o \
  	\
@@ -219,7 +222,7 @@
  #	$(B)/client/q_parse.o \
  #	$(B)/client/math_quaternion.o \
  #	$(B)/client/util_str.o \
-@@ -541,10 +531,12 @@
+@@ -541,10 +530,12 @@ Q3OBJ = \
  #	$(B)/client/q_shared.o \
  
      ifeq ($(ARCH),i386)
@@ -234,7 +237,7 @@
        ifeq ($(DLL_ONLY),false)
          Q3OBJ += $(B)/client/vm_ppc.o
        endif
-@@ -559,10 +551,24 @@
+@@ -559,10 +550,24 @@ ifeq ($(PLATFORM),freebsd)
  		$(B)/client/linux_qgl.o \
  		$(B)/client/linux_glimp.o \
  		$(B)/client/linux_snd.o \
@@ -262,7 +265,7 @@
  else
  ifeq ($(PLATFORM),irix)
  	Q3POBJ=\
-@@ -578,7 +584,6 @@
+@@ -578,7 +583,6 @@ else
  		$(B)/client/linux_common.o \
  		$(B)/client/linux_qgl.o \
  		$(B)/client/linux_glimp.o \
@@ -270,7 +273,7 @@
  		$(B)/client/linux_snd.o \
  		$(B)/client/snd_mixa.o \
  		$(B)/client/matha.o \
-@@ -587,7 +592,6 @@
+@@ -587,7 +591,6 @@ else
  		$(B)/client/linux_common.o \
  		$(B)/client/linux_qgl.o \
  		$(B)/client/linux_glimp_smp.o \
@@ -278,7 +281,7 @@
  		$(B)/client/linux_snd.o \
  		$(B)/client/snd_mixa.o \
  		$(B)/client/matha.o
-@@ -602,12 +606,12 @@
+@@ -602,12 +605,12 @@ endif #Linux
  endif #FreeBSD
  endif #IRIX
  
@@ -293,7 +296,7 @@
  	$(CC)  -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(GLLDFLAGS) \
  		$(THREAD_LDFLAGS) $(LDFLAGS) 
  
-@@ -754,10 +758,10 @@
+@@ -754,10 +757,10 @@ $(B)/client/irix_input.o : $(UDIR)/irix_input.c; $(DO_
  $(B)/client/linux_common.o : $(UDIR)/linux_common.c; $(DO_CC)
  $(B)/client/linux_glimp.o : $(UDIR)/linux_glimp.c; $(DO_CC)  $(GL_CFLAGS) 
  $(B)/client/linux_glimp_smp.o : $(UDIR)/linux_glimp.c; $(DO_SMP_CC)  $(GL_CFLAGS) 
@@ -305,7 +308,7 @@
  $(B)/client/snd_mixa.o : $(UDIR)/snd_mixa.s; $(DO_AS) 
  $(B)/client/matha.o : $(UDIR)/matha.s; $(DO_AS) 
  
-@@ -767,7 +771,7 @@
+@@ -767,7 +770,7 @@ $(B)/client/snapvector.o : $(UDIR)/snapvector.nasm; $(
  $(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC) 
  endif
  
@@ -314,7 +317,7 @@
  ifeq ($(DLL_ONLY),false)
  $(B)/client/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_CC)
  endif
-@@ -912,22 +916,26 @@
+@@ -912,22 +915,26 @@ Q3DOBJ = \
  	$(B)/ded/unix_main.o \
  	$(B)/ded/unix_net.o \
  	$(B)/ded/unix_shared.o \
@@ -344,7 +347,7 @@
  	$(CC)  -o $@ $(Q3DOBJ) $(LDFLAGS)
  
  $(B)/ded/sv_bot.o : $(SDIR)/sv_bot.c; $(DO_DED_CC) 
-@@ -988,6 +996,7 @@
+@@ -988,6 +995,7 @@ $(B)/ded/linux_common.o : $(UDIR)/linux_common.c; $(DO
  $(B)/ded/unix_main.o : $(UDIR)/unix_main.c; $(DO_DED_CC) 
  $(B)/ded/unix_net.o : $(UDIR)/unix_net.c; $(DO_DED_CC) 
  $(B)/ded/unix_shared.o : $(UDIR)/unix_shared.c; $(DO_DED_CC) 
@@ -352,7 +355,7 @@
  $(B)/ded/null_client.o : $(NDIR)/null_client.c; $(DO_DED_CC) 
  $(B)/ded/null_input.o : $(NDIR)/null_input.c; $(DO_DED_CC) 
  $(B)/ded/null_snddma.o : $(NDIR)/null_snddma.c; $(DO_DED_CC) 
-@@ -1001,7 +1010,7 @@
+@@ -1001,7 +1009,7 @@ $(B)/ded/ftol.o : $(UDIR)/ftol.nasm; $(DO_NASM)
  $(B)/ded/snapvector.o : $(UDIR)/snapvector.nasm; $(DO_NASM) 
  endif
  
@@ -361,7 +364,7 @@
  ifeq ($(DLL_ONLY),false)
  $(B)/ded/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_DED_CC)
  endif
-@@ -1068,7 +1077,7 @@
+@@ -1068,7 +1076,7 @@ Q3CGOBJ = \
  	$(B)/baseq3/cgame/q_math.o \
  	$(B)/baseq3/cgame/q_shared.o
  
@@ -370,7 +373,7 @@
  	$(CC)  $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
  
  $(B)/baseq3/cgame/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC)         
-@@ -1128,7 +1137,7 @@
+@@ -1128,7 +1136,7 @@ MPCGOBJ = \
  	$(B)/missionpack/cgame/q_shared.o \
  	$(B)/missionpack/cgame/ui_shared.o
  
@@ -379,7 +382,7 @@
  	$(CC) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ)
  
  $(B)/missionpack/cgame/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC)     -DMISSIONPACK 
-@@ -1200,7 +1209,7 @@
+@@ -1200,7 +1208,7 @@ Q3GOBJ = \
  	$(B)/baseq3/game/q_math.o \
  	$(B)/baseq3/game/q_shared.o
  
@@ -388,7 +391,7 @@
  	$(CC)  $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
  
  $(B)/baseq3/game/ai_chat.o : $(GDIR)/ai_chat.c; $(DO_SHLIB_CC)     
-@@ -1278,7 +1287,7 @@
+@@ -1278,7 +1286,7 @@ MPGOBJ = \
  	$(B)/missionpack/game/q_math.o \
  	$(B)/missionpack/game/q_shared.o
  
@@ -397,7 +400,7 @@
  	$(CC) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ)
  
  $(B)/missionpack/game/ai_chat.o : $(GDIR)/ai_chat.c; $(DO_SHLIB_CC)    -DMISSIONPACK 
-@@ -1367,7 +1376,7 @@
+@@ -1367,7 +1375,7 @@ Q3UIOBJ = \
          $(B)/baseq3/ui/q_math.o \
          $(B)/baseq3/ui/q_shared.o
  
@@ -406,7 +409,7 @@
  	$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
  
  $(B)/baseq3/ui/bg_misc.o : $(GDIR)/bg_misc.c; $(DO_SHLIB_CC) 
-@@ -1410,7 +1419,7 @@
+@@ -1410,7 +1418,7 @@ $(B)/baseq3/ui/ui_spskill.o : $(Q3UIDIR)/ui_spskill.c;
  $(B)/baseq3/ui/ui_startserver.o : $(Q3UIDIR)/ui_startserver.c; $(DO_SHLIB_CC) 
  $(B)/baseq3/ui/ui_team.o : $(Q3UIDIR)/ui_team.c; $(DO_SHLIB_CC) 
  $(B)/baseq3/ui/ui_teamorders.o : $(Q3UIDIR)/ui_teamorders.c; $(DO_SHLIB_CC) 
@@ -415,7 +418,7 @@
  $(B)/baseq3/ui/ui_video.o : $(Q3UIDIR)/ui_video.c; $(DO_SHLIB_CC) 
  
  # bk001205 - these wre the only SHLIB compiles in 1.17
-@@ -1450,7 +1459,7 @@
+@@ -1450,7 +1458,7 @@ MPUIOBJ = \
  #	$(B)/missionpack/ui/q_math.o \
  #	$(B)/missionpack/ui/q_shared.o
  
@@ -424,7 +427,7 @@
  	$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ)
  
  $(B)/missionpack/ui/ui_atoms.o : $(UIDIR)/ui_atoms.c; $(DO_SHLIB_CC)  -DMISSIONPACK  
-@@ -1613,23 +1622,8 @@
+@@ -1613,23 +1621,8 @@ Q3SOBJ = \
  	$(B)/q3static/unix_net.o \
  	$(B)/q3static/unix_shared.o \
  	\
@@ -448,7 +451,7 @@
  	$(B)/q3static/linux_snd.o \
  	$(B)/q3static/snd_mixa.o \
  	$(B)/q3static/matha.o
-@@ -1779,7 +1773,6 @@
+@@ -1779,7 +1772,6 @@ $(B)/q3static/unix_main.o : $(UDIR)/unix_main.c; $(DO_
  $(B)/q3static/unix_net.o : $(UDIR)/unix_net.c; $(DO_CC) -DQ3_STATIC 
  $(B)/q3static/unix_shared.o : $(UDIR)/unix_shared.c; $(DO_CC) -DQ3_STATIC 
  $(B)/q3static/linux_glimp.o : $(UDIR)/linux_glimp.c; $(DO_CC) -DQ3_STATIC 
@@ -456,7 +459,7 @@
  $(B)/q3static/linux_qgl.o : $(UDIR)/linux_qgl.c; $(DO_CC) -DQ3_STATIC 
  $(B)/q3static/linux_input.o : $(UDIR)/linux_input.c; $(DO_CC) -DQ3_STATIC 
  $(B)/q3static/linux_snd.o : $(UDIR)/linux_snd.c; $(DO_CC) -DQ3_STATIC 
-@@ -2020,7 +2013,7 @@
+@@ -2020,7 +2012,7 @@ $(B)/q3static/bg_slidemove.o : $(GDIR)/bg_slidemove.c;
  
  
  
@@ -465,7 +468,7 @@
  	$(CC) $(CFLAGS) -o $@ $(Q3SOBJ)  $(GLLDFLAGS) $(LDFLAGS) 
  
  
-@@ -2059,9 +2052,9 @@
+@@ -2059,9 +2051,9 @@ rpm: $(BUILD_NAME).spec
  
  copyfiles:
  	-mkdirhier $(COPYDIR)