git: eb935d1066f6 - main - emulators/libretro-flycast: Fix 32-bit / i386 build

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Mon, 27 Jun 2022 07:10:27 UTC
The branch main has been updated by lwhsu:

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

commit eb935d1066f6c36361138dae21cf0ef016b4e97b
Author:     Timothy Beyer <beyert@cs.ucr.edu>
AuthorDate: 2022-06-27 07:08:54 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2022-06-27 07:08:54 +0000

    emulators/libretro-flycast: Fix 32-bit / i386 build
    
    PR:             264217
---
 emulators/libretro-flycast/Makefile                      | 16 +++++++++++-----
 .../files/patch-core_rec-x86_rec__x86__driver.cpp        | 11 +++++++++++
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/emulators/libretro-flycast/Makefile b/emulators/libretro-flycast/Makefile
index fe5e75d0f23f..6b4a1454ab6c 100644
--- a/emulators/libretro-flycast/Makefile
+++ b/emulators/libretro-flycast/Makefile
@@ -1,14 +1,14 @@
-# $FreeBSD$
+# Created by: Timothy Beyer <beyert@cs.ucr.edu>
 
 PORTNAME=	libretro-flycast
 PORTVERSION=	0.20210608
+PORTREVISION=	1
 CATEGORIES=	emulators games
 
 MAINTAINER=	beyert@cs.ucr.edu
 COMMENT=	Standalone port of flycast to libretro
 
 LICENSE=	GPLv2
-#LICENSE_COMB=	multi
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 ONLY_FOR_ARCHS=	amd64 i386
@@ -21,7 +21,7 @@ LIB_DEPENDS+=	libao.so:audio/libao \
 		libudev.so:devel/libudev-devd \
 		libvulkan.so:graphics/vulkan-loader
 
-USES=		compiler:c++11-lib dos2unix gl gmake xorg
+USES=	compiler:c++11-lib dos2unix gl gmake pkgconfig xorg
 USE_LDCONFIG=	yes
 
 USE_GITHUB=	yes
@@ -29,7 +29,7 @@ GH_ACCOUNT=	libretro
 GH_PROJECT=	flycast
 GH_TAGNAME=	8e4fa54e
 
-USE_GL+=	gl glew glu
+USE_GL+=	egl gl glew glu
 
 CFLAGS+=	-I${LOCALBASE}/include
 CXXFLAGS+=	-I${LOCALBASE}/include
@@ -51,12 +51,18 @@ MAKE_ARGS=	HAVE_GENERIC_JIT=0 \
 MAKE_ARGS+=	WITH_DYNAREC=x86_64
 .elif ${ARCH} == i386
 MAKE_ARGS+=	WITH_DYNAREC=x86
+USE_BINUTILS=	yes
+LDFLAGS+=	-Wl,-z,notext
 .endif
 
 PLIST_FILES=	lib/libretro/flycast_libretro.so
 
+post-patch:
+	@${REINPLACE_CMD} 's|/usr/local|${PREFIX}|' \
+		${WRKSRC}/Makefile
+
 do-install:
-	${MKDIR} ${STAGEDIR}/${PREFIX}/lib/libretro;
+	@${MKDIR} ${STAGEDIR}/${PREFIX}/lib/libretro;
 	${INSTALL_LIB} ${WRKSRC}/flycast_libretro.so \
 		${STAGEDIR}/${PREFIX}/lib/libretro/flycast_libretro.so;
 
diff --git a/emulators/libretro-flycast/files/patch-core_rec-x86_rec__x86__driver.cpp b/emulators/libretro-flycast/files/patch-core_rec-x86_rec__x86__driver.cpp
new file mode 100644
index 000000000000..0391177b7edc
--- /dev/null
+++ b/emulators/libretro-flycast/files/patch-core_rec-x86_rec__x86__driver.cpp
@@ -0,0 +1,11 @@
+--- core/rec-x86/rec_x86_driver.cpp.orig	2022-05-20 09:34:27 UTC
++++ core/rec-x86/rec_x86_driver.cpp
+@@ -31,7 +31,7 @@ RuntimeBlockInfo* ngen_AllocateBlock(void)
+ 
+ x86_block* x86e;
+ 
+-static int cycle_counter;
++int cycle_counter;
+ 
+ void* loop_no_update;
+ void* intc_sched;