git: 87f3f099796e - main - games/moonlight-qt: Fix build error for 12.4-RELEASE

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Tue, 07 Nov 2023 00:20:37 UTC
The branch main has been updated by fuz:

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

commit 87f3f099796e80d9b44ef03fc2f63bdc52fa30fa
Author:     Armin Zhu <lisp_25689@163.com>
AuthorDate: 2023-10-29 13:41:39 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-11-07 00:16:49 +0000

    games/moonlight-qt: Fix build error for 12.4-RELEASE
    
    There is openssl.pc in /usr/libdata/pkgconf on FreeBSD 13.2-RELEASE.
    But there is nothing on 12.4-RELEASE.So 'PKGCONF += openssl' in .pro
    file will fail on it.  Openssl 1.1.1q is the native part of the system.
    It should check for the existence of this dependency without limiting
    the openssl version.  I have deleted PKGCONF += openssl and manual
    add appropriate LDFLAGS on 12.4-RELEASE
    
    PR:             274791
---
 games/moonlight-qt/Makefile | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/games/moonlight-qt/Makefile b/games/moonlight-qt/Makefile
index 3bc21934a1c1..92090eef0dd5 100644
--- a/games/moonlight-qt/Makefile
+++ b/games/moonlight-qt/Makefile
@@ -33,13 +33,27 @@ PLIST_FILES=	bin/moonlight-qt \
 		share/metainfo/com.moonlight_stream.Moonlight.appdata.xml \
 		share/icons/hicolor/scalable/apps/moonlight.svg \
 
+.include <bsd.port.pre.mk>
+
+# fix ssl dependency lack on 12.x releases
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1300000
+LDFLAGS+=	-L${LOCALBASE}/lib -L${OPENSSLLIB} -lssl -lcrypto
+.endif
+
 post-patch:
-	@${REINPLACE_CMD} -e 's@^    TARGET = moonlight.*@    TARGET = ${PORTNAME}${PKGNAMESUFFIX}@' \
-		${WRKSRC}/app/app.pro
 	@${REINPLACE_CMD} -e 's@Exec=moonlight.*@Exec=${PORTNAME}${PKGNAMESUFFIX}@' \
 		${WRKSRC}/app/deploy/linux/com.moonlight_stream.Moonlight.desktop
+	@${REINPLACE_CMD} -e 's@^    TARGET = moonlight.*@    TARGET = ${PORTNAME}${PKGNAMESUFFIX}@' \
+		${WRKSRC}/app/app.pro
+
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1300000
+	@${REINPLACE_CMD} -e 's@openssl @@' \
+		${WRKSRC}/app/app.pro
+	@${REINPLACE_CMD} -e '/openssl/ d' \
+		${WRKSRC}/moonlight-common-c/moonlight-common-c.pro
+.endif
 
 post-install:
 	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}${PKGNAMESUFFIX}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>