1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-04 06:15:24 +00:00

Fix a couple of bugs that prevented `games/quake2lnx' from fully working

on amd64 (and likely other 64-bit architectures):

- Prototype for `void *qwglGetProcAddress(char *symbol)' was guarded by
  #ifdef __linux__; this was not a problem on i386, where sizeof(void *)
  /actual return type/ == sizeof(int) /assumed return type of undeclared
  function/.  On amd64, returned pointer would sometimes get truncated,
  leading to a program's crash.  Mend this by turning `#ifdef __linux__'
  condition essentially into `#ifndef _WIN32'
- Software renderer was typedef'ing PIXEL24 as `unsigned long'; fix it
  by using `unsigned int' type instead
- Remove `-s' from OPTIMIZED_CFLAGS: stripping is taken care of during
  installation (subject to WITH_DEBUG); also remove optimization flag
  `-fexpensive-optimizations' as it is not being supported by Clang
- While here, fix `version' console command to report correct operating
  system and architecture names
- Employ options helper target to install documentation; add more useful
  changelogs and drop `quake2.3dfxgl' file (meaningless these days)
This commit is contained in:
Alexey Dokuchaev 2017-04-05 17:58:37 +00:00
parent 9bb393eb6e
commit 01726beb98
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=437802
5 changed files with 64 additions and 5 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= quake2lnx
PORTVERSION= 0.16.2
PORTREVISION= 13
PORTREVISION= 14
CATEGORIES= games
MASTER_SITES= http://offload1.icculus.org/quake2/files/
DISTNAME= quake2-r${PORTVERSION}
@ -181,7 +181,7 @@ MAKE_ARGS+= HAVE_IPV6=YES
.endif
.if ${PORT_OPTIONS:MOPTIMIZED_CFLAGS}
MAKE_ARGS+= OPTIMIZED_CFLAGS="-O3 -s -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations"
MAKE_ARGS+= OPTIMIZED_CFLAGS="-O3 -ffast-math -funroll-loops -fomit-frame-pointer"
.endif
.if ! ${PORT_OPTIONS:MASM}
@ -201,6 +201,9 @@ post-patch: .SILENT
${REINPLACE_CMD} -e 's|/js|/joy|' ${WRKSRC}/src/linux/joystick.c
${REINPLACE_CMD} -e 's|jpeg_mem_src|local_&|' \
${WRKSRC}/src/ref_candygl/gl_image.c
${REINPLACE_CMD} -e '/BUILDSTRING/s|Linux|${OPSYS}|' \
-e '/CPUSTRING/s|Unknown|${ARCH}|' \
${WRKSRC}/src/qcommon/qcommon.h
do-install:
.for tgt in ${EXE_TARGETS}
@ -224,12 +227,17 @@ do-install:
${INSTALL_PROGRAM} ${WRKSRC}/release/game.so \
${STAGEDIR}${LIBDIR}/baseq2
.endif
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/src/docs/3.*_Changes.txt \
${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/src/docs/README \
${STAGEDIR}${DOCSDIR}/README.320
${INSTALL_DATA} ${WRKSRC}/src/docs/joystick.txt ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/src/docs/quake2.3dfxgl ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/src/docs/changes.txt \
${WRKSRC}/src/docs/joystick.txt \
${WRKSRC}/src/docs/readme.txt ${STAGEDIR}${DOCSDIR}
.include "${.CURDIR}/../quake2-data/Makefile.include"
.include <bsd.port.mk>

View File

@ -1,5 +1,14 @@
--- src/linux/rw_x11.c.orig Wed Oct 9 03:54:25 2002
+++ src/linux/rw_x11.c Mon Jun 16 23:19:40 2003
@@ -151,7 +151,7 @@
int config_notify_height;
typedef unsigned short PIXEL16;
-typedef unsigned long PIXEL24;
+typedef unsigned int PIXEL24;
#ifdef REDBLUE
static PIXEL16 st2d_8to16table_s[2][256];
static PIXEL24 st2d_8to24table_s[2][256];
@@ -446,7 +446,7 @@
qboolean OpenJoystick(cvar_t *joy_dev) {
int i, err;

View File

@ -0,0 +1,22 @@
--- src/ref_candygl/qgl.h.orig 2002-06-17 20:03:07 UTC
+++ src/ref_candygl/qgl.h
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suit
#include <GL/gl.h>
-#ifdef __linux__
+#ifndef _WIN32
//#include <GL/fxmesa.h>
#include <GL/glx.h>
#endif
@@ -428,9 +428,7 @@ extern BOOL ( WINAPI * qwglSwapIntervalE
extern BOOL ( WINAPI * qwglGetDeviceGammaRampEXT ) ( unsigned char *pRed, unsigned char *pGreen, unsigned char *pBlue );
extern BOOL ( WINAPI * qwglSetDeviceGammaRampEXT ) ( const unsigned char *pRed, const unsigned char *pGreen, const unsigned char *pBlue );
-#endif
-
-#ifdef __linux__
+#else
// local function in dll
extern void *qwglGetProcAddress(char *symbol);

View File

@ -0,0 +1,13 @@
--- src/ref_gl/qgl.h.orig 2004-05-02 19:36:53 UTC
+++ src/ref_gl/qgl.h
@@ -426,9 +426,7 @@ extern BOOL ( WINAPI * qwglSwapIntervalE
extern BOOL ( WINAPI * qwglGetDeviceGammaRampEXT ) ( unsigned char *pRed, unsigned char *pGreen, unsigned char *pBlue );
extern BOOL ( WINAPI * qwglSetDeviceGammaRampEXT ) ( const unsigned char *pRed, const unsigned char *pGreen, const unsigned char *pBlue );
-#endif
-
-#ifdef __linux__
+#else
// local function in dll
extern void *qwglGetProcAddress(char *symbol);

View File

@ -12,10 +12,17 @@
%%SOFTSDL%%%%LIBDIR%%/ref_softsdl.so
%%X11%%%%LIBDIR%%/ref_softx.so
@comment === DOCS ===
%%PORTDOCS%%%%DOCSDIR%%/3.15_Changes.txt
%%PORTDOCS%%%%DOCSDIR%%/3.16_Changes.txt
%%PORTDOCS%%%%DOCSDIR%%/3.17_Changes.txt
%%PORTDOCS%%%%DOCSDIR%%/3.19_Changes.txt
%%PORTDOCS%%%%DOCSDIR%%/3.20_Changes.txt
%%PORTDOCS%%%%DOCSDIR%%/3.21_Changes.txt
%%PORTDOCS%%%%DOCSDIR%%/README
%%PORTDOCS%%%%DOCSDIR%%/README.320
%%PORTDOCS%%%%DOCSDIR%%/changes.txt
%%PORTDOCS%%%%DOCSDIR%%/joystick.txt
%%PORTDOCS%%%%DOCSDIR%%/quake2.3dfxgl
%%PORTDOCS%%%%DOCSDIR%%/readme.txt
@comment === DATA ===
%%QMAX%%%%LIBDIR%%/baseq2/maxpak.pak
@comment === CLEANUP ===