git: 09bbcc173a47 - main - emulators/zsnes: Ignore on FreeBSD 14.0 and use older C++ Standard for compilation

From: Torsten Zuehlsdorff <tz_at_FreeBSD.org>
Date: Tue, 30 Jul 2024 22:25:07 UTC
The branch main has been updated by tz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=09bbcc173a47febddd0e82f14f43c971a90c5008

commit 09bbcc173a47febddd0e82f14f43c971a90c5008
Author:     Torsten Zuehlsdorff <tz@FreeBSD.org>
AuthorDate: 2024-07-30 22:19:10 +0000
Commit:     Torsten Zuehlsdorff <tz@FreeBSD.org>
CommitDate: 2024-07-30 22:24:29 +0000

    emulators/zsnes: Ignore on FreeBSD 14.0 and use older C++ Standard for compilation
    
      Since ZSNES is not in active development, with the last release being in 2007,
       the code is not designed to be compiled with more recent C++ standards. Thus,
       this patch makes it use an older standard to make it compile.
    
      - Updated Makefile (cleaned up through portclippy and portfmt), adding a
       CONFIGURE_ENV to set the C++ standard through CXXFLAGS.
    
      - Updated files/patch-configure as the above CXXFLAGS were being ignored due
       to one line using CFLAGS instead of CXXFLAGS.
    
      - Add IGNORE for FreeBSD 14.0, because of build failures on this
      plattform. Since it builds fine on 14.1 and 14.0 is EOL soon, we decided to
      IGNORE it for this version. The error is:
    
      checking for zlib - version >= 1.2.3... 1.3, bad version string given
            by zlib, sometimes due to very old zlibs that didnt correctly
            define their version. Please upgrade if you are running an
            old zlib... no
      configure: error: zlib >= 1.2.3 is required
    
    PR:             280195
    Approved by:    Naram Qashat <cyberbotx@cyberbotx.com> (maintainer)
---
 emulators/zsnes/Makefile              | 50 ++++++++++++++++++++---------------
 emulators/zsnes/files/patch-configure | 24 ++++++++++++-----
 2 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/emulators/zsnes/Makefile b/emulators/zsnes/Makefile
index fcf091b9dc40..2ddf7b91cc57 100644
--- a/emulators/zsnes/Makefile
+++ b/emulators/zsnes/Makefile
@@ -23,40 +23,48 @@ USES=		gmake localbase sdl tar:bzip2
 USE_SDL=	sdl
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--disable-cpucheck
+CONFIGURE_ENV=	CXXFLAGS="${CXXFLAGS} -std=gnu++03"
 
 WRKSRC=		${WRKDIR}/${PORTNAME}_${PORTVERSION:S/./_/}/src
 
-PLIST_FILES=	bin/zsnes share/man/man1/zsnes.1.gz
+PLIST_FILES=	bin/zsnes \
+		share/man/man1/zsnes.1.gz
 
-NO_OPTIONS_SORT=yes
-OPTIONS_DEFINE=	X11 OPENGL DEBUGGER JMA AO
-OPTIONS_DEFAULT=X11 JMA
-DEBUGGER_DESC=	ZSNES Debugger
-JMA_DESC=	JMA support
+OPTIONS_DEFINE=		AO DEBUGGER JMA OPENGL X11
+OPTIONS_DEFAULT=	JMA X11
+DEBUGGER_DESC=		ZSNES Debugger
+JMA_DESC=		JMA support
 
+AO_LIB_DEPENDS=			libao.so:audio/libao
+AO_CONFIGURE_ENABLE=		libao
 DEBUGGER_CONFIGURE_ENABLE=	debugger
-JMA_CONFIGURE_ENABLE=	jma
-X11_CONFIGURE_WITH=	x
+JMA_CONFIGURE_ENABLE=		jma
 OPENGL_CONFIGURE_ENABLE=	opengl
+X11_CONFIGURE_WITH=		x
 
-AO_LIB_DEPENDS=	libao.so:audio/libao
-AO_CONFIGURE_ENABLE=	libao
+.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400000 &&  ${OSVERSION} < 1401000 )
+IGNORE= Does not build on FreeBSD 14.0 - zlib is too old
+.endif
 
 post-patch:
-	@${REINPLACE_CMD} -e \
-		's|@CXX@ @CFLAGS@ -o|@CXX@ @CXXFLAGS@ @CPPFLAGS@ -o|g ; \
-		 s|@CC@ @CFLAGS@ -o|@CC@ @CFLAGS@ @CPPFLAGS@ -o|g' \
-			${WRKSRC}/Makefile.in
-	@${REINPLACE_CMD} -i "" -e \
-		's|-O3||g' ${WRKSRC}/${CONFIGURE_SCRIPT}
+	@${REINPLACE_CMD} -e 's|@CXX@ @CFLAGS@ -o|@CXX@ @CXXFLAGS@ @CPPFLAGS@ -o|g ; s|@CC@ @CFLAGS@ -o|@CC@ @CFLAGS@ @CPPFLAGS@ -o|g' \
+		${WRKSRC}/Makefile.in
+	@${REINPLACE_CMD} -i "" \
+		-e 's|-O3||g' \
+		${WRKSRC}/${CONFIGURE_SCRIPT}
 	@${REINPLACE_CMD} -e 's|size_t argc|int argc|g' \
-		${WRKSRC}/parsegen.cpp ${WRKSRC}/tools/depbuild.cpp \
-		${WRKSRC}/tools/extraext.cpp ${WRKSRC}/tools/macroll.cpp \
-		${WRKSRC}/tools/minwhite.cpp ${WRKSRC}/tools/nreplace.cpp \
+		${WRKSRC}/parsegen.cpp \
+		${WRKSRC}/tools/depbuild.cpp \
+		${WRKSRC}/tools/extraext.cpp \
+		${WRKSRC}/tools/macroll.cpp \
+		${WRKSRC}/tools/minwhite.cpp \
+		${WRKSRC}/tools/nreplace.cpp \
 		${WRKSRC}/tools/varrep.cpp
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/zsnes ${STAGEDIR}${PREFIX}/bin
-	${INSTALL_MAN} ${WRKSRC}/linux/zsnes.1 ${STAGEDIR}${PREFIX}/share/man/man1
+	${INSTALL_PROGRAM} ${WRKSRC}/zsnes \
+		${STAGEDIR}${PREFIX}/bin
+	${INSTALL_MAN} ${WRKSRC}/linux/zsnes.1 \
+		${STAGEDIR}${PREFIX}/share/man/man1
 
 .include <bsd.port.mk>
diff --git a/emulators/zsnes/files/patch-configure b/emulators/zsnes/files/patch-configure
index bfb9a54abebd..e0d94f34a551 100644
--- a/emulators/zsnes/files/patch-configure
+++ b/emulators/zsnes/files/patch-configure
@@ -1,9 +1,11 @@
---- configure.orig	Thu Jan 25 23:44:43 2007
-+++ configure	Thu Jan 25 23:48:32 2007
-@@ -5130,89 +5130,6 @@
+--- configure.orig	2007-01-25 00:51:21 UTC
++++ configure
+@@ -5128,92 +5128,6 @@ else
  
-   { echo "$as_me:$LINENO: checking which cpu architecture to optimize for" >&5
- echo $ECHO_N "checking which cpu architecture to optimize for... $ECHO_C" >&6; }
+   CFLAGSBAK="$CFLAGS"
+ 
+-  { echo "$as_me:$LINENO: checking which cpu architecture to optimize for" >&5
+-echo $ECHO_N "checking which cpu architecture to optimize for... $ECHO_C" >&6; }
 -  if test x$force_arch != x; then
 -    CFLAGS="$CFLAGS -march=$force_arch"
 -    cat >conftest.$ac_ext <<_ACEOF
@@ -87,6 +89,16 @@
 -      CFLAGS="$CFLAGS -march=$ARCH_INFO"
 -    fi
 -  fi
- 
+-
    # Check whether --enable-release was given.
  if test "${enable_release+set}" = set; then
+   enableval=$enable_release; release=$enableval
+@@ -5237,7 +5151,7 @@ fi
+     NFLAGS="$NFLAGS -O1"
+   fi
+ fi
+-CXXFLAGS="$CFLAGS -fno-rtti"
++CXXFLAGS="$CXXFLAGS -fno-rtti"
+ 
+ if test x$enable_jma != xno; then
+   JMA_FILES="\$(JMA_D)/7zlzma.o \$(JMA_D)/crc32.o \$(JMA_D)/iiostrm.o\