git: b7fb34791d44 - main - games/ezquake: fix arm64 build failures

From: Dave Cottlehuber <dch_at_FreeBSD.org>
Date: Mon, 04 Apr 2022 12:51:15 UTC
The branch main has been updated by dch:

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

commit b7fb34791d44a5b8313444b01b758f9ef2e18b55
Author:     Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2022-04-04 12:50:50 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2022-04-04 12:50:50 +0000

    games/ezquake: fix arm64 build failures
    
    PR:             262889
    Reported by:    pkg-fallout
    Approved by:    vvd@unislabs.com (maintainer)
    Sponsored by:   SkunkWerks, GmbH
    MFH:            2022Q2
---
 games/ezquake/Makefile           |  2 +-
 games/ezquake/files/patch-host.c | 17 ++++++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/games/ezquake/Makefile b/games/ezquake/Makefile
index 2abd0da8d2d6..e035deaab274 100644
--- a/games/ezquake/Makefile
+++ b/games/ezquake/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	ezquake
 DISTVERSION=	3.2.3
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	2
 CATEGORIES=	games
 MASTER_SITES=	https://github.com/ezQuake/ezquake-source/archive/ \
diff --git a/games/ezquake/files/patch-host.c b/games/ezquake/files/patch-host.c
index 0506eb4589d0..cba197302ad7 100644
--- a/games/ezquake/files/patch-host.c
+++ b/games/ezquake/files/patch-host.c
@@ -1,9 +1,10 @@
---- host.c.orig	2020-09-16 22:08:02 UTC
+--- host.c.orig
 +++ host.c
-@@ -333,11 +333,19 @@ void SYSINFO_Init(void)
+@@ -333,16 +333,30 @@
  	SYSINFO_processor_description = cpu_model;
  
  	gettimeofday(&old_tp, NULL);
++#if defined(__powerpc__) || defined(__i386__) || defined(__amd64__)
 +#ifdef __powerpc__
 +	__asm__ __volatile__("mfspr %%r3, 268": "=r" (old_tsc));
 +#else
@@ -20,7 +21,17 @@
  	SYSINFO_MHz = (int)((tsc_freq - old_tsc) /
  						(tp.tv_sec - old_tp.tv_sec + (tp.tv_usec - old_tp.tv_usec) / 1000000.) /
  						1000000. + .5);
-@@ -351,7 +359,7 @@ void SYSINFO_Init(void)
+ // VVD: We can use sysctl hw.clockrate, but it don't work on i486 - always 0.
+ // Must work on Pentium 1/2/3; tested on Pentium 4. And RELENG_4 have no this sysctl.
++#else
++	len = sizeof(val);
++	sysctlbyname("dev.cpu.0.freq", &val, &len, NULL, 0);
++	SYSINFO_MHz = val;
++#endif
+ 
+ 	if (gl_renderer  &&  gl_renderer[0]) {
+ 		if (SYSINFO_3D_description != NULL) {
+@@ -351,7 +365,7 @@
  		SYSINFO_3D_description = Q_strdup(gl_renderer);
  	}