- Update to version 5.10.0

* Collectible Gifts.
  * Reactions for Service Messages.
- Download and compress tarballs with obs service
  * Remove ada-packager.sh
  * Remove tg_owt-packager.sh

OBS-URL: https://build.opensuse.org/package/show/server:messaging/telegram-desktop?expand=0&rev=340
This commit is contained in:
Xu Zhao 2025-01-03 22:13:56 +00:00 committed by Git OBS Bridge
commit 9bc4b3172c
27 changed files with 3650 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,13 @@
Index: tdesktop-4.4.0-full/cmake/external/webrtc/CMakeLists.txt
===================================================================
--- tdesktop-4.4.0-full.orig/cmake/external/webrtc/CMakeLists.txt
+++ tdesktop-4.4.0-full/cmake/external/webrtc/CMakeLists.txt
@@ -7,7 +7,7 @@
add_library(external_webrtc INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_webrtc ALIAS external_webrtc)
-if (DESKTOP_APP_USE_PACKAGED)
+if (NOT DESKTOP_APP_USE_PACKAGED)
find_package(tg_owt REQUIRED)
target_link_libraries(external_webrtc INTERFACE tg_owt::tg_owt)
return()

View File

@ -0,0 +1,71 @@
diff -rup a/cmake/external/expected/CMakeLists.txt b/cmake/external/expected/CMakeLists.txt
--- a/cmake/external/expected/CMakeLists.txt 2023-09-04 14:19:11.000000000 +0200
+++ b/cmake/external/expected/CMakeLists.txt 2023-09-14 09:56:02.804347761 +0200
@@ -7,7 +7,7 @@
add_library(external_expected INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_expected ALIAS external_expected)
-if (DESKTOP_APP_USE_PACKAGED)
+if (NOT DESKTOP_APP_USE_PACKAGED)
if (DESKTOP_APP_USE_PACKAGED_LAZY)
find_package(tl-expected QUIET)
else()
Only in b/cmake/external/gsl: CMakeLists.txt.rej
diff -rup a/cmake/external/ranges/CMakeLists.txt b/cmake/external/ranges/CMakeLists.txt
--- a/cmake/external/ranges/CMakeLists.txt 2023-09-04 14:19:11.000000000 +0200
+++ b/cmake/external/ranges/CMakeLists.txt 2023-09-14 09:56:02.804347761 +0200
@@ -7,7 +7,7 @@
add_library(external_ranges INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_ranges ALIAS external_ranges)
-if (DESKTOP_APP_USE_PACKAGED)
+if (NOT DESKTOP_APP_USE_PACKAGED)
if (DESKTOP_APP_USE_PACKAGED_LAZY)
find_package(range-v3 QUIET)
else()
diff -rup a/cmake/external/rnnoise/CMakeLists.txt b/cmake/external/rnnoise/CMakeLists.txt
--- a/cmake/external/rnnoise/CMakeLists.txt 2023-09-04 14:19:11.000000000 +0200
+++ b/cmake/external/rnnoise/CMakeLists.txt 2023-09-14 09:56:02.804347761 +0200
@@ -4,7 +4,7 @@
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
-if (DESKTOP_APP_USE_PACKAGED)
+if (NOT DESKTOP_APP_USE_PACKAGED)
add_library(external_rnnoise INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_rnnoise ALIAS external_rnnoise)
@@ -18,7 +18,7 @@ endif()
add_library(external_rnnoise STATIC IMPORTED GLOBAL)
add_library(desktop-app::external_rnnoise ALIAS external_rnnoise)
-set(rnnoise_lib_loc ${libs_loc}/rnnoise/out)
+set(rnnoise_lib_loc ${libs_loc}/rnnoise/.libs)
if (WIN32)
target_include_directories(external_rnnoise SYSTEM
INTERFACE
@@ -40,7 +40,11 @@ elseif (APPLE)
IMPORTED_LOCATION_DEBUG "${rnnoise_lib_loc}/Debug/librnnoise.a"
)
else()
+ target_include_directories(external_rnnoise SYSTEM
+ INTERFACE
+ ${libs_loc}/rnnoise/include
+ )
- find_library(DESKTOP_APP_RNNOISE_LIBRARIES librnnoise.a REQUIRED)
+ find_library(DESKTOP_APP_RNNOISE_LIBRARIES librnnoise.a HINTS "${rnnoise_lib_loc}" REQUIRED)
set_target_properties(external_rnnoise PROPERTIES
IMPORTED_LOCATION "${DESKTOP_APP_RNNOISE_LIBRARIES}"
)
diff -rup a/cmake/external/webrtc/CMakeLists.txt b/cmake/external/webrtc/CMakeLists.txt
--- a/cmake/external/webrtc/CMakeLists.txt 2023-09-04 14:19:11.000000000 +0200
+++ b/cmake/external/webrtc/CMakeLists.txt 2023-09-14 09:56:02.804347761 +0200
@@ -7,7 +7,7 @@
add_library(external_webrtc INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_webrtc ALIAS external_webrtc)
-if (DESKTOP_APP_USE_PACKAGED)
+if (NOT DESKTOP_APP_USE_PACKAGED)
find_package(tg_owt REQUIRED)
target_link_libraries(external_webrtc INTERFACE tg_owt::tg_owt)
return()

View File

@ -0,0 +1,18 @@
Index: tdesktop-5.6.3-full/cmake/external/webrtc/CMakeLists.txt
===================================================================
--- tdesktop-5.6.3-full.orig/cmake/external/webrtc/CMakeLists.txt
+++ tdesktop-5.6.3-full/cmake/external/webrtc/CMakeLists.txt
@@ -97,13 +97,10 @@ INTERFACE
${webrtc_libs_list}
$<LINK_ONLY:desktop-app::external_openssl>
$<LINK_ONLY:desktop-app::external_jpeg>
- $<TARGET_FILE:desktop-app::external_jpeg>
$<LINK_ONLY:desktop-app::external_openh264>
$<TARGET_FILE:desktop-app::external_openh264>
$<LINK_ONLY:desktop-app::external_opus>
- $<TARGET_FILE:desktop-app::external_opus>
$<LINK_ONLY:desktop-app::external_vpx>
- $<TARGET_FILE:desktop-app::external_vpx>
)
if (WIN32)

View File

@ -0,0 +1,13 @@
Index: tdesktop-4.4.0-full/cmake/external/webrtc/CMakeLists.txt
===================================================================
--- tdesktop-4.4.0-full.orig/cmake/external/webrtc/CMakeLists.txt
+++ tdesktop-4.4.0-full/cmake/external/webrtc/CMakeLists.txt
@@ -110,7 +110,7 @@ elseif (APPLE)
)
else()
# Required for desktop_capture
- target_link_static_libraries(external_webrtc
+ target_link_libraries(external_webrtc
INTERFACE
Xcomposite
Xdamage

View File

@ -0,0 +1,26 @@
diff --git a/cmake/external/ada/CMakeLists.txt b/cmake/external/ada/CMakeLists.txt
index 4b8063b..fbddaac 100644
--- a/cmake/external/ada/CMakeLists.txt
+++ b/cmake/external/ada/CMakeLists.txt
@@ -4,7 +4,7 @@
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
-if (DESKTOP_APP_USE_PACKAGED)
+if (NOT DESKTOP_APP_USE_PACKAGED)
add_library(external_ada INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_ada ALIAS external_ada)
@@ -37,10 +37,9 @@ elseif (APPLE)
else()
target_include_directories(external_ada SYSTEM
INTERFACE
- /usr/local/include
+ ${libs_loc}/ada/include
)
- find_library(DESKTOP_APP_ADA_LIBRARIES libada.a REQUIRED)
set_target_properties(external_ada PROPERTIES
- IMPORTED_LOCATION "${DESKTOP_APP_ADA_LIBRARIES}"
+ IMPORTED_LOCATION ${libs_loc}/ada/build/src/libada.a
)
endif()

View File

@ -0,0 +1,12 @@
Index: tdesktop-5.6.3-full/cmake/external/webrtc/CMakeLists.txt
===================================================================
--- tdesktop-5.6.3-full.orig/cmake/external/webrtc/CMakeLists.txt
+++ tdesktop-5.6.3-full/cmake/external/webrtc/CMakeLists.txt
@@ -98,7 +98,6 @@ INTERFACE
$<LINK_ONLY:desktop-app::external_openssl>
$<LINK_ONLY:desktop-app::external_jpeg>
$<LINK_ONLY:desktop-app::external_openh264>
- $<TARGET_FILE:desktop-app::external_openh264>
$<LINK_ONLY:desktop-app::external_opus>
$<LINK_ONLY:desktop-app::external_vpx>
)

View File

@ -0,0 +1,281 @@
From c985d2e06f17057255fc5f0cf2e65701f179a9ab Mon Sep 17 00:00:00 2001
From: Xu Zhao <i@xuzhao.net>
Date: Thu, 22 Aug 2024 01:06:23 -0400
Subject: [PATCH] Add an option to load H264 decoder with dlopen()
---
CMakeLists.txt | 3 +-
cmake/external.cmake | 6 +-
.../video_coding/codecs/h264/h264_dlopen.cc | 128 ++++++++++++++++++
.../video_coding/codecs/h264/h264_dlopen.h | 46 +++++++
.../codecs/h264/h264_encoder_impl.cc | 6 +
.../codecs/h264/h264_encoder_impl.h | 5 +
6 files changed, 192 insertions(+), 2 deletions(-)
create mode 100644 src/modules/video_coding/codecs/h264/h264_dlopen.cc
create mode 100644 src/modules/video_coding/codecs/h264/h264_dlopen.h
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fcd8ef132..a0cc7b454 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,7 @@ cmake_dependent_option(TG_OWT_USE_X11 "Use X11 for desktop capture." ON "UNIX; N
cmake_dependent_option(TG_OWT_USE_PIPEWIRE "Use pipewire for desktop capture." ON "UNIX; NOT APPLE" OFF)
cmake_dependent_option(TG_OWT_DLOPEN_PIPEWIRE "dlopen pipewire for desktop capture." ${not_packaged_build} TG_OWT_USE_PIPEWIRE OFF)
option(TG_OWT_BUILD_AUDIO_BACKENDS "Build webrtc audio backends." OFF)
+option(TG_OWT_DLOPEN_H264 "dlopen H264 for video coding." OFF)
if (BUILD_SHARED_LIBS)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@@ -168,7 +169,7 @@ link_openssl(tg_owt)
link_ffmpeg(tg_owt)
link_opus(tg_owt)
link_libabsl(tg_owt)
-link_libopenh264(tg_owt)
+link_libopenh264(tg_owt ${TG_OWT_DLOPEN_H264})
link_libvpx(tg_owt)
link_crc32c(tg_owt)
link_dl(tg_owt)
diff --git a/cmake/external.cmake b/cmake/external.cmake
index 1c71f8518..b1fabbc67 100644
--- a/cmake/external.cmake
+++ b/cmake/external.cmake
@@ -129,7 +129,7 @@ endfunction()
# libopenh264
set(TG_OWT_OPENH264_INCLUDE_PATH "" CACHE STRING "Include path for openh264.")
-function(link_libopenh264 target_name)
+function(link_libopenh264 target_name with_dlopen)
if (TG_OWT_PACKAGED_BUILD)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBOPENH264 openh264)
@@ -148,6 +148,10 @@ function(link_libopenh264 target_name)
${TG_OWT_OPENH264_INCLUDE_PATH}
)
endif()
+ if (with_dlopen)
+ target_compile_definitions(${target_name} PRIVATE -DWEBRTC_USE_H264_DLOPEN)
+ target_sources(${target_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src/modules/video_coding/codecs/h264/h264_dlopen.cc)
+ endif()
endfunction()
# libvpx
diff --git a/src/modules/video_coding/codecs/h264/h264_dlopen.cc b/src/modules/video_coding/codecs/h264/h264_dlopen.cc
new file mode 100644
index 000000000..3762e1dfc
--- /dev/null
+++ b/src/modules/video_coding/codecs/h264/h264_dlopen.cc
@@ -0,0 +1,128 @@
+/*
+ * OpenH264 dlopen code
+ *
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include <dlfcn.h>
+#include <cstddef>
+
+#include "h264_dlopen.h"
+
+/*
+ * The symbol binding makes sure we do not run into strict aliasing issues which
+ * can lead into segfaults.
+ */
+typedef int (*__oh264_WelsCreateSVCEncoder)(ISVCEncoder **);
+typedef void (*__oh264_WelsDestroySVCEncoder)(ISVCEncoder *);
+typedef int (*__oh264_WelsGetDecoderCapability)(SDecoderCapability *);
+typedef long (*__oh264_WelsCreateDecoder)(ISVCDecoder **);
+typedef void (*__oh264_WelsDestroyDecoder)(ISVCDecoder *);
+typedef OpenH264Version (*__oh264_WelsGetCodecVersion)(void);
+typedef void (*__oh264_WelsGetCodecVersionEx)(OpenH264Version *);
+
+#define OH264_SYMBOL_ENTRY(i) \
+ union { \
+ __oh264_##i f; \
+ void *obj; \
+ } _oh264_##i
+
+struct oh264_symbols {
+ OH264_SYMBOL_ENTRY(WelsCreateSVCEncoder);
+ OH264_SYMBOL_ENTRY(WelsDestroySVCEncoder);
+ OH264_SYMBOL_ENTRY(WelsGetDecoderCapability);
+ OH264_SYMBOL_ENTRY(WelsCreateDecoder);
+ OH264_SYMBOL_ENTRY(WelsDestroyDecoder);
+ OH264_SYMBOL_ENTRY(WelsGetCodecVersion);
+ OH264_SYMBOL_ENTRY(WelsGetCodecVersionEx);
+};
+
+/* Symbols are bound by loadLibOpenH264() */
+static struct oh264_symbols openh264_symbols;
+
+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder) {
+ return openh264_symbols._oh264_WelsCreateSVCEncoder.f(ppEncoder);
+}
+
+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder) {
+ return openh264_symbols._oh264_WelsDestroySVCEncoder.f(pEncoder);
+}
+
+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability) {
+ return openh264_symbols._oh264_WelsGetDecoderCapability.f(pDecCapability);
+}
+
+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder) {
+ return openh264_symbols._oh264_WelsCreateDecoder.f(ppDecoder);
+}
+
+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder) {
+ return openh264_symbols._oh264_WelsDestroyDecoder.f(pDecoder);
+}
+
+OpenH264Version oh264_WelsGetCodecVersion(void) {
+ return openh264_symbols._oh264_WelsGetCodecVersion.f();
+}
+
+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion) {
+ openh264_symbols._oh264_WelsGetCodecVersionEx.f(pVersion);
+}
+
+static void *_oh264_bind_symbol(void *handle,
+ const char *sym_name) {
+ void *sym = NULL;
+
+ sym = dlsym(handle, sym_name);
+ if (sym == NULL) {
+ const char *err = dlerror();
+ return NULL;
+ }
+
+ return sym;
+}
+
+#define oh264_bind_symbol(handle, sym_name) \
+ if (openh264_symbols._oh264_##sym_name.obj == NULL) { \
+ openh264_symbols._oh264_##sym_name.obj = _oh264_bind_symbol(handle, #sym_name); \
+ if (openh264_symbols._oh264_##sym_name.obj == NULL) { \
+ return 1; \
+ } \
+ }
+
+int loadLibOpenH264(void) {
+ static bool initialized = false;
+ void *libopenh264 = NULL;
+ const char *err = NULL;
+
+ if (initialized) {
+ return 0;
+ }
+
+#define OPENH264_LIB "libopenh264.so.7"
+ libopenh264 = dlopen(OPENH264_LIB, RTLD_LAZY);
+ err = dlerror();
+ if (err != NULL) {
+ if (libopenh264 != NULL) {
+ dlclose(libopenh264);
+ }
+ return 1;
+ }
+
+ oh264_bind_symbol(libopenh264, WelsCreateSVCEncoder);
+ oh264_bind_symbol(libopenh264, WelsDestroySVCEncoder);
+ oh264_bind_symbol(libopenh264, WelsGetDecoderCapability);
+ oh264_bind_symbol(libopenh264, WelsCreateDecoder);
+ oh264_bind_symbol(libopenh264, WelsDestroyDecoder);
+ oh264_bind_symbol(libopenh264, WelsGetCodecVersion);
+ oh264_bind_symbol(libopenh264, WelsGetCodecVersionEx);
+
+ initialized = true;
+
+ return 0;
+}
diff --git a/src/modules/video_coding/codecs/h264/h264_dlopen.h b/src/modules/video_coding/codecs/h264/h264_dlopen.h
new file mode 100644
index 000000000..25fe94ea8
--- /dev/null
+++ b/src/modules/video_coding/codecs/h264/h264_dlopen.h
@@ -0,0 +1,46 @@
+/*
+ * OpenH264 dlopen code
+ *
+ * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef HAVE_LIBOPENH264_DLOPEN_H
+#define HAVE_LIBOPENH264_DLOPEN_H
+
+#ifdef WEBRTC_USE_H264_DLOPEN
+
+#include <wels/codec_api.h>
+#include <wels/codec_ver.h>
+
+int oh264_WelsCreateSVCEncoder(ISVCEncoder **ppEncoder);
+#define WelsCreateSVCEncoder oh264_WelsCreateSVCEncoder
+
+void oh264_WelsDestroySVCEncoder(ISVCEncoder *pEncoder);
+#define WelsDestroySVCEncoder oh264_WelsDestroySVCEncoder
+
+int oh264_WelsGetDecoderCapability(SDecoderCapability *pDecCapability);
+#define WelsGetDecoderCapability oh264_WelsGetDecoderCapability
+
+long oh264_WelsCreateDecoder(ISVCDecoder **ppDecoder);
+#define WelsCreateDecoder oh264_WelsCreateDecoder
+
+void oh264_WelsDestroyDecoder(ISVCDecoder *pDecoder);
+#define WelsDestroyDecoder oh264_WelsDestroyDecoder
+
+OpenH264Version oh264_WelsGetCodecVersion(void);
+#define WelsGetCodecVersion oh264_WelsGetCodecVersion
+
+void oh264_WelsGetCodecVersionEx(OpenH264Version *pVersion);
+#define WelsGetCodecVersionEx oh264_WelsGetCodecVersionEx
+
+int loadLibOpenH264(void);
+
+#endif /* WEBRTC_USE_H264_DLOPEN */
+
+#endif /* HAVE_LIBOPENH264_DLOPEN_H */
diff --git a/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
index c232133b7..fd06a98cd 100644
--- a/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
+++ b/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
@@ -218,6 +218,12 @@ int32_t H264EncoderImpl::InitEncode(const VideoCodec* inst,
return release_ret;
}
+ #ifdef WEBRTC_USE_H264_DLOPEN
+ if (loadLibOpenH264()) {
+ return WEBRTC_VIDEO_CODEC_ERROR;
+ }
+ #endif
+
int number_of_streams = SimulcastUtility::NumberOfSimulcastStreams(*inst);
bool doing_simulcast = (number_of_streams > 1);
diff --git a/src/modules/video_coding/codecs/h264/h264_encoder_impl.h b/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
index 9e246b85e..2deb5a2a3 100644
--- a/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
+++ b/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
@@ -30,7 +30,12 @@
#include "modules/video_coding/codecs/h264/include/h264.h"
#include "modules/video_coding/svc/scalable_video_controller.h"
#include "modules/video_coding/utility/quality_scaler.h"
+
+#ifdef WEBRTC_USE_H264_DLOPEN
+#include "h264_dlopen.h"
+#else
#include <wels/codec_app_def.h>
+#endif
class ISVCEncoder;

26
_constraints Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<constraints>
<hardware>
<physicalmemory>
<size unit="G">16</size>
</physicalmemory>
<memoryperjob>
<size unit="M">2048</size>
</memoryperjob>
</hardware>
<overwrite>
<conditions>
<arch>aarch64</arch>
<arch>armv7l</arch>
<arch>armv6l</arch>
</conditions>
<hardware>
<physicalmemory>
<size unit="G">5</size>
</physicalmemory>
<memoryperjob>
<size unit="M">1024</size>
</memoryperjob>
</hardware>
</overwrite>
</constraints>

35
_service Normal file
View File

@ -0,0 +1,35 @@
<services>
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://github.com/telegramdesktop/tdesktop</param>
<param name="filename">tdesktop</param>
<param name="revision">v5.10.0</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="versionrewrite-replacement">\1</param>
</service>
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://github.com/ada-url/ada</param>
<param name="filename">ada</param>
<param name="revision">v2.9.0</param>
<param name="version">_none_</param>
</service>
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://github.com/xuzhao9/tg_owt</param>
<param name="filename">tg_owt</param>
<param name="revision">8198c4d8b91e22d68eb5c7327fd408e3b6abcc79</param>
<param name="version">_none_</param>
</service>
<service name="tar" mode="manual" />
<service name="recompress" mode="manual">
<param name="compression">zstd</param>
<param name="file">*.tar</param>
</service>
</services>

13
ada-packager.sh Normal file
View File

@ -0,0 +1,13 @@
#! /bin/bash
# ada version
# https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/build/docker/centos_env/Dockerfile#L799
rm -rf ada \
&& git clone -b v2.9.0 --depth=1 https://github.com/ada-url/ada.git \
&& cd ada \
&& rm -rf .git \
&& cd .. \
&& mv ada ada-v2.9.0 \
&& zip ada-v2.9.0.zip -r ada-v2.9.0 -x '*.git*' \
rm -rf ada-v2.9.0

3
ada-v2.9.0.zip Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7b6fc58c3e00c4629b8c4d890aca2f1451885a8c28bbedec38f5d3960ad04cb7
size 860638

3
ada.tar.zst Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5204e3b21a8d62fe3cb77c71659d74c8df00956f0d2fd853da85b7513f8f1ad8
size 319285

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:767b22cd9d72f1062f1d424b10538056d281d1677373f00034e4f61fc09112b2
size 173774

3
tdesktop-5.10.0.tar.zst Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5a671978d98483c4f9bed9c1148c605d52e8863e6472044deeaebb889b9c923
size 62008169

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d36a08859b4fb4dfdac0febbfcec9bd825ebcb4e8a0e937061870c03d51f320f
size 69745773

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b7ef049f64aa7015753c3be158e1a38dafd5e4b58d69bed16aee2402d11ef394
size 70056797

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e32628184aa571f1051e1f8ac75a67455a07c1753a3be47bfb013994c941db15
size 70333924

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c9e74a9b49284c0d4197f0be7e02415e14c4f8bf46403d0663d39f44d7ac2fbc
size 72447849

2632
telegram-desktop.changes Normal file

File diff suppressed because it is too large Load Diff

348
telegram-desktop.spec Normal file
View File

@ -0,0 +1,348 @@
#
# spec file for package telegram-desktop
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# Disable LTO on TW due to build failures
%if 0%{?suse_version} > 01500
%define _lto_cflags %{nil}
%endif
%define __builder ninja
# gcc12 or higher is required
%if 0%{?suse_version} && ( 0%{?suse_version} < 1500 || ( 0%{?is_opensuse} && 0%{?suse_version} == 1500 && 0%{?sle_version} && 0%{?sle_version} <= 150600 ) )
%bcond_without compiler_upgrade
%endif
%if 0%{?suse_version} && 0%{?suse_version} > 01500 || (0%{?sle_version} && 0%{?sle_version} >= 150500)
%bcond_without use_system_rnnoise
%endif
%define _dwz_low_mem_die_limit 40000000
%define _dwz_max_die_limit 200000000
%define qt_major_version 6
%define srcext tar.zst
Name: telegram-desktop
Version: 5.10.0
Release: 0
Summary: Messaging application with a focus on speed and security
License: GPL-3.0-only
Group: Productivity/Networking/Instant Messenger
URL: https://github.com/telegramdesktop/tdesktop
Source0: tdesktop-%{version}.%{srcext}
Source1: tg_owt.%{srcext}
Source2: ada.%{srcext}
Source3: tg_owt-dlopen-headers.tar.gz
%if %{with use_system_rnnoise}
# PATCH-FIX-OPENSUSE
Patch1: 0001-use-bundled-webrtc.patch
%else
Source4: rnnoise-git20210122.tar.gz
# PATCH-FIX-OPENSUSE
Patch2: 0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch
%endif
# PATCH-FIX-OPENSUSE
Patch3: 0003-revert-webrtc-cmake-target-file.patch
# PATCH-FIX-OPENSUSE
Patch4: 0004-use-dynamic-x-libraries.patch
# PATCH-FIX-OPENSUSE
Patch5: 0005-use-bundled-ada.patch
# PATCH-FIX-OPENSUSE
Patch6: 0006-tdesktop-disable-h264.patch
# PATCH-FIX_OPENSUSE
Patch7: 0007-tg_owt-h264-dlopen.patch
# There is an (incomplete) patch available for part of the source:
# https://github.com/desktop-app/lib_base.git 3582bca53a1e195a31760978dc41f67ce44fc7e4
# but tdesktop itself still falls short, and it looks to be something
# that would affect all ILP32 platforms.
ExcludeArch: %ix86 aarch64_ilp32 ppc riscv32
BuildRequires: appstream-glib
BuildRequires: chrpath
BuildRequires: clang
BuildRequires: cmake >= 3.16
BuildRequires: desktop-file-utils
BuildRequires: enchant-devel
BuildRequires: ffmpeg-6-libavcodec-devel
BuildRequires: ffmpeg-6-libavdevice-devel
BuildRequires: ffmpeg-6-libavfilter-devel
BuildRequires: ffmpeg-6-libavformat-devel
BuildRequires: ffmpeg-6-libavutil-devel
%if %{with compiler_upgrade} || %{with compiler_downgrade}
BuildRequires: gcc12
BuildRequires: gcc12-c++
%else
BuildRequires: gcc-c++
%endif
BuildRequires: glibc-devel
BuildRequires: libboost_program_options-devel
BuildRequires: libboost_regex-devel
BuildRequires: libjpeg-devel
BuildRequires: liblz4-devel
BuildRequires: ninja
BuildRequires: pkgconfig
BuildRequires: python3 >= 3.7
BuildRequires: unzip
BuildRequires: wayland-devel
BuildRequires: webkit2gtk3-devel
BuildRequires: xxhash-devel
BuildRequires: xz
BuildRequires: yasm
BuildRequires: cmake(KF5Wayland)
BuildRequires: cmake(Qt%{qt_major_version}Concurrent)
BuildRequires: cmake(Qt%{qt_major_version}Core)
BuildRequires: cmake(Qt%{qt_major_version}DBus)
BuildRequires: cmake(Qt%{qt_major_version}Network)
BuildRequires: cmake(Qt%{qt_major_version}OpenGL)
BuildRequires: cmake(Qt%{qt_major_version}Qml)
BuildRequires: cmake(Qt%{qt_major_version}Quick)
BuildRequires: cmake(Qt%{qt_major_version}Svg)
BuildRequires: cmake(Qt%{qt_major_version}WaylandClient)
BuildRequires: cmake(Qt%{qt_major_version}Widgets)
BuildRequires: pkgconfig(webrtc-audio-processing-1)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xcomposite)
BuildRequires: pkgconfig(xdamage)
BuildRequires: pkgconfig(xext)
BuildRequires: pkgconfig(xfixes)
BuildRequires: pkgconfig(xproto)
BuildRequires: pkgconfig(xrandr)
BuildRequires: pkgconfig(xtst)
%if %{qt_major_version} >= 6
BuildRequires: qt%{qt_major_version}-gui-private-devel
BuildRequires: qt%{qt_major_version}-waylandclient-private-devel
BuildRequires: qt%{qt_major_version}-widgets-private-devel
BuildRequires: cmake(Qt%{qt_major_version}OpenGLWidgets)
%else
BuildRequires: libQt5Gui-private-headers-devel
BuildRequires: libqt5-qtwayland-private-headers-devel
BuildRequires: pkgconfig(dbusmenu-qt%{qt_major_version})
%endif
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(fmt)
BuildRequires: pkgconfig(fontconfig)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(gbm)
BuildRequires: pkgconfig(glib-2.0) >= 2.77
BuildRequires: pkgconfig(glibmm-2.68) >= 2.77
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(harfbuzz)
BuildRequires: pkgconfig(hunspell)
BuildRequires: pkgconfig(jemalloc)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(libmng)
BuildRequires: pkgconfig(libpcre)
BuildRequires: pkgconfig(libpcre16)
BuildRequires: pkgconfig(libpcrecpp)
BuildRequires: pkgconfig(libpcreposix)
BuildRequires: pkgconfig(libpipewire-0.3)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libproxy-1.0)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(libtiff-4)
BuildRequires: pkgconfig(libva)
BuildRequires: pkgconfig(libva-glx)
BuildRequires: pkgconfig(libva-x11)
BuildRequires: pkgconfig(libwebp)
BuildRequires: pkgconfig(minizip)
BuildRequires: pkgconfig(mtdev)
BuildRequires: pkgconfig(openal)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(opus)
BuildRequires: pkgconfig(opusfile)
BuildRequires: pkgconfig(opusurl)
BuildRequires: pkgconfig(portaudio-2.0)
BuildRequires: pkgconfig(portaudiocpp)
BuildRequires: pkgconfig(protobuf)
# Use system rnnoise on TW, self-build on others
%if %{with use_system_rnnoise}
BuildRequires: expect-devel
BuildRequires: range-v3-devel
BuildRequires: pkgconfig(gsl)
BuildRequires: pkgconfig(rnnoise)
%else
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
%endif
BuildRequires: zstd
BuildRequires: pkgconfig(tslib)
BuildRequires: pkgconfig(vdpau)
BuildRequires: pkgconfig(vpx)
BuildRequires: pkgconfig(webkit2gtk-4.0)
BuildRequires: pkgconfig(xcb-ewmh)
BuildRequires: pkgconfig(xcb-icccm)
BuildRequires: pkgconfig(xcb-image)
BuildRequires: pkgconfig(xcb-keysyms)
BuildRequires: pkgconfig(xcb-record)
BuildRequires: pkgconfig(xcb-renderutil)
BuildRequires: pkgconfig(xcb-util)
BuildRequires: pkgconfig(xfixes)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(xkbcommon-x11)
BuildRequires: pkgconfig(zlib)
# Runtime requirements
Requires: hicolor-icon-theme
Requires: icu
# Require the same version of glib2 used to *build* the package:
Requires: glib2 >= 2.77
%if %{qt_major_version} >= 6
Requires: qt%{qt_major_version}-imageformats
Recommends: qt%{qt_major_version}-wayland
%else
Requires: libqt%{qt_major_version}-qtimageformats
Recommends: libqt%{qt_major_version}-qtwayland
%endif
# TDesktop can fall back to a simple GTK file picker but prefers the portal
Recommends: xdg-desktop-portal
Recommends: google-opensans-fonts
%description
Telegram is a non-profit cloud-based instant messaging service.
Users can send messages and exchange photos, videos, stickers, audio and files of any type.
Its client-side code is open-source software but the source code for recent versions is not
always immediately published, whereas its server-side code is closed-source and proprietary.
The service also provides APIs to independent developers.
%prep
%setup -q -n tdesktop-%{version}
%autopatch -p1 -M 6
cd %{_builddir}
mkdir -p %{_builddir}/Libraries
# -q: quiet mode
# -T: do not perform default archive unpacking
# -D: do not delete tdesktop-%{version} directory
# -b <n>: unpack nth sources before changing the directory
%setup -q -T -D -b 1 -n tdesktop-%{version}
mv ../tg_owt %{_builddir}/Libraries
%setup -q -T -D -b 2 -n tdesktop-%{version}
mv ../ada %{_builddir}/Libraries
%setup -q -T -D -b 3 -n tdesktop-%{version}
mkdir -p %{_builddir}/Libraries/openh264/include
mv ../wels %{_builddir}/Libraries/openh264/include
# If not TW, unpack rnnoise source
%if %{without use_system_rnnoise}
%setup -q -T -D -b 4 -n tdesktop-%{version}
mv ../rnnoise-git20210122 ../Libraries/rnnoise
%endif
pushd %{_builddir}/Libraries/tg_owt
%autopatch -p1 7
popd
%build
%if %{with compiler_upgrade} || %{with compiler_downgrade}
export CC=gcc-12
export CXX=g++-12
%endif
# Fix build failures due to not finding installed headers for xkbcommon and wayland-client
export CXXFLAGS+="`pkg-config --cflags xkbcommon wayland-client` -DBOOST_NO_STD_ALLOCATOR"
%if 0%{?suse_version} == 1500
export CXXFLAGS+=" -DBOOST_NO_STD_ALLOCATOR"
%endif
# If not TW, build rnnoise
%if %{without use_system_rnnoise}
pushd %{_builddir}/Libraries/rnnoise
./autogen.sh
%configure
%make_build
popd
%endif
# Build Ada
pushd %{_builddir}/Libraries/ada
cmake -GNinja -B build . \
-D CMAKE_BUILD_TYPE=None \
-D ADA_TESTING=OFF \
-D ADA_TOOLS=OFF
cmake --build build --parallel
cd %{_builddir}/Libraries/tg_owt
mkdir -p out/Release
cd out/Release
cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
%ifarch armv7l armv7hl
-DTG_OWT_ARCH_ARMV7_USE_NEON=OFF \
%endif
-DTG_OWT_DLOPEN_H264=ON \
-DTG_OWT_SPECIAL_TARGET=linux \
-DTG_OWT_LIBJPEG_INCLUDE_PATH=/usr/include \
-DTG_OWT_OPENH264_INCLUDE_PATH=%{_builddir}/Libraries/openh264/include \
-DTG_OWT_OPENSSL_INCLUDE_PATH=/usr/include/openssl \
-DTG_OWT_OPUS_INCLUDE_PATH=/usr/include/opus \
-DTG_OWT_FFMPEG_INCLUDE_PATH=/usr/include/ffmpeg \
-DTG_OWT_LIBVPX_INCLUDE_PATH=/usr/include/vpx \
../..
sed -i 's,gnu++2a,gnu++17,g' build.ninja
ninja
cd %{_builddir}/tdesktop-%{version}
# Use the official API key that telegram uses for their snap builds:
# https://github.com/telegramdesktop/tdesktop/blob/8fab9167beb2407c1153930ed03a4badd0c2b59f/snap/snapcraft.yaml#L87-L88
# Thanks to @primeos on Github.
%cmake \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_BUILD_TYPE=Release \
%if %{qt_major_version} == 6
-DDESKTOP_APP_QT6=ON \
-DQT_VERSION_MAJOR=6 \
%else
-DDESKTOP_APP_QT6=OFF \
-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=ON \
-DDESKTOP_APP_USE_ENCHANT=ON \
%endif
%if 0%{?suse_version} && ( 0%{?suse_version} < 1500 || ( 0%{?is_opensuse} && 0%{?suse_version} == 1500 && 0%{?sle_version} && 0%{?sle_version} < 150600 ) )
-DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=ON \
%endif
-DTDESKTOP_API_ID=611335 \
-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c \
-DDESKTOP_APP_USE_GLIBC_WRAPS=OFF \
-DDESKTOP_APP_USE_PACKAGED=ON \
-DDESKTOP_APP_QTWAYLANDCLIENT_PRIVATE_HEADERS=OFF \
-DDESKTOP_APP_USE_PACKAGED_FONTS=ON \
-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON \
-DTDESKTOP_LAUNCHER_BASENAME=%{name} \
-DDESKTOP_APP_SPECIAL_TARGET=""
%cmake_build
%install
%cmake_install
%if 0%{?suse_version} > 01500 || ( 0%{?is_opensuse} && 0%{?suse_version} == 1500 && 0%{?sle_version} && 0%{?sle_version} >= 150600 )
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/*.metainfo.xml
%endif
%files
%license LICENSE LEGAL
%doc README.md changelog.txt
%{_bindir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/dbus-1/services/org.telegram.desktop.service
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/icons/hicolor/*/apps/*.svg
%{_datadir}/metainfo/*.metainfo.xml
%changelog

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:27b9dd3b758f638bbee54ebe3a3d3a15d8e0941a5a2a94b3e8699d508712ee0f
size 17931

3
tg_owt-master.zip Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d341ad19551737ac3a3caa0381a026b4170a9a273aadb2dfd237c1a832895d39
size 22874383

83
tg_owt-packager.py Normal file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env python
import re
import os
import git
import argparse
import subprocess
from pathlib import Path
from git import Repo
tg_owt_url = 'https://github.com/desktop-app/tg_owt.git'
repo_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "tg_owt-master")
def clone_repo(git_url, repo_dir):
try:
repo = Repo(repo_dir)
except (git.exc.GitCommandError, git.exc.NoSuchPathError):
Repo.clone_from(git_url, repo_dir)
repo = Repo(repo_dir)
return repo
def load_submodules(repo):
for sms in repo.submodules:
sms.update(init=True)
#def find_pipewire_path(repo):
# "Return the relative path of pipewire (relative to repo path)"
# sms = map(lambda x: x.name, repo.submodules)
# sms = filter(lambda x: "pipewire" in x, sms)
# sms = list(sms)
# assert len(sms) == 1, f"find more than 1 pipewire submodule: {sms}"
# return sms[0]
#
#def find_pipewire_ver(pipeware_path):
# pw_build_file = os.path.join(pipeware_path, "meson.build")
# with open(pw_build_file, "r") as pf:
# pw_build = list(map(lambda x: x.strip(), pf.read().splitlines()))
# version_re = "^version : '([0-9]+)\.([0-9]+)\.([0-9]+)',"
# apiver_re = "^apiversion = '([0-9.]+)'"
# ver_line = list(filter(lambda x: re.match(version_re, x), pw_build))
# apiver_line = list(filter(lambda x: re.match(apiver_re, x), pw_build))
# assert len(ver_line) == 1, f"Found more than one version line: {ver_line}"
# assert len(apiver_line) == 1, f"Found more than one apiversion line: {apiver_line}"
# ver = re.match(version_re, ver_line[0]).groups()
# api_ver = re.match(apiver_re, apiver_line[0]).groups()[0]
# return ver, api_ver
#
#def gen_pipewire_version_header(pipewire_path, pw_ver, pw_apiver):
# pw_ver_major, pw_ver_minor, pw_ver_micro = pw_ver
# replace_map = {
# '@PIPEWIRE_API_VERSION@': pw_apiver,
# '@PIPEWIRE_VERSION_MAJOR@': pw_ver_major,
# '@PIPEWIRE_VERSION_MINOR@': pw_ver_minor,
# '@PIPEWIRE_VERSION_MICRO@': pw_ver_micro,
# }
# part_header_file = os.path.join(pipewire_path, "src", "pipewire", "version.h.in")
# with open(part_header_file, "r") as phf:
# part_header = phf.read()
# for k, v in replace_map.items():
# part_header = part_header.replace(k, v)
# header_file = os.path.join(pipewire_path, "src", "pipewire", "version.h")
# with open(header_file, "w") as hf:
# hf.write(part_header)
def compress_package(repo_dir):
basename = os.path.basename(repo_dir)
zipname = basename + ".zip"
path = Path(repo_dir).parent
command = ['zip', zipname, '-r', basename, '-x', '*.git*']
subprocess.check_call(command, cwd=path)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Package tg_owt for telegram-desktop build.")
parser.add_argument('--repo-dir', required=True, help="Specify path to clone tg_owt master branch.")
args = parser.parse_args()
repo_dir = args.repo_dir
repo = clone_repo(tg_owt_url, repo_dir)
load_submodules(repo)
# pipewire_path = find_pipewire_path(repo)
# pipewire_path = os.path.join(repo_dir, pipewire_path)
# pw_ver, pw_apiver = find_pipewire_ver(pipewire_path)
# gen_pipewire_version_header(pipewire_path, pw_ver, pw_apiver)
compress_package(repo_dir)

22
tg_owt-packager.sh Normal file
View File

@ -0,0 +1,22 @@
#! /bin/bash
# tg_owt origin
# get it from https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/build/docker/centos_env/Dockerfile around line 761
tg_owt_origin="8198c4d8b91e22d68eb5c7327fd408e3b6abcc79"
rm -rf tg_owt \
&& mkdir tg_owt \
&& cd tg_owt \
&& git init tg_owt \
&& cd tg_owt \
&& git remote add origin https://github.com/xuzhao9/tg_owt.git \
&& git fetch --depth=1 origin "$tg_owt_origin" \
&& git reset --hard FETCH_HEAD \
&& git submodule update --init --recursive --depth=1 \
&& rm -rf .git \
&& cd .. \
&& mv tg_owt tg_owt-master \
&& zip tg_owt-master.zip -r tg_owt-master -x '*.git*' \
&& mv tg_owt-master.zip ..
cd ..; rm -rf tg_owt

3
tg_owt.tar.zst Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:63272e4ce309381962248ef75e704e32f753ea016ef6f98f54e1c25df6b34dfc
size 13348903