Subject: Re: [bug#71897] [PATCH v8 8/8] gnu: telegram-desktop: Update to 5.5.5.

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 22 Sep 2024 12:22:26 +0900

Hi,

dan <[email-masked]> writes:

> * gnu/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch:
> Update patch file to match upstream changes.
> *
> gnu/packages/patches/webrtc-for-telegram-desktop-unbundle-libsrtp.patch:
> Update patch file to match upstream changes.
> * gnu/packages/patches/telegram-desktop-unbundle-cppgir.patch: New file.
> * gnu/packages/patches/telegram-desktop-unbundle-gsl.patch: New file.

I suppose these patches are from upstream?  For extra origin tracking, I
like to add a URL to the upstream URL they were fetched from, or at
least a comment mentioning this is committed but unreleased in the main
repo.

[...]

>  (define-public webrtc-for-telegram-desktop
> -  (let ((commit "0532942ac6176a66ef184fb728a4cbb02958fc0b")
> -        (revision "389"))
> +  (let ((commit "c425281150317753d7bc5182c6572abe20f9a784")
> +        (revision "456"))
>      (hidden-package
>       (package
>         (name "webrtc-for-telegram-desktop")
> @@ -285,7 +291,7 @@ (define-public webrtc-for-telegram-desktop
>            (file-name
>             (git-file-name name version))
>            (sha256
> -           (base32 "0fary99yl1ddk5zjpfy0pyb5brd268j41plcnvv9qjyf0wj9hf2k"))
> +           (base32 "1fj48iq56awnrckncy1qc3zhdzifl725hbb6an7wg2v3zmagvrwn"))
>            (patches
>             (search-patches
>              ;; https://github.com/desktop-app/tg_owt/pull/123
> @@ -407,7 +413,7 @@ (define libprisma-for-telegram-desktop
>           (url "https://github.com/desktop-app/libprisma")
>           (commit "23b0d70f9709da9b38561d5706891a134d18df76")))
>     (file-name
> -    (git-file-name "libprisma-for-telegram-desktop" "5.3.2"))
> +    (git-file-name "libprisma-for-telegram-desktop" %telegram-version))
>     (sha256
>      (base32
>       "0fg4x4ikj7f3706bmfvkwq4smxc98qr3cgpm25w48n4ys6wfgadg"))))
> @@ -427,7 +433,7 @@ (define-public telegram-desktop
>         (file-name
>          (git-file-name name version))
>         (sha256
> -        (base32 "0g47ffamh1csp79yzkv28v3qjkhjacj0c7pjf53n1ks80j5hc2j0"))
> +        (base32 "12fdybn085s3i3a8hwi0bmdns7jxvg0k662n04jgffirgsz8n54m"))
>         (patches
>          (search-patches
>           ;; https://github.com/telegramdesktop/tdesktop/pull/24126
> @@ -468,7 +474,10 @@ (define-public telegram-desktop
>                "-DTDESKTOP_DISABLE_LEGACY_TGVOIP=ON"
>                "-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON"
>                "-DDESKTOP_APP_DISABLE_AUTOUPDATE=ON"
> -              "-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=ON")
> +              "-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=ON"
> +              ;; enabling jemalloc causes SIGSEGV.  this probably happened
> +              ;; after upgrading to glibc 2.39.
> +              "-DDESKTOP_APP_DISABLE_JEMALLOC=ON")

Nitpick: Please use fully punctuated complete sentences for stand alone
comments (the ones on their own lines -- inline comments (trailing at
the end of line are OK to be incomplete sentence))

>             #:phases
>             #~(modify-phases %standard-phases
>                 (add-after 'unpack 'unpack-additional-sources
> @@ -493,21 +502,45 @@ (define-public telegram-desktop
>                        ("Telegram/lib_webrtc" #$lib-webrtc-for-telegram-desktop)
>                        ("Telegram/lib_webview" #$lib-webview-for-telegram-desktop)
>                        ("Telegram/ThirdParty/cld3" #$cld3-for-telegram-desktop)
> +                      ("Telegram/ThirdParty/libprisma" #$libprisma-for-telegram-desktop)
>                        ("Telegram/ThirdParty/tgcalls" #$tgcalls-for-telegram-desktop)))))
> +               (add-after 'unpack-additional-sources 'patch-gir-ignore-paths
> +                 (lambda _
> +                   (substitute* "cmake/external/glib/generate_cppgir.cmake"
> +                     (("\\$\\{cmake_helpers_loc\\}/external/glib/cppgir/data")
> +                      (string-append #$(this-package-input "cppgir") "/share/cppgir")))))
> +               (add-after 'unpack-additional-sources 'use-system-xdg-desktop-portal
> +                 (lambda _
> +                   (substitute* (list "Telegram/CMakeLists.txt"
> +                                      "Telegram/lib_base/CMakeLists.txt")
> +                     (("\\$\\{third_party_loc\\}/xdg-desktop-portal/data")
> +                      (string-append #$(this-package-native-input "xdg-desktop-portal")
> +                                     "/share/dbus-1/interfaces")))))
> +               ;; has to remove this constexpr otherwise cannot compile with gcc-final

Ditto (same comment as above).

> +               (add-after 'use-system-xdg-desktop-portal 'patch-libwebview
> +                 (lambda _
> +                   (substitute* "Telegram/lib_webview/webview/webview_interface.h"
> +                     (("constexpr ") ""))))

GCC should know about constexpr; perhaps the wrong C++ standard (can be
provided via a CMake flag) is being selected, or alternatively you could
provide a newer gcc compiler native inputs?

>                 (add-after 'install 'glib-or-gtk-compile-schemas
>                   (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
>                 (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
>                   (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
>      (native-inputs
> -     (list `(,glib "bin")
> +     (list cpp-ada-url-parser
> +           `(,glib "bin")
> +           gobject-introspection
>             `(,gtk+ "bin")
>             pkg-config
> -           python-wrapper))
> +           python-wrapper
> +           xdg-desktop-portal))
>      (inputs
>       (list abseil-cpp-cxxstd17
>             alsa-lib
> +           boost
>             c++-gsl
> +           cppgir-for-telegram-desktop
>             crc32c
> +           expected-lite
>             fcitx-qt5
>             fcitx5-qt
>             ffmpeg
> @@ -516,7 +549,6 @@ (define-public telegram-desktop
>             gtk+

No GTK 4 support yet?

>             hime
>             hunspell
> -           jemalloc
>             kcoreaddons-5
>             kimageformats-5
>             libdispatch

Thanks for this undertaking.  It looks nearly good to go, with my little
comments/concerns ideally addressed.

-- 
Thanks,
Maxim