Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Mar 2017 09:13:12 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r437344 - head/games/cake
Message-ID:  <201703310913.v2V9DCbw065381@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Fri Mar 31 09:13:11 2017
New Revision: 437344
URL: https://svnweb.freebsd.org/changeset/ports/437344

Log:
  Make sure `games/cake' runs OK on amd64 (and possibly other 64-bit
  architectures):
  
  - Console::SetFontSize() method calls Console::Recalculate_NLines()
    which might access ConsoleLines[] array before it is constructed,
    Recalculate_NLines() is explicitly called after ConsoleLines[] is
    allocated and populated, so just comment out problematic call in
    SetFontSize(); it is called only once anyway (the problem did not
    exhibit itself on i386 for some reason);
  - The code assumes that sizeof(long) == 4 in too many places, e.g.
    in on-disk file format layouts and such.  Fixing all structures
    would be too much trouble; instead, simply replace those long's
    with int's, [un]signed as appropriate.

Modified:
  head/games/cake/Makefile

Modified: head/games/cake/Makefile
==============================================================================
--- head/games/cake/Makefile	Fri Mar 31 09:11:09 2017	(r437343)
+++ head/games/cake/Makefile	Fri Mar 31 09:13:11 2017	(r437344)
@@ -3,7 +3,7 @@
 
 PORTNAME=	cake
 PORTVERSION=	2005.12.26
-PORTREVISION=	10
+PORTREVISION=	11
 CATEGORIES=	games
 MASTER_SITES=	http://freebsd.nsu.ru/distfiles/
 DISTNAME=	${PORTNAME}_src_${PORTVERSION:S/.//g}
@@ -39,6 +39,15 @@ post-patch: .SILENT
 		${WRKSRC}/cake/sound.h
 # Use traditional mapping for console key (tilde)
 	${REINPLACE_CMD} -e 's/167/96/' ${WRKSRC}/main.cpp
+# Avoid segmentation fault on amd64 (uninitialized memory access)
+	${REINPLACE_CMD} -e '1281s:Recalculate_NLines()://&:' \
+		${WRKSRC}/cake/console.cpp
+# The code assumes that sizeof(long) == 4 in too many places :(
+	${REINPLACE_CMD} -e '/typedef/s/ long//' ${WRKSRC}/cake/files.h
+	${REINPLACE_CMD} -e '/typedef/s/long/int/' ${WRKSRC}/cake/types.h
+	${REINPLACE_CMD} -e 's/unsigned long/DWORD/' ${WRKSRC}/cake/system.h
+	${REINPLACE_CMD} -e 's/unsigned long/unsigned int/' \
+		${WRKSRC}/cake/zip/Crc32.h ${WRKSRC}/cake/zip/Unzip.h
 # Fixes for GCC 4.x and Clang 4.0
 	${REINPLACE_CMD} -e 's/Mat3x2:://' ${WRKSRC}/cake/math.h
 	${REINPLACE_CMD} -e '2852s/numverts/&[0]/' ${WRKSRC}/cake/q3bsp.cpp



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703310913.v2V9DCbw065381>