diff mbox series

[bug#57675,v4,04/10] gnu: webrtc-for-telegram-desktop: Use gexp.

Message ID y768rmfriyl.wl-hako@ultrarare.space
State New
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:12 a.m. UTC
* gnu/packages/telegram.scm (source-for-telegram-desktop,
libvpx-for-telegram-desktop,libyuv-for-telegram-desktop): New variables.
(webrtc-for-telegram-desktop)[#:phases]: Copy sources with gexp.
[inputs]: Remove sources in flavor of variables.
---
 gnu/packages/telegram.scm | 116 ++++++++++++++++++--------------------
 1 file changed, 56 insertions(+), 60 deletions(-)

--
2.37.3
diff mbox series

Patch

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index cfa0d1c673..e6766d84eb 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -62,6 +62,7 @@  (define-module (gnu packages telegram)
   #:use-module (gnu packages xorg)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
@@ -71,6 +72,33 @@  (define-module (gnu packages telegram)
   #:use-module (guix build-system python)
   #:use-module (guix build-system qt))

+(define* (source-for-telegram-desktop #:key name url revision commit hash)
+  (let ((name (string-append name "-for-telegram-desktop"))
+        (version (git-version "0" revision commit)))
+    (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url url)
+            (commit commit)))
+      (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"
+   #:revision "0"
+   #:commit "ad890067f661dc747a975bc55ba3767fe30d4452"
+   #:hash "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll"
+   #:name "libyuv"))
+
 (define-public webrtc-for-telegram-desktop
   (let ((commit "91d836dc84a16584c6ac52b36c04c0de504d9c34")
         (revision "166"))
@@ -109,68 +137,36 @@  (define-public webrtc-for-telegram-desktop
                                              (cons* "." ".." keep)))))))))
        (build-system cmake-build-system)
        (arguments
-        `(#:tests? #f                   ; No target
-          #:configure-flags
-          (list
-           "-DCMAKE_C_FLAGS=-fPIC"
-           "-DCMAKE_CXX_FLAGS=-fPIC")
-          #:phases
-          (modify-phases %standard-phases
-            (add-after 'unpack 'copy-inputs
-              (lambda* (#:key inputs outputs #:allow-other-keys)
-                (let* ((libvpx-from (assoc-ref inputs "libvpx"))
-                       (libyuv-from (assoc-ref inputs "libyuv"))
-                       (libvpx-to (string-append (getcwd)
-                                                 "/src/third_party/libvpx/source/libvpx"))
-                       (libyuv-to (string-append (getcwd)
-                                                 "/src/third_party/libyuv")))
-                  (copy-recursively libvpx-from libvpx-to)
-                  (copy-recursively libyuv-from libyuv-to)))))))
+        (list #:tests? #f               ; No target
+              #:configure-flags
+              #~`("-DCMAKE_C_FLAGS=-fPIC"
+                  "-DCMAKE_CXX_FLAGS=-fPIC")
+              #: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))
        (inputs
-        (modify-inputs
-            `(("libvpx"
-               ,(origin
-                  (method git-fetch)
-                  (uri
-                   (git-reference
-                    (url "https://chromium.googlesource.com/webm/libvpx")
-                    (commit "5b63f0f821e94f8072eb483014cfc33b05978bb9")))
-                  (file-name
-                   (git-file-name
-                    "libvpx-for-webrtc-for-telegram-desktop" version))
-                  (sha256
-                   (base32
-                    "1psvxaddihlw1k5n0anxif3qli6zyw2sa2ywn6mkb8six9myrp68"))))
-              ("libyuv"
-               ,(origin
-                  (method git-fetch)
-                  (uri
-                   (git-reference
-                    (url "https://chromium.googlesource.com/libyuv/libyuv")
-                    (commit "ad890067f661dc747a975bc55ba3767fe30d4452")))
-                  (file-name
-                   (git-file-name
-                    "libyuv-for-webrtc-for-telegram-desktop" version))
-                  (sha256
-                   (base32
-                    "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll")))))
-          (append alsa-lib
-                  ffmpeg
-                  libjpeg-turbo
-                  glib
-                  libxcomposite
-                  libxdamage
-                  libxrender
-                  libxrandr
-                  openssl
-                  opus
-                  pipewire
-                  protobuf
-                  pulseaudio
-                  libx11
-                  libxext
-                  libxtst)))
+        (list alsa-lib
+              ffmpeg
+              libjpeg-turbo
+              glib
+              libxcomposite
+              libxdamage
+              libxrender
+              libxrandr
+              openssl
+              opus
+              pipewire
+              protobuf
+              pulseaudio
+              libx11
+              libxext
+              libxtst))
        (synopsis "WebRTC support for Telegram Desktop")
        (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by
 Telegram project, for its use in telegram desktop client.")