;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Raghav Gururajan ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages telegram) #:use-module (gnu packages) #:use-module (gnu packages aidc) #:use-module (gnu packages assembly) #:use-module (gnu packages audio) #:use-module (gnu packages base) #:use-module (gnu packages check) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) #:use-module (gnu packages cpp) #:use-module (gnu packages digest) #:use-module (gnu packages fcitx) #:use-module (gnu packages fcitx5) #:use-module (gnu packages gcc) #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gtk) #:use-module (gnu packages image) #:use-module (gnu packages kde-frameworks) #:use-module (gnu packages language) #:use-module (gnu packages libreoffice) #:use-module (gnu packages linux) #:use-module (gnu packages lxqt) #:use-module (gnu packages pkg-config) #:use-module (gnu packages protobuf) #:use-module (gnu packages pulseaudio) #:use-module (gnu packages python) #:use-module (gnu packages qt) #:use-module (gnu packages tls) #:use-module (gnu packages video) #:use-module (gnu packages xiph) #:use-module (gnu packages xorg) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix git-download) #:use-module (guix build-system cmake) #:use-module (guix build-system glib-or-gtk) #:use-module (guix build-system qt)) (define-public tg-owt (let ((commit "fa86fcc00c218813d61a272a56feab55c76a1ab9") (revision "1")) (package (name "tg-owt") (version (git-version "0" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/desktop-app/tg_owt.git") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "06gcrlym6vqqw7zlds9lpwyg37d5m81d87h16aps19v0v9gzan0l")) (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)))) #t))))) (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)) #t))))) (native-inputs `(("pkg-config" ,pkg-config) ("python" ,python-wrapper) ("yasm" ,yasm))) (inputs `(("alsa" ,alsa-lib) ("ffmpeg" ,ffmpeg) ("libjpeg" ,libjpeg-turbo) ("libvpx" ,(origin (method git-fetch) (uri (git-reference (url "https://chromium.googlesource.com/webm/libvpx") (commit "5b63f0f821e94f8072eb483014cfc33b05978bb9"))) (file-name (git-file-name "libvpx-for-tg-owt" 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-tg-owt" version)) (sha256 (base32 "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll")))) ("openssl" ,openssl) ("opus" ,opus) ("protobuf" ,protobuf) ("pulseaudio" ,pulseaudio))) (synopsis "WebRTC support for Telegram-Desktop") (description "Tg_owt is a custom WebRTC fork by Telegram project, for its use in telegram desktop client.") (home-page "https://github.com/desktop-app/tg_owt") (license (list ;; Abseil-CPP 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 license:bsd-3))))) (define-public telegram-desktop (package (name "telegram-desktop") (version "2.5.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/telegramdesktop/tdesktop.git") (commit (string-append "v" version)) (recursive? #t))) (file-name (git-file-name name version)) (sha256 (base32 "1qw9vaa482dbz97mzwjzmy3fw72s5bk3hyacyz98ms652xgld6js")) (modules '((guix build utils) (ice-9 ftw) (srfi srfi-1))) (snippet `(begin (let ((keep '( ;; Custom forks which are incompatible with the ones in Guix. "libtgvoip" "rlottie" ;; Not available in Guix. "SPMediaKeyTap" "statusnotifieritem" "tgcalls"))) (with-directory-excursion "Telegram/ThirdParty" (for-each delete-file-recursively (lset-difference string=? (scandir ".") (cons* "." ".." keep)))) #t))))) (build-system qt-build-system) (arguments `(#:tests? #f ; No target #:imported-modules (,@%qt-build-system-modules (guix build glib-or-gtk-build-system)) #:modules ((guix build qt-build-system) ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:) (guix build utils)) #:configure-flags ;; Client applications must provide their own API-ID and API-HASH, ;; see also . ;; In case, that the credentials below fail to work, contact ;; Raghav Gururajan (list "-DTDESKTOP_API_ID=2791056" "-DTDESKTOP_API_HASH=582d6d0b44f7a2de949e99271fd8b3f2") #:phases (modify-phases %standard-phases (add-after 'unpack 'make-writable (lambda _ (for-each make-file-writable (find-files ".")) #t)) (add-before 'configure 'patch-cxx-flags (lambda _ (substitute* "cmake/options_linux.cmake" (("class-memaccess") "all")) #t)) (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 `(("cmake-shared" ,cmake-shared) ("extra-cmake-modules" ,extra-cmake-modules) ("gcc" ,gcc-9) ("glib:bin" ,glib "bin") ("gobject-introspection" ,gobject-introspection) ("gtk+:bin" ,gtk+ "bin") ("pkg-config" ,pkg-config) ("python" ,python-wrapper) ("qttools" ,qttools))) (inputs `(("alsa" ,alsa-lib) ("c++-gsl" ,c++-gsl) ("catch" ,catch-framework2) ("expected" ,libexpected) ("fcitx-qt5" ,fcitx-qt5) ("fcitx5-qt" ,fcitx5-qt) ("ffmpeg" ,ffmpeg) ("glib" ,glib) ("gtk+" ,gtk+) ("hime" ,hime) ("hunspell" ,hunspell) ("iconv" ,libiconv) ("libdbusmenu-qt" ,libdbusmenu-qt) ("libjpeg" ,libjpeg-turbo) ;; ("libtgvoip" ,libtgvoip) ("lz4" ,lz4) ("materialdecoration" ,materialdecoration) ("minizip" ,minizip) ("nimf" ,nimf) ("openal" ,openal) ("openssl" ,openssl) ("opus" ,opus) ("pulseaudio" ,pulseaudio) ("qrcodegen" ,qrcodegen-cpp) ("qt" ,qtbase) ("qt5ct" ,qt5ct) ("qtimageformats" ,qtimageformats) ("qtwayland" ,qtwayland) ("range-v3" ,range-v3) ;; ("rlottie" ,rlottie) ("tg-owt" ,tg-owt) ("x11" ,libx11) ("xcb" ,libxcb) ("xcb-keysyms" ,xcb-util-keysyms) ("xxhash" ,xxhash) ("zlib" ,zlib))) (propagated-inputs `(("dconf" ,dconf))) (synopsis "Telegram Desktop") (description "Telegram desktop is the official desktop version of the Telegram instant messager.") (home-page "https://desktop.telegram.org/") (license (list ;; ThirdParty license:lgpl2.1+ ;; Others license:gpl3+))))