Bug 257290

Summary: net-im/telegram-desktop: Update to 2.8.11
Product: Ports & Packages Reporter: Henry Hu <henry.hu.sh>
Component: Individual Port(s)Assignee: Li-Wen Hsu <lwhsu>
Status: Closed FIXED    
Severity: Affects Only Me CC: dmitry.wagin, lwhsu, xxjack12xx
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://github.com/telegramdesktop/tdesktop/releases/tag/v2.8.11
Bug Depends on: 257289    
Bug Blocks:    
Attachments:
Description Flags
Patch to 2.8.11
henry.hu.sh: maintainer-approval+
Patch to 2.8.11
henry.hu.sh: maintainer-approval+
Compilation error
none
patch to fix build with libabsl installed
henry.hu.sh: maintainer-approval+
patch to add dependencies to telegram-desktop henry.hu.sh: maintainer-approval+

Description Henry Hu 2021-07-20 00:02:22 UTC
Created attachment 226560 [details]
Patch to 2.8.11

Update to 2.8.11. This must be committed together with PR 257289, which updates tg_owt.

* New dependency, rnnoise
* It starts using jemalloc. For FreeBSD, we can use the system one. We also don't need to link against jemalloc, etc.
* Remove some integrated patches.

Poudriere log for 13.0/amd64: https://raw.githubusercontent.com/HenryHu/ports/master/.logs/13.0-amd64/telegram-desktop-2.8.11.log

Changelog:

2.8.11 (17.07.21)

- Check shader compilation / linking before using ANGLE.

2.8.10 (16.07.21)

- Fix media loading.

2.8.9 (16.07.21)

- Fix GIF caption edit.
- Fix version on Windows without SetDefaultDllDirectories.
- Fix fonts on Linux.

2.8.8 (15.07.21)

- Added an image editor. Crop photos or highlight parts of screenshots before sending.

2.8.7 beta (08.07.21)

- (wasn't deployed)

2.8.6 beta (06.07.21)

- Added a simple image editor. Crop photos or highlight parts of screenshots before sending.
- Use Direct3D 9 backend in ANGLE by default (Windows).
- Fix "Show in Finder" not focusing the Finder window (macOS).
- Use GTK from a child process (Linux).

2.8.5 beta (02.07.21)

- Use ANGLE for OpenGL over DirectX 9 / DirectX 11 (Windows).
- Use GTK from a child process (Linux).

2.8.4 (01.07.21)

- Crash fixes in WebView on Windows.

2.8.3 (28.06.21)

- Fix crashes in OpenSSL on macOS.

2.8.2 (27.06.21)

- Attempt to fix random crashes on macOS.

2.8.1 (26.06.21)

- Fix crash in audio player volume slider.

2.8 (24.06.21)

- Start video conferences from Voice Chats in any group.
- Share your screen or video from your camera with up to 30 participants (limit to be increased soon).
- Talk without video with an unlimited number of participants.
- Create voice chats from the info page of any group where you are an admin.
- Group video calls are supported natively on all devices, including iPads and laptops.

2.7.10 beta (22.06.21)

- Added ability to mix together bold, italic and other formatting.
- Fix voice chats and video calls OpenGL with some drivers on Windows.
- Several bug fixes.

2.7.9 beta (17.06.21)

- Added "Enable noise suppression" option to group calls Settings.
- Fix media viewer with Retina + Non-Retina dual monitor setup on macOS.
- Several bug and crash fixes.

2.7.8 beta (11.06.21)

- Crash fixes.

2.7.7 beta (11.06.21)

- Optimized video playback in media viewer and Picture-in-Picture mode.
- Added integration with System Media Transport Controls on Windows 10.
- Added "Now Playing" integration for music playback on macOS.
- Added "Archive Sticker" into the "..." menu of the Sticker Set Box.
- Fixed memory not being freed on Linux.
- Several crash fixes.

2.7.6 beta (31.05.21)

- Optimized video playback in media viewer and Picture-in-Picture on Windows and Linux.
- Added integration with System Media Transport Controls on Windows 10.
- Added "Archive Sticker" into the "..." menu of the Sticker Set Box.
- Fixed memory not being freed on Linux.
- Several crash fixes.

2.7.5 beta (04.05.21)

- Add "Voice chats" filter in "Recent actions" for channels.
- Write local drafts to disk on a background thread.
- Support autoupdate for Telegram in write-protected folders on Linux.
- Fix crash in native notifications on Linux.
- Fix crash in file dialog on Linux.
Comment 1 Henry Hu 2021-07-21 01:58:57 UTC
Created attachment 226575 [details]
Patch to 2.8.11

Updated patch. I've added 2 patches so that it now builds on FreeBSD 12 (with LLVM 10). One class specifies both operator== and operator!=. As a result, Clang 10 thinks that it's ambiguous. Clang 11 is fine.

I'm not sure if we need to add the additional dependencies reported by stage-qa. IMO, they're dependencies of tg_owt, not telegram-desktop. They're included because telegram is statically linked, so the libraries are carried here.
As we've already added them to tg_owt, maybe we should not dup them here?
Comment 3 commit-hook freebsd_committer 2021-07-21 19:32:21 UTC
A commit in branch main references this bug:

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

commit 4c4c9a818b894f8d37374e4d5ccfcb1f628dfb52
Author:     Henry Hu <henry.hu.sh@gmail.com>
AuthorDate: 2021-07-21 19:30:54 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2021-07-21 19:30:54 +0000

    net-im/telegram-desktop: Update to 2.8.11

    * New dependency, rnnoise
    * It starts using jemalloc. For FreeBSD, we can use the system one. We
      also don't need to link against jemalloc, etc.
    * Remove some integrated patches.

    PR:             257290

 net-im/telegram-desktop/Makefile                           |  4 ++--
 net-im/telegram-desktop/distinfo                           |  6 +++---
 ...am_SourceFiles_platform_linux_specific__linux.cpp (new) | 11 +++++++++++
 ...h-Telegram_ThirdParty_tgcalls_tgcalls_Manager.cpp (new) | 13 +++++++++++++
 ...tch-Telegram_ThirdParty_tgcalls_tgcalls_Manager.h (new) | 10 ++++++++++
 ...w_platform_linux_webview__linux__webkit__gtk.cpp (gone) | 11 -----------
 ...iew_platform_linux_webview__linux__webkit__gtk.h (gone) | 13 -------------
 .../files/patch-cmake_external_CMakeLists.txt (new)        | 12 ++++++++++++
 .../files/patch-cmake_options__linux.cmake (new)           | 14 ++++++++++++++
 9 files changed, 65 insertions(+), 29 deletions(-)
Comment 4 Jack 2021-07-25 09:54:56 UTC
Created attachment 226674 [details]
Compilation error

I'm getting a compilation error on 13.0-STABLE

FreeBSD 13.0-STABLE #0 stable/13-n246270-cd2e5ae71bb1: Wed Jul 14 23:39:18 PDT 2021

===> The following configuration options are available for telegram-desktop-2.8.11:
     GTK=off: Gtk integration (Use Gtk dialogs, etc.)
====> Audio backend for voice calls: you have to choose at least one of them
     ALSA=off: ALSA audio architecture support
     PULSEAUDIO=on: PulseAudio sound server support
===> Use 'make config' to modify these settings
Comment 5 Li-Wen Hsu freebsd_committer 2021-07-25 10:21:27 UTC
to check https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257290#c4
Comment 6 Dmitry Wagin 2021-07-25 18:54:05 UTC
Missing dependency from pipewire

after pkg autoremove:

ld-elf.so.1: Shared object "libpipewire-0.3.so.0" not found, required by "telegram-desktop"
Comment 7 Henry Hu 2021-07-25 19:06:49 UTC
(In reply to Dmitry Wagin from comment #6)
Ah, now I see the dependency issue is tricky.
pipewire is a runtime dependency of tg_owt.
But I marked tg_owt as only a build time dependency of telegram-desktop, as it builds libtg_owt.a, which is statically linked to telegram-desktop.
As a result, tg_owt would be removed with autoremove after building telegram-desktop. In turn, pipewire would be auto-removed as well.
However, telegram-desktop gets the runtime requirement from tg_owt.

It can be fixed in one way or the other:
1. make tg_owt a runtime dependency of telegram-desktop
This will keep all its runtime dependencies.
2. add the runtime dependencies of tg_owt to telegram-desktop
I'd rather not do this as we're duplicating these in both ports; on the other hand, it allows you to remove the tg_owt static library, which is not used.
3. check if tg_owt can be made into a shared library
It does have this option; maybe we should explore this possibility.

For now, we can choose option 1) first, by moving tg_owt from build dep to lib dep; this would fix the dependency issue, and if in the future we make it a shared lib, it'll still work.
Comment 8 Henry Hu 2021-07-25 19:09:58 UTC
(In reply to Jack from comment #4)
This is interesting. It's trying to find the symbols of absl 20210324, which seems to be the ports version (https://www.freshports.org/devel/abseil), while tg_owt should have linked with its internal version (which, as I remember, disabled the version-specific namespace).

Questions:
1. Do you have the abseil from ports installed?
2. Did you build and install tg_owt first?

My machine also has abseil installed, so I think it should work fine even if the port version is installed, but maybe something is missed.
Comment 9 Jack 2021-07-25 23:10:07 UTC
I have abseil-20210324.2 installed and tg_owt was built and installed first.

I did a portupgrade to upgrade everything and then discovered the failure but manually building it also fails.
Comment 10 Henry Hu 2021-07-26 03:07:30 UTC
Created attachment 226698 [details]
patch to fix build with libabsl installed

(In reply to Jack from comment #9)
I realized that I should not remove the old patch of tg_owt; I thought this problem was fixed, but not really.
The patch restores the code to add the included libabsl to the beginning of the include paths, thus tg_owt would be compiled with the included libabsl's headers, not the ones from port.
Please test it to see if it fixes your problem. I've built tg_owt, then telegram-desktop, on 13, successfully with it.
It also added some new dependencies; I realized that these are new ones and should be added.
Comment 11 Jack 2021-07-26 03:31:56 UTC
Patch fixed the compilation error.
Comment 12 commit-hook freebsd_committer 2021-07-27 19:12:52 UTC
A commit in branch main references this bug:

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

commit f8a92dabbfdb03b6b67f190bef193cc58e99f0ae
Author:     Henry Hu <henry.hu.sh@gmail.com>
AuthorDate: 2021-07-27 19:11:20 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2021-07-27 19:11:20 +0000

    net-im/tg_owt: Adding missing dependencies and revive a required patch

    PR:             257290

 net-im/tg_owt/Makefile                         |  5 ++++-
 net-im/tg_owt/files/patch-CMakeLists.txt (new) | 12 ++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
Comment 13 Henry Hu 2021-07-28 01:17:59 UTC
Created attachment 226748 [details]
patch to add dependencies to telegram-desktop

So, I don't like the idea of copying all the dependencies of tg_owt over.
But I don't like stage-qa to report so many missing dependencies as well.
And making tg_owt a runtime dep of telegram-desktop is also strange, as it's statically linked.

This patch takes the approach of copying the dependencies of tg_owt over to telegram-desktop.
So now you're free to delete tg_owt, after installing telegram-desktop.

stage-qa still reports some missing deps:
* libsoup
* harfbuzz
* cairo
I don't see these deps used anywhere in telegram-desktop or tg_owt. Reading the code, they seem to be introduced by gtk3 and/or webkit2-gtk3. Since they already depend on these libraries, I'll not mark them as dependencies.
Comment 14 Li-Wen Hsu freebsd_committer 2021-07-28 01:32:41 UTC
Reopen for comment #13
Comment 15 commit-hook freebsd_committer 2021-08-09 05:29:12 UTC
A commit in branch main references this bug:

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

commit 529b6b1239ef88cd68cfe71f5df4e9057e294cb6
Author:     Henry Hu <henry.hu.sh@gmail.com>
AuthorDate: 2021-08-07 04:47:33 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2021-08-09 05:24:13 +0000

    net-im/telegram-desktop: Copying dependencies of tg_owt over to telegram-desktop

    tg_owt is statically linked but there are some its LIB_DEPENDS still
    needed by telegram-desktop

    PR:             257290

 net-im/telegram-desktop/Makefile | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Comment 16 commit-hook freebsd_committer 2021-08-09 07:38:37 UTC
A commit in branch main references this bug:

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

commit ed576bf5cf3e7abcb935f1905160c72ad03c390a
Author:     Li-Wen Hsu <lwhsu@FreeBSD.org>
AuthorDate: 2021-08-09 06:25:51 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2021-08-09 07:37:53 +0000

    net-im/telegram-desktop: Bump PORTREVISION for 529b6b1239ef

    PR:             257290

 net-im/telegram-desktop/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)