On Fri, Jun 24, 2022 at 03:47:05PM +0000, Klemens Nanni wrote:
> On 24/06/2022 18:20, Sergey A. Osokin wrote:
> > On Fri, Jun 24, 2022 at 10:43:57AM +0000, Klemens Nanni wrote:
> > > On Thu, Jun 23, 2022 at 09:44:58PM +0000, Sergey A. Osokin wrote:
> > > > 
> > > > telegram-deskop 4.0.0, latest release, builds well with Qt5.
> > > 
> > > On which system?
> > 
> > FreeBSD 13.1-RELEASE amd64
> > 
> > > With patches?
> > 
> > A couple of patches is required, one from the vendor,
> > https://github.com/osokin/freebsd-ports/tree/tdesktop/net-im/telegram-desktop/files
> 
> Thanks, merely adding the media_view_pip.cpp patch to 4.0.0 without any
> other Qt related patches fixes the Qt5 build on OpenBSD, thanks.
> 
> So that should help updating to 4.0.0, but it still doesn't fix
> regressions with Qt6.

I haven't had much time to poke at cwm yet...

> I can test and update tdesktop to 4.0.0 using Qt5 to drop our current
> patches, then I could send a simpler FLAVOR diff to add -qt6.

Here's the FLAVOR diff I'll commit in two days unless I hear objections.


Index: net/Makefile
===================================================================
RCS file: /cvs/ports/net/Makefile,v
retrieving revision 1.1308
diff -u -p -r1.1308 Makefile
--- net/Makefile        28 Jun 2022 12:58:07 -0000      1.1308
+++ net/Makefile        30 Jun 2022 14:52:13 -0000
@@ -696,6 +696,7 @@
      SUBDIR += tcptrace
      SUBDIR += tcptraceroute
      SUBDIR += tdesktop
+     SUBDIR += tdesktop,qt6
      SUBDIR += tdlib
      SUBDIR += telegram-purple
      SUBDIR += telepathy
Index: net/tdesktop/Makefile
===================================================================
RCS file: /cvs/ports/net/tdesktop/Makefile,v
retrieving revision 1.33
diff -u -p -r1.33 Makefile
--- net/tdesktop/Makefile       25 Jun 2022 21:33:46 -0000      1.33
+++ net/tdesktop/Makefile       1 Jul 2022 11:33:14 -0000
@@ -6,6 +6,7 @@ NOT_FOR_ARCHS =         ${BE_ARCHS} i386
 COMMENT =              Telegram Desktop messenger
 PORTROACH =            limit:-full$$
 V =                    4.0.2
+REVISION =             0
 DISTNAME =             tdesktop-${V}-full
 PKGNAME =              ${DISTNAME:-full=}
 CATEGORIES =           net
@@ -22,12 +23,10 @@ MAINTAINER =                Andrew Krasavin <noiseless
 # rlottie: LGPL 2.1 with freetype, LGPL, MIT, BSD dependencies
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += ${COMPILER_LIBCXX} Qt5Core Qt5Gui Qt5Network Qt5Svg
-WANTLIB += Qt5Widgets absl_strings avcodec avformat avutil c crypto
-WANTLIB += gio-2.0 giomm-2.4 glib-2.0 glibmm-2.4 gobject-2.0 hunspell-1.7
-WANTLIB += jpeg lz4 m openal qrcodegencpp rnnoise sigc-2.0 swresample
-WANTLIB += swscale tg_owt xcb xcb-keysyms xcb-record xcb-screensaver
-WANTLIB += xxhash z
+WANTLIB += ${COMPILER_LIBCXX} absl_strings avcodec avformat avutil c crypto
+WANTLIB += gio-2.0 giomm-2.4 glib-2.0 glibmm-2.4 gobject-2.0 hunspell-1.7 jpeg
+WANTLIB += lz4 m openal qrcodegencpp rnnoise sigc-2.0 swresample swscale tg_owt
+WANTLIB += xcb xcb-keysyms xcb-record xcb-screensaver xxhash z
 
 # C++17 set below
 COMPILER =             base-clang ports-gcc
@@ -36,8 +35,7 @@ COMPILER =            base-clang ports-gcc
 # CCACHE_ENV +=                CCACHE_SLOPPINESS=pch_defines,time_macros
 
 MODULES =              devel/cmake \
-                       lang/python \
-                       x11/qt5
+                       lang/python
 MODPY_RUNDEP =         No
 
 BUILD_DEPENDS =                devel/microsoft-gsl \
@@ -55,12 +53,10 @@ LIB_DEPENDS =               archivers/lz4 \
                        graphics/qr-code-generator>=1.7.0p1 \
                        net/tg_owt>=0.0.0.20220507 \
                        sysutils/xxhash \
-                       textproc/hunspell \
-                       x11/qt5/qtsvg
+                       textproc/hunspell
 
 RUN_DEPENDS =          devel/desktop-file-utils \
-                       x11/gtk+3,-guic \
-                       x11/qt5/qtimageformats
+                       x11/gtk+3,-guic
 
 # look for system libraries and build a shared library, despite upstream
 # treating it as "community effort" with less support
@@ -74,8 +70,7 @@ CONFIGURE_ARGS +=     -DTDESKTOP_API_ID=6113
 
 # disable unported/unwanted components
 CONFIGURE_ARGS +=      -DDESKTOP_APP_DISABLE_JEMALLOC=ON \
-                       -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=ON \
-                       -DDESKTOP_APP_QT6=OFF
+                       -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=ON
 
 # match standard version with abseil
 CONFIGURE_ARGS +=      -DCMAKE_CXX_STANDARD=17
@@ -90,6 +85,41 @@ CFLAGS +=            -DIOAPI_NO_64
 
 # unported and required
 NEEDED_BUNDLES +=      rlottie tgcalls
+
+
+FLAVORS =              qt6
+FLAVOR ?=              # empty/qt5
+.if ${FLAVOR:Mqt6}
+# avoid conflict with unflavored package to allow installing both
+FULLPKGNAME =          tdesktop${FLAVOR_EXT}-${V}
+WANTLIB += Qt6Core Qt6Core5Compat Qt6Gui Qt6Network Qt6OpenGL Qt6OpenGLWidgets
+WANTLIB += Qt6Svg Qt6Widgets
+
+MODULES +=             x11/qt6
+LIB_DEPENDS +=         x11/qt6/qt5compat \
+                       x11/qt6/qtsvg
+RUN_DEPENDS +=         x11/qt6/qtimageformats
+
+post-install:
+       mv ${PREFIX}/bin/telegram-desktop{,${FLAVOR_EXT}}
+       mv ${PREFIX}/share/applications/telegramdesktop{,${FLAVOR_EXT}}.desktop
+       sed -i \
+           -e /Name=/s,$$,' (${FLAVOR_EXT})', \
+           -e /Exec=/s,desktop,\&${FLAVOR_EXT}, \
+           -e /Icon=/s,$$,${FLAVOR_EXT}, \
+           ${PREFIX}/share/applications/telegramdesktop${FLAVOR_EXT}.desktop
+       find ${PREFIX} -type f -name telegram.png -execdir \
+           mv {} telegram${FLAVOR_EXT}.png \;
+       mv ${PREFIX}/share/metainfo/telegramdesktop{,${FLAVOR_EXT}}.metainfo.xml
+.else
+WANTLIB += Qt5Core Qt5Gui Qt5Network Qt5Svg Qt5Widgets
+
+MODULES +=             x11/qt5
+LIB_DEPENDS +=         x11/qt5/qtsvg
+RUN_DEPENDS +=         x11/qt5/qtimageformats
+CONFIGURE_ARGS +=      -DDESKTOP_APP_QT6=OFF
+.endif
+
 
 post-extract:
        # All bundles:
Index: net/tdesktop/pkg/DESCR
===================================================================
RCS file: /cvs/ports/net/tdesktop/pkg/DESCR,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 DESCR
--- net/tdesktop/pkg/DESCR      26 Jan 2022 19:38:06 -0000      1.1.1.1
+++ net/tdesktop/pkg/DESCR      1 Jul 2022 11:29:08 -0000
@@ -1,2 +1,6 @@
 Telegram Desktop is the official desktop client for the Telegram messenger,
 based on the Telegram API and the MTProto secure protocol.
+
+Available flavors:
+
+  qt6: Built against Qt 6 (default upstream) instead of Qt 5
Index: net/tdesktop/pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/tdesktop/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- net/tdesktop/pkg/PLIST      9 Mar 2022 16:48:18 -0000       1.2
+++ net/tdesktop/pkg/PLIST      25 Jun 2022 21:35:19 -0000
@@ -1,13 +1,13 @@
-@bin bin/telegram-desktop
-share/applications/telegramdesktop.desktop
-share/icons/hicolor/128x128/apps/telegram.png
-share/icons/hicolor/16x16/apps/telegram.png
-share/icons/hicolor/256x256/apps/telegram.png
-share/icons/hicolor/32x32/apps/telegram.png
-share/icons/hicolor/48x48/apps/telegram.png
-share/icons/hicolor/512x512/apps/telegram.png
-share/icons/hicolor/64x64/apps/telegram.png
+@bin bin/telegram-desktop${FLAVOR_EXT}
+share/applications/telegramdesktop${FLAVOR_EXT}.desktop
+share/icons/hicolor/128x128/apps/telegram${FLAVOR_EXT}.png
+share/icons/hicolor/16x16/apps/telegram${FLAVOR_EXT}.png
+share/icons/hicolor/256x256/apps/telegram${FLAVOR_EXT}.png
+share/icons/hicolor/32x32/apps/telegram${FLAVOR_EXT}.png
+share/icons/hicolor/48x48/apps/telegram${FLAVOR_EXT}.png
+share/icons/hicolor/512x512/apps/telegram${FLAVOR_EXT}.png
+share/icons/hicolor/64x64/apps/telegram${FLAVOR_EXT}.png
 share/metainfo/
 @tag update-desktop-database
 @tag gtk-update-icon-cache %D/share/icons/hicolor
-share/metainfo/telegramdesktop.metainfo.xml
+share/metainfo/telegramdesktop${FLAVOR_EXT}.metainfo.xml

Reply via email to