git: 80762637bb7d - main - net-im/telegram-desktop: fix build with GTK option

Charlie Li vishwin at FreeBSD.org
Fri May 14 03:05:26 UTC 2021


The branch main has been updated by vishwin:

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

commit 80762637bb7d34dcc3e8049b869db0908f404b2c
Author:     Charlie Li <vishwin at FreeBSD.org>
AuthorDate: 2021-05-12 04:21:02 +0000
Commit:     Charlie Li <vishwin at FreeBSD.org>
CommitDate: 2021-05-14 02:48:39 +0000

    net-im/telegram-desktop: fix build with GTK option
    
    Telegram now includes a WebView feature when GTK is enabled, which
    uses www/webkit2-gtk3.
    
    While here, fix the following minor items:
    - allow building with Python newer than 3.7
    - devel/dee is not needed for build, remove
    - clean up USES= syntax in the GTK option
    
    Obtained from:  https://github.com/desktop-app/lib_webview/commit/0b4100d7cecc4e748c51f3f51ebfd1392ec3978a
                    https://github.com/desktop-app/lib_webview/commit/48d70e5258754b2415b07c88f0376212596e09a7
    Approved by:    Henry Hu <henry.hu.sh at gmail.com> (maintainer),
                    arrowd (mentor), fluffy (mentor)
    PR:             255719
    Differential Revision: https://reviews.freebsd.org/D30224
---
 net-im/telegram-desktop/Makefile                     | 11 +++--------
 ...ew_platform_linux_webview__linux__webkit__gtk.cpp | 20 ++++++++++++++++++++
 ...view_platform_linux_webview__linux__webkit__gtk.h | 13 +++++++++++++
 3 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/net-im/telegram-desktop/Makefile b/net-im/telegram-desktop/Makefile
index ddbc4ec6c8e9..b635bbefee83 100644
--- a/net-im/telegram-desktop/Makefile
+++ b/net-im/telegram-desktop/Makefile
@@ -16,7 +16,6 @@ NOT_FOR_ARCHS=		powerpc powerpc64 powerpcspe
 NOT_FOR_ARCHS_REASON=	Only little endian is supported
 
 BUILD_DEPENDS=	alsa-lib>0:audio/alsa-lib \
-		dee>0:devel/dee \
 		microsoft-gsl>0:devel/microsoft-gsl \
 		pulseaudio>0:audio/pulseaudio \
 		range-v3>0:devel/range-v3 \
@@ -40,7 +39,7 @@ LIB_DEPENDS=	libavformat.so:multimedia/ffmpeg \
 		libxxhash.so:devel/xxhash
 
 USES=		cmake compiler:c++17-lang desktop-file-utils gl \
-		gnome pkgconfig python:3.7,build qt:5 ssl xorg
+		gnome pkgconfig python:3.7+,build qt:5 ssl xorg
 
 USE_GITHUB=	nodefault
 GH_ACCOUNT=	telegramdesktop
@@ -81,16 +80,12 @@ GTK_DESC=	Gtk integration (Use Gtk dialogs, etc.)
 
 ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
 GTK_CMAKE_BOOL_OFF=	DESKTOP_APP_DISABLE_GTK_INTEGRATION
+GTK_LIB_DEPENDS=	libwebkit2gtk-4.0.so:www/webkit2-gtk3
+GTK_USE=	GNOME=gtk30
 PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
 
 # Telegram asks each custom build to have its own API ID and hash.
 TELEGRAM_API_HASH=	20a3432aab43f24bb4460fceac5ba38d
 TELEGRAM_API_ID=	601761
 
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MGTK}
-USE_GNOME+=	gtk30
-.endif
-
 .include <bsd.port.mk>
diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.cpp b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.cpp
new file mode 100644
index 000000000000..55842e691436
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.cpp
@@ -0,0 +1,20 @@
+--- Telegram/lib_webview/webview/platform/linux/webview_linux_webkit_gtk.cpp.orig	2021-04-14 05:42:51 UTC
++++ Telegram/lib_webview/webview/platform/linux/webview_linux_webkit_gtk.cpp
+@@ -26,7 +26,7 @@ bool Resolve() {
+ 	auto &gtk = BaseGtkIntegration::Instance()->library();
+ 
+ 	auto webkit2gtk = QLibrary();
+-	const auto result =  LOAD_GTK_SYMBOL(gtk, gtk_widget_get_type)
++	const auto result = LOAD_GTK_SYMBOL(gtk, gtk_widget_get_type)
+ 		&& LOAD_GTK_SYMBOL(gtk, gtk_widget_grab_focus)
+ 		&& LOAD_GTK_SYMBOL(gtk, gtk_container_get_type)
+ 		&& LOAD_GTK_SYMBOL(gtk, gtk_container_add)
+@@ -38,7 +38,7 @@ bool Resolve() {
+ 		&& LOAD_GTK_SYMBOL(gtk, gtk_window_get_type)
+ 		&& LOAD_GTK_SYMBOL(gtk, gtk_window_set_decorated)
+ 		&& LOAD_GTK_SYMBOL(gtk, gdk_x11_window_get_xid)
+-		&& base::Platform::Gtk::LoadLibrary(webkit2gtk, "libwebkit2gtk-4.0.so.37", 0)
++		&& base::Platform::Gtk::LoadGtkLibrary(webkit2gtk, "libwebkit2gtk-4.0.so.37")
+ 		&& LOAD_GTK_SYMBOL(webkit2gtk, webkit_web_view_new)
+ 		&& LOAD_GTK_SYMBOL(webkit2gtk, webkit_web_view_get_type)
+ 		&& LOAD_GTK_SYMBOL(webkit2gtk, webkit_web_view_get_user_content_manager)
diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.h b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.h
new file mode 100644
index 000000000000..64864b80978b
--- /dev/null
+++ b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.h
@@ -0,0 +1,13 @@
+--- Telegram/lib_webview/webview/platform/linux/webview_linux_webkit_gtk.h.orig	2021-04-14 05:42:51 UTC
++++ Telegram/lib_webview/webview/platform/linux/webview_linux_webkit_gtk.h
+@@ -11,9 +11,9 @@
+ extern "C" {
+ #undef signals
+ #include <JavaScriptCore/JavaScript.h>
++#include <gdk/gdkx.h>
+ #include <gtk/gtk.h>
+ #include <webkit2/webkit2.h>
+-#include <X11/Xlib.h>
+ #define signals public
+ } // extern "C"
+ 


More information about the dev-commits-ports-all mailing list