git: b63891cb14b7 - main - net-im/telegram-desktop: revive Qt5/Qt6 flavors (+)

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Thu, 10 Nov 2022 23:55:46 UTC
The branch main has been updated by fluffy:

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

commit b63891cb14b7a6cfc4029f3954a09565c3e65ea7
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2022-11-10 23:47:21 +0000
Commit:     Dima Panov <fluffy@FreeBSD.org>
CommitDate: 2022-11-10 23:47:21 +0000

    net-im/telegram-desktop: revive Qt5/Qt6 flavors (+)
    
    * While building with Qt6, Telegram Desktop can use bundled kcoreutils
      and kimageformat libraries to provide a needed function from KDE Framework
    * Switch from bundled dispatch library to devel/libdispatch
    * Drop extra -DNDEBUG from CXXFLAGS, it is now a default for ports cmake framework
    
    Revieved by:    osa
---
 net-im/telegram-desktop/Makefile | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/net-im/telegram-desktop/Makefile b/net-im/telegram-desktop/Makefile
index c5ce91f3c0b3..2d1b9476ba07 100644
--- a/net-im/telegram-desktop/Makefile
+++ b/net-im/telegram-desktop/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	telegram-desktop
 DISTVERSION=	4.2.4
+PORTREVISION=	1
 CATEGORIES=	net-im
 MASTER_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/releases/download/v${DISTVERSION}/
 DISTNAME=	tdesktop-${DISTVERSION}-full
@@ -27,6 +28,7 @@ BUILD_DEPENDS=	alsa-lib>0:audio/alsa-lib \
 LIB_DEPENDS=	libabsl_base.so:devel/abseil \
 		libavformat.so:multimedia/ffmpeg \
 		libdbus-1.so:devel/dbus \
+		libdispatch.so:devel/libdispatch \
 		libenchant-2.so:textproc/enchant2 \
 		libhunspell-1.7.so:textproc/hunspell \
 		libjpeg.so:graphics/jpeg-turbo \
@@ -42,16 +44,30 @@ LIB_DEPENDS=	libabsl_base.so:devel/abseil \
 		libxxhash.so:devel/xxhash \
 		libvpx.so:multimedia/libvpx
 
+FLAVORS=	qt5 qt6
+FLAVOR?=	${FLAVORS:[1]}
+qt5_PKGNAMESUFFIX=
+qt6_PKGNAMESUFFIX=	-qt6
+qt5_CONFLICTS_INSTALL=	${PORTNAME}-qt6
+qt6_CONFLICTS_INSTALL=	${PORTNAME}
+
 USES=		cmake compiler:c++17-lang desktop-file-utils gl \
-		gnome kde:5 pkgconfig python:3.7+,build qt:5 ssl xorg
-USE_KDE=	coreaddons
-USE_QT=		buildtools:build core dbus gui imageformats network qmake:build \
-		svg wayland widgets
+		gnome pkgconfig python:3.7+,build ssl xorg
 
 USE_GITHUB=	nodefault
 GH_ACCOUNT=	telegramdesktop
 GH_PROJECT=	tdesktop
 
+.if ${FLAVOR} == qt5
+USES+=		kde:5 qt:5
+USE_QT=		buildtools:build core dbus gui imageformats network qmake:build \
+		svg wayland widgets
+USE_KDE=	coreaddons kimageformats
+.else
+USES+=		qt:6
+USE_QT=		5compat base imageformats lottie shadertools svg tools:build wayland
+.endif
+
 USE_GL=		gl
 USE_GNOME=	glib20 glibmm
 USE_XORG=	x11 xcb xcomposite xdamage xext xfixes xrandr xrender xtst
@@ -63,8 +79,8 @@ CMAKE_ON=	DESKTOP_APP_USE_PACKAGED DESKTOP_APP_DISABLE_CRASH_REPORTS \
 		DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
 CMAKE_OFF=	DESKTOP_APP_USE_PACKAGED_FONTS
 
-# Disable DCHECKs, otherwise video calls will crash.
-CXXFLAGS+=	-DNDEBUG
+# libdispatch components
+LDFLAGS+=	-lBlocksRuntime
 
 # see Bugzilla #245452 for details
 NO_CCACHE=	yes