git: 419d603696d1 - main - games/kodi-addon-game.libretro.beetle-psx: Avoid bundling beetle_psx

From: Bernhard Froehlich <decke_at_FreeBSD.org>
Date: Tue, 18 Jan 2022 12:47:28 UTC
The branch main has been updated by decke:

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

commit 419d603696d1757f71c748bdc96cb64b4ede501e
Author:     Bernhard Froehlich <decke@FreeBSD.org>
AuthorDate: 2022-01-18 12:45:28 +0000
Commit:     Bernhard Froehlich <decke@FreeBSD.org>
CommitDate: 2022-01-18 12:45:28 +0000

    games/kodi-addon-game.libretro.beetle-psx: Avoid bundling beetle_psx
    
    PR:             261111
    Submitted by:   Rozhuk Ivan <rozhuk.im@gmail.com> (maintainer)
---
 games/kodi-addon-game.libretro.beetle-psx/Makefile | 50 +++++++++++-----------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/games/kodi-addon-game.libretro.beetle-psx/Makefile b/games/kodi-addon-game.libretro.beetle-psx/Makefile
index a91895c28c2a..4301cd81ff0c 100644
--- a/games/kodi-addon-game.libretro.beetle-psx/Makefile
+++ b/games/kodi-addon-game.libretro.beetle-psx/Makefile
@@ -3,6 +3,7 @@
 PORTNAME=	game.libretro.beetle-psx
 PORTVERSION=	0.9.44.36
 DISTVERSIONSUFFIX=	-Matrix
+PORTREVISION=	1
 CATEGORIES=	games
 
 MAINTAINER=	rozhuk.im@gmail.com
@@ -10,31 +11,32 @@ COMMENT=	Kodi game addon for Sony - PlayStation (Beetle PSX)
 
 LICENSE=	GPLv2+
 
-LIB_DEPENDS=	libtinyxml.so:textproc/tinyxml
-RUN_DEPENDS=	kodi-addon-game.libretro>=0:games/kodi-addon-game.libretro
+LIBRETRO_PORT=	libretro-beetle_psx
 
-USES=		cmake:noninja gmake kodi localbase
+RUN_DEPENDS=	kodi-addon-game.libretro>=0:games/kodi-addon-game.libretro \
+		${LIBRETRO_PORT}>=0:games/${LIBRETRO_PORT}
+
+NO_ARCH=	yes
+
+USES=		kodi
 USE_GITHUB=	yes
-GH_ACCOUNT=	kodi-game \
-		libretro:beetle_psx
-GH_PROJECT=	beetle-psx-libretro:beetle_psx
-# Keep in sync with: depends/common/beetle-psx/beetle-psx.txt
-GH_TAGNAME=	e1836bde1b250d41c6f91c2b6f06444d989f1138:beetle_psx
-
-CMAKE_ARGS=	-DBUILD_SHARED_LIBS=1 \
-		-DADDONS_TO_BUILD=${PORTNAME} \
-		-DBEETLE-PSX_LIB=depends/common/beetle-psx/mednafen_psx_libretro.so
-
-post-extract:
-	@${MV} ${WRKSRC_beetle_psx}/* ${WRKSRC}/depends/common/beetle-psx/
-
-post-patch:
-	@${REINPLACE_CMD} -e 's|find_library(BEETLE-PSX_LIB.*|add_subdirectory(depends/common/beetle-psx)|g' \
-		${WRKSRC}/CMakeLists.txt
-	@${REINPLACE_CMD} -e 's|defined(BSD)|!defined(CLOCK_REALTIME)|g' \
-		${WRKSRC}/depends/common/beetle-psx/libretro-common/rthreads/rthreads.c
-
-post-install:
-	${RM} -rf ${STAGEDIR}${PREFIX}/lib/libretro
+GH_ACCOUNT=	kodi-game
+
+do-build:
+	@${MKDIR} ${WRKSRC}/lib
+	@LIBRARY_FILENAME_FULL=`${MAKE} -C ../${LIBRETRO_PORT} -V PLIST_FILES | ${SED} 's| .*||g'` && \
+	LIBRARY_FILENAME=`basename "$${LIBRARY_FILENAME_FULL}"` && \
+	${LN} -sf "${LOCALBASE}/$${LIBRARY_FILENAME_FULL}" ${WRKSRC}/lib/ && \
+	${REINPLACE_CMD} -e 's|@PLATFORM@|freebsd|g' \
+		-e "s|@LIBRARY_FILENAME@|$${LIBRARY_FILENAME}|g" \
+		${WRKSRC}/${PORTNAME}/addon.xml.in
+	@${MV} ${WRKSRC}/${PORTNAME}/addon.xml.in ${WRKSRC}/${PORTNAME}/addon.xml
+	@${RM} -f ${WRKSRC}/${PORTNAME}/addon.xml.in.bak
+
+do-install:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/kodi/addons/${PORTNAME} \
+		${STAGEDIR}${PREFIX}/share/kodi/addons
+	@(cd ${WRKSRC}/lib/ && ${COPYTREE_SHARE} * ${STAGEDIR}${PREFIX}/lib/kodi/addons/${PORTNAME})
+	@(cd ${WRKSRC} && ${COPYTREE_SHARE} ${PORTNAME} ${STAGEDIR}${PREFIX}/share/kodi/addons)
 
 .include <bsd.port.mk>