Created attachment 188637 [details] shar file for the new port This is the official telegram desktop application. Telegram is a messaging platform. This port is based on arch package (https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=telegram-desktop-systemqt), which seems to be based on debian package. The official instructions to build the application asks users to get source for all the libraries and statically link them. This version dynamically links all the libraries. Modifications in the patch: * Treat FreeBSD as Linux in all the build systems and source codes * Disable libappindicator * Disable LTO (link time optimization). The default linker does not support it yet. * Disable setting socket priority * Change some global variables into static variables of static methods. This removes the dependency on global constructor order. Otherwise, the constructor order leads to use of uninitialized objects. * Other changes in the original Arch Linux patch to enable dynamic linking.
Created attachment 188638 [details] poudriere log
All default I got: This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". But I have /usr/local/lib/qt5/plugins/platforms/libqxcb.so and it looks good.
(In reply to Rin Cat from comment #2) okay, I don't know why I have QT_PLUGIN_PATH set in environment, but I have it, and it is QT_PLUGIN_PATH=/usr/local/lib/plugins:/usr/local/lib/qt5/plugins: I think that if you set it it would work. I'll fix the port.
(In reply to Henry Hu from comment #3) It fixed. Thanks. Maybe because I am not using a full DE. Also it missed icons and .desktop for menu.
(In reply to Rin Cat from comment #4) Well, this port only installs the executable itself. It seems like that Arch's desktop is created by them. Do you think that it would be helpful?
Created attachment 188642 [details] new patch The old version does not set qt plugin path correctly. This one fixes it.
(In reply to Henry Hu from comment #5) It definitely helpful. .desktop and .protocol could handle the tg:// protocol.
(In reply to Henry Hu from comment #5) Forgot to say no login issue anymore :)
Created attachment 188672 [details] updated shar Latest patch. This one, unlike the arch package, installs tg.protocol, telegramdesktop.desktop, and telegramdesktop.appdata.xml from lib/xdg in the source code. To match those files, the executable name is renamed to telegram-desktop. This would conflict with linux-telegram-desktop, but since we have the native version, why do we need the linux version :) A poudriere run is ongoing.
Created attachment 188674 [details] new poudriere log The latest run of poudriere is successful.
Hi Henry, Thanks for your submission. It breaks for me in poudriere on 11.1 and64: > /wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-1.1.23/Telegram/SourceFiles/lang/lang_file_parser.cpp:32:13: error: constructor for 'Lang::FileParser' must explicitly initialize the const member '_callback' > FileParser::FileParser(const QString &file, const std::set<LangKey> &request) > ^ > /wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-1.1.23/out/Release/../../Telegram/SourceFiles/lang/lang_file_parser.h:60:71: note: '_callback' declared here > const base::lambda<void(QLatin1String key, const QByteArray &value)> _callback; > ^
Created attachment 188679 [details] Updated shar I sorted *_DEPENDS/USE* clauses. Please always keep them sorted. portmgr@ complains when they aren't sorted. Also, new ports should have DISTVERSION, not PORTVERISON. And no 'Created by' clauses any more.
Created attachment 188680 [details] Updated shar
Sorry, the previous podriete failure was on 11.0-RELEASE-p7, not 11.1. It also fails in poudriere on 10.3-RELEASE-p21 i386: > error: invalid value 'gnu++14' in '-std=gnu++14' > gmake[3]: *** [CMakeFiles/codegen_style.dir/build.make:66: > CMakeFiles/codegen_style.dir/wrkdirs/usr/ports/net-im/telegram-desktop/work/tdesktop-1.1.23/Telegram/SourceFiles/codegen/common/bas It should build in poudriere on 10 and 11.
It passes 11.1 amd64 poudriere, so 11 is ok. But 10 build needs to be fixed.
Replacing with clang40 compiler on 10 will likely help. I am rebuilding it now, and will proceed if successful.
(In reply to Yuri Victorovich from comment #16) Thank you for your advises. I was considering gcc49 or some later gcc.
(In reply to Henry Hu from comment #17) You are welcome! I have another question: Makefile has USE_GNOME, it looks for gnome during configuration, but it doesn't link with gnome libraries at all. If you remove USE_GNOME during stage-qa it doesn't complain, which means that it doesn't link executable with gnome. So why then does it needs gnome at all? Is this a mistake, or an upstream bug?
(In reply to Yuri Victorovich from comment #18) For me, glib20 is required and it is linked into the binary. For gtk30, it checks for it during build (through pkg-config), and dynamically loads the library when running. It is possible that we can change it to a build dependency, but notifications may not work.
Henry, Where do patches patch-lib_xdg_tg.protocol patch-libtgvoip patch-tdesktop come from? They are not the same patches that Arch has, and there is no pull request, so I am wondering how did you generate them?
(In reply to Yuri Victorovich from comment #20) I copied those patch from arch, then added some extra changes to make them work with freebsd. The changes are listed in the first post. patch-lib_xdg_tg.protocol is my own patch. It just removes /usr/bin from the executable path.
Created attachment 188698 [details] Updated shar
Created attachment 188701 [details] patch
Some notes for the future: * INSTALLS_ICONS=yes is only needed for gnome-based apps. Telegram is not gnome-based. * Github clauses look better when GH_TUPLE is used * tcberner@ found that additionally %%QT_BINDIR%%, %%QT_INCDIR%%, %%QT_LIBDIR%%, %%QMAKESPEC%% can be used in gyp files * You will need to make sure that telegram actually finds gtk libraries and pulseaudio during runtime that it uses during build * ALSA libs are dysfunctional on FreeBSD, and need to be patched away if possible * After the port is committed, you will need to update to the newer version that is already available Thank you for porting telegram! I looked into porting it myself before, but they required the customely patched Qt and this discouraged me.
(In reply to Yuri Victorovich from comment #24) Thanks! I'll look into v1.2.
Committed with some changes. Thank you for your great work, Henry!
A commit references this bug: Author: yuri Date: Mon Dec 18 23:35:47 UTC 2017 New revision: 456694 URL: https://svnweb.freebsd.org/changeset/ports/456694 Log: New port: net-im/telegram-desktop: Telegram Desktop messaging app PR: 224193 Submitted by: Henry Hu <henry.hu.sh@gmail.com> Approved by: adamw (mentor) Differential Revision: https://reviews.freebsd.org/D13434 Changes: head/net-im/Makefile head/net-im/telegram-desktop/ head/net-im/telegram-desktop/Makefile head/net-im/telegram-desktop/distinfo head/net-im/telegram-desktop/files/ head/net-im/telegram-desktop/files/CMakeLists.inj head/net-im/telegram-desktop/files/gyp-patches head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles___other_packer.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_base_build__config.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_base_lambda.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_config.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_layout.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_logs.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_main.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_mainwindow.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_linux__libs.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_linux__libs.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_main__window__linux.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__audio.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__file__utilities.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__main__window.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__notifications__manager.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__specific.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_platform__window__title.h head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_qt__functions.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_qt__static__plugins.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_structs.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_ui_text_text.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_ui_text_text__block.cpp head/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_ui_twidget.cpp head/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioInput.cpp head/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioOutput.cpp head/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_os_posix_NetworkSocketPosix.cpp head/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_threading.h head/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_webrtc__dsp_webrtc_base_stringutils.h head/net-im/telegram-desktop/files/patch-Telegram_gyp_PrecompiledHeader.cmake head/net-im/telegram-desktop/files/patch-Telegram_gyp_common.gypi head/net-im/telegram-desktop/files/patch-Telegram_gyp_settings__linux.gypi head/net-im/telegram-desktop/files/patch-Telegram_gyp_telegram__sources.txt head/net-im/telegram-desktop/files/patch-lib_xdg_tg.protocol head/net-im/telegram-desktop/pkg-descr head/net-im/telegram-desktop/pkg-plist