diff mbox series

[bug#57675,v4,09/10] gnu: webrtc-for-telegram-desktop: Update to 621f3d.

Message ID y761qs7rivt.wl-hako@ultrarare.space
State Accepted
Headers show
Series gnu: telegram-desktop: Update to 4.2.0. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Hilton Chain Sept. 19, 2022, 6:13 a.m. UTC
* gnu/packages/patches/webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Add patch.
* gnu/packages/telegram.scm (libvpx-for-telegram-desktop): Remove variable.
(crc32c-for-telegram-desktop): New variable.
(webrtc-for-telegram-desktop): Update to 621f3d.
[patches]: Add webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch.
use system openh264.
[#:configure-flags]: Comment out with default values.
[native-inputs]: Drop perl.
[inputs]: Replace pipewire with pipewire-0.3.
Drop alsa-lib, libx11 and pulseaudio.
Add abseil-cpp-cxxstd17, libvpx, openh264, libdrm, libglvnd, mesa, libxfixes.
[snippet,#:phases,license]: Sync with source tree.
---
 gnu/local.mk                                  |   1 +
 ...r-telegram-desktop-fix-gcc12-cstdint.patch |  21 ++++
 gnu/packages/telegram.scm                     | 103 ++++++++++--------
 3 files changed, 80 insertions(+), 45 deletions(-)
 create mode 100644 gnu/packages/patches/webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch

--
2.37.3
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 542c06e221..ddbfe7de30 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1967,6 +1967,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/warsow-qfusion-fix-bool-return-type.patch	\
   %D%/packages/patches/webkitgtk-adjust-bubblewrap-paths.patch	\
   %D%/packages/patches/webrtc-audio-processing-big-endian.patch	\
+  %D%/packages/patches/webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch   \
   %D%/packages/patches/websocketpp-fix-for-cmake-3.15.patch	\
   %D%/packages/patches/widelands-add-missing-map-include.patch	\
   %D%/packages/patches/widelands-system-wide_minizip.patch	\
diff --git a/gnu/packages/patches/webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch b/gnu/packages/patches/webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch
new file mode 100644
index 0000000000..f1fd29d0d3
--- /dev/null
+++ b/gnu/packages/patches/webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch
@@ -0,0 +1,21 @@ 
+From 86d2bcd7afb8706663d29e30f65863de5a626142 Mon Sep 17 00:00:00 2001
+From: Xiretza <xiretza@xiretza.xyz>
+Date: Sun, 15 May 2022 12:47:41 +0200
+Subject: [PATCH] fix(h265_pps_parser): fix missing cstdint include
+
+---
+ src/common_video/h265/h265_pps_parser.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/common_video/h265/h265_pps_parser.h b/src/common_video/h265/h265_pps_parser.h
+index 28c95ea9..c180b1b9 100644
+--- a/src/common_video/h265/h265_pps_parser.h
++++ b/src/common_video/h265/h265_pps_parser.h
+@@ -12,6 +12,7 @@
+ #define COMMON_VIDEO_H265_PPS_PARSER_H_
+
+ #include "absl/types/optional.h"
++#include <cstdint>
+
+ namespace rtc {
+ class BitBuffer;
diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index f56cbaf23a..7542f6cd17 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -30,6 +30,8 @@  (define-module (gnu packages telegram)
   #:use-module (gnu packages digest)
   #:use-module (gnu packages fcitx)
   #:use-module (gnu packages fcitx5)
+  #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
@@ -58,6 +60,7 @@  (define-module (gnu packages telegram)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xorg)
   #:use-module ((guix licenses) #:prefix license:)
@@ -83,14 +86,6 @@  (define* (source-for-telegram-desktop #:key name url revision commit hash)
       (file-name (git-file-name name version))
       (sha256 (base32 hash)))))

-(define libvpx-for-telegram-desktop
-  (source-for-telegram-desktop
-   #:url "https://chromium.googlesource.com/webm/libvpx"
-   #:revision "0"
-   #:commit "5b63f0f821e94f8072eb483014cfc33b05978bb9"
-   #:hash "1psvxaddihlw1k5n0anxif3qli6zyw2sa2ywn6mkb8six9myrp68"
-   #:name "libvpx"))
-
 (define libyuv-for-telegram-desktop
   (source-for-telegram-desktop
    #:url "https://chromium.googlesource.com/libyuv/libyuv"
@@ -99,6 +94,14 @@  (define libyuv-for-telegram-desktop
    #:hash "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll"
    #:name "libyuv"))

+(define crc32c-for-telegram-desktop
+  (source-for-telegram-desktop
+   #:url "https://github.com/google/crc32c"
+   #:revision "0"
+   #:commit "21fc8ef30415a635e7351ffa0e5d5367943d4a94"
+   #:hash "0cddf8z7v33gfb2k60lkzwa97g20m1v81cnvllm3q9ylpnx8g6f4"
+   #:name "crc32c"))
+
 (define cmake-helpers-for-telegram-desktop
   (source-for-telegram-desktop
    #:url "https://github.com/desktop-app/cmake_helpers.git"
@@ -228,8 +231,8 @@  (define tgcalls-for-telegram-desktop
    #:name "tgcalls"))

 (define-public webrtc-for-telegram-desktop
-  (let ((commit "91d836dc84a16584c6ac52b36c04c0de504d9c34")
-        (revision "166"))
+  (let ((commit "621f3da55331733bf0d1b223786b96b68c03dca1")
+        (revision "167"))
     (hidden-package
      (package
        (name "webrtc-for-telegram-desktop")
@@ -245,55 +248,67 @@  (define-public webrtc-for-telegram-desktop
           (file-name
            (git-file-name name version))
           (sha256
-           (base32 "0plwdp6xgxi27hif5j7kpq425cidxyxbbga3z2f64dsninwy5p1x"))
+           (base32 "1ks1572k1jj7pmzwm79p2gdgi31dd4bs761bphnx32zyq4c6skxk"))
+          (patches
+           (search-patches
+            ;; https://github.com/desktop-app/tg_owt/pull/101
+            "webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch"))
           (modules '((guix build utils)
                      (ice-9 ftw)
                      (srfi srfi-1)))
           (snippet
-           `(begin
-              (let ((keep
-                     '( ;; Custom forks which are incompatible with the ones in Guix.
-                       "abseil-cpp" "libsrtp" "openh264" "rnnoise"
-                       ;; Not available in Guix.
-                       "pffft" "usrsctp"
-                       ;; Has cmake support files for libvpx input.
-                       "libvpx")))
-                (with-directory-excursion "src/third_party"
-                  (for-each delete-file-recursively
-                            (lset-difference string=?
-                                             (scandir ".")
-                                             (cons* "." ".." keep)))))))))
+           #~(begin
+               (let ((keep
+                      '("abseil-cpp" "libsrtp" "rnnoise"
+                        ;; Not available in Guix.
+                        "crc32c" "pffft")))
+                 (with-directory-excursion "src/third_party"
+                   (for-each delete-file-recursively
+                             (lset-difference string=?
+                                              (scandir ".")
+                                              (cons* "." ".." keep)))))
+               ;; Use system openh264.
+               (substitute* "CMakeLists.txt"
+                 (("\\include\\(cmake\\/libopenh264\\.cmake\\)")""))))))
        (build-system cmake-build-system)
        (arguments
-        (list #:tests? #f               ; No target
-              #:configure-flags
-              #~`("-DCMAKE_C_FLAGS=-fPIC"
-                  "-DCMAKE_CXX_FLAGS=-fPIC")
+        (list #:tests? #f       ; No target
+              ;; NOTE: Options commented are default values.
+              ;; See also: comments in inputs.
+              ;; #:configure-flags
+              ;; #~'("-DTG_OWT_USE_PIPEWIRE=ON"
+              ;;     "-DTG_OWT_USE_X11=ON"
+              ;;     "-DTG_OWT_USE_PROTOBUF=ON")
               #:phases
               #~(modify-phases %standard-phases
                   (add-after 'unpack 'copy-sources
                     (lambda _
-                      (let* ((libvpx-to (string-append (getcwd) "/src/third_party/libvpx/source/libvpx"))
-                             (libyuv-to (string-append (getcwd) "/src/third_party/libyuv")))
-                        (copy-recursively #$libvpx-for-telegram-desktop libvpx-to)
-                        (copy-recursively #$libyuv-for-telegram-desktop libyuv-to)))))))
-       (native-inputs (list perl pkg-config python-wrapper yasm))
+                      (copy-recursively
+                       #$libyuv-for-telegram-desktop
+                       (string-append (getcwd) "/src/third_party/libyuv"))
+                      (copy-recursively
+                       #$crc32c-for-telegram-desktop
+                       (string-append (getcwd) "/src/third_party/crc32c/src")))))))
+       (native-inputs (list pkg-config python-wrapper yasm))
        (inputs
-        (list alsa-lib
+        (list abseil-cpp-cxxstd17
               ffmpeg
               libjpeg-turbo
-              glib
-              libxcomposite
-              libxdamage
-              libxrender
-              libxrandr
+              libvpx
+              openh264
               openssl
               opus
-              pipewire
+              ;; TG_OWT_USE_PROTOBUF
               protobuf
-              pulseaudio
-              libx11
+              ;; TG_OWT_USE_PIPEWIRE
+              glib libdrm libglvnd mesa pipewire-0.3
+              ;; TG_OWT_USE_X11
+              libxcomposite
+              libxdamage
               libxext
+              libxfixes
+              libxrandr
+              libxrender
               libxtst))
        (synopsis "WebRTC support for Telegram Desktop")
        (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by
@@ -305,13 +320,11 @@  (define-public webrtc-for-telegram-desktop
          license:asl2.0
          ;; LibYuv
          (license:non-copyleft "file:///src/third_party/libyuv/LICENSE")
-         ;; OpenH264
-         license:bsd-2
          ;; PFFFT
          (license:non-copyleft "file:///src/third_party/pffft/LICENSE")
          ;; RnNoise
          license:gpl3
-         ;; LibSRTP, LibVPx, UsrSCTP and Others
+         ;; LibSRTP, Crc32c and Others
          license:bsd-3))))))

 (define-public rlottie-for-telegram-desktop