diff --git a/0005-use-bundled-ada.patch b/0005-use-bundled-ada.patch new file mode 100644 index 0000000..d1c3477 --- /dev/null +++ b/0005-use-bundled-ada.patch @@ -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() diff --git a/0006-tdesktop-disable-h264.patch b/0006-tdesktop-disable-h264.patch new file mode 100644 index 0000000..d3851dd --- /dev/null +++ b/0006-tdesktop-disable-h264.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/external/webrtc/CMakeLists.txt b/cmake/external/webrtc/CMakeLists.txt +index 67159d6..0caf765 100644 +--- a/cmake/external/webrtc/CMakeLists.txt ++++ b/cmake/external/webrtc/CMakeLists.txt +@@ -134,7 +134,7 @@ else() + Xrandr + Xrender + Xtst +- openh264 ++ # openh264 + ) + target_link_libraries(external_webrtc + INTERFACE diff --git a/ada-packager.sh b/ada-packager.sh new file mode 100644 index 0000000..6d3a6f4 --- /dev/null +++ b/ada-packager.sh @@ -0,0 +1,12 @@ +#! /bin/bash + + +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 diff --git a/ada-v2.9.0.zip b/ada-v2.9.0.zip new file mode 100644 index 0000000..bcb3ab2 --- /dev/null +++ b/ada-v2.9.0.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b6fc58c3e00c4629b8c4d890aca2f1451885a8c28bbedec38f5d3960ad04cb7 +size 860638 diff --git a/tdesktop-5.2.3-full.tar.gz b/tdesktop-5.2.3-full.tar.gz deleted file mode 100644 index a019475..0000000 --- a/tdesktop-5.2.3-full.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d36a08859b4fb4dfdac0febbfcec9bd825ebcb4e8a0e937061870c03d51f320f -size 69745773 diff --git a/tdesktop-5.4.1-full.tar.gz b/tdesktop-5.4.1-full.tar.gz new file mode 100644 index 0000000..bb6f3d2 --- /dev/null +++ b/tdesktop-5.4.1-full.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7ef049f64aa7015753c3be158e1a38dafd5e4b58d69bed16aee2402d11ef394 +size 70056797 diff --git a/telegram-desktop.changes b/telegram-desktop.changes index 9c93e79..b5d4688 100644 --- a/telegram-desktop.changes +++ b/telegram-desktop.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Thu Aug 22 05:30:55 UTC 2024 - Xu Zhao + +- Remove 0007-tg-owt-disable-h264.patch +- Add tg_owt-dlopen-headers.tar.gz +- Update tg_owt-packager.sh to use the forked version with dlopen. + +------------------------------------------------------------------- +Wed Aug 21 22:49:40 UTC 2024 - Xu Zhao + +- Update to version 5.4.1 + * Fix crash when sending Star Reaction in comments. + * Fix loading "Send As" channels in a channel. + * Place Star Reaction always first in list. + * Removed paid Invite Links in groups. +- Add 0005-use-bundled-ada.patch +- Add 0006-tdesktop-disable-h264.patch +- Add 0007-tg-owt-disable-h264.patch + ------------------------------------------------------------------- Mon Jul 8 05:56:21 UTC 2024 - Manfred Hollstein diff --git a/telegram-desktop.spec b/telegram-desktop.spec index 7485927..89db270 100644 --- a/telegram-desktop.spec +++ b/telegram-desktop.spec @@ -38,25 +38,26 @@ %define qt_major_version 6 Name: telegram-desktop -Version: 5.2.3 +Version: 5.4.1 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: https://github.com/telegramdesktop/tdesktop/releases/download/v%{version}/tdesktop-%{version}-full.tar.gz -# Use tg_owt-packager.py to prepare tg_owt-master.zip -# Usage: python tg_owt-packager.py --repo-dir $PWD/tg_owt-master -# Or use tg_owt-packager.sh to prepare tg_owt-master.zip +# Use tg_owt-packager.sh to prepare tg_owt-master.zip # Usage: bash tg_owt-packager.sh -Source1: tg_owt-packager.py -Source2: tg_owt-packager.sh -Source3: tg_owt-master.zip +Source1: tg_owt-packager.sh +Source2: tg_owt-master.zip +Source3: ada-v2.9.0.zip +# Usage: bash ads-packager.sh +Source4: ada-packager.sh +Source5: 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 +Source6: rnnoise-git20210122.tar.gz # PATCH-FIX-OPENSUSE Patch1: 0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch %endif @@ -64,6 +65,10 @@ Patch1: 0002-use-bundled-rnnoise-expected-gsl-ranges-webrtc.patch 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 # 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 @@ -75,6 +80,11 @@ 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++ @@ -88,6 +98,7 @@ BuildRequires: libjpeg-devel BuildRequires: liblz4-devel BuildRequires: ninja BuildRequires: pkgconfig +BuildRequires: python3 >= 3.7 BuildRequires: unzip BuildRequires: wayland-devel BuildRequires: webkit2gtk3-devel @@ -137,11 +148,6 @@ BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(harfbuzz) BuildRequires: pkgconfig(hunspell) BuildRequires: pkgconfig(jemalloc) -BuildRequires: pkgconfig(libavcodec) -BuildRequires: pkgconfig(libavdevice) -BuildRequires: pkgconfig(libavfilter) -BuildRequires: pkgconfig(libavformat) -BuildRequires: pkgconfig(libavutil) BuildRequires: pkgconfig(libcrypto) BuildRequires: pkgconfig(liblzma) BuildRequires: pkgconfig(libmng) @@ -219,17 +225,24 @@ The service also provides APIs to independent developers. %prep %setup -q -n tdesktop-%{version}-full -%autopatch -p1 -mkdir ../Libraries +%autopatch -p1 -M 6 + +cd %{_builddir} +mkdir -p %{_builddir}/Libraries +unzip -q %{S:3} +mv ada-v2.9.0 %{_builddir}/Libraries/ada + +mkdir -p %{_builddir}/Libraries/openh264/include +tar xzf %{S:5} +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}-full +%setup -q -T -D -b 6 -n tdesktop-%{version}-full mv ../rnnoise-git20210122 ../Libraries/rnnoise %endif -cd ../ -unzip -q %{SOURCE3} +unzip -q %{SOURCE2} mv tg_owt-master Libraries/tg_owt %build @@ -253,6 +266,14 @@ pushd %{_builddir}/Libraries/rnnoise 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 @@ -261,8 +282,10 @@ cmake -G Ninja \ %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 \ diff --git a/tg_owt-dlopen-headers.tar.gz b/tg_owt-dlopen-headers.tar.gz new file mode 100644 index 0000000..e43f90e --- /dev/null +++ b/tg_owt-dlopen-headers.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27b9dd3b758f638bbee54ebe3a3d3a15d8e0941a5a2a94b3e8699d508712ee0f +size 17931 diff --git a/tg_owt-master.zip b/tg_owt-master.zip index da42323..fe53efc 100644 --- a/tg_owt-master.zip +++ b/tg_owt-master.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e08fff17a4b5460ea60e31bf71db10e8d8065fbaa8871f6ddf993450940ebae9 -size 25189554 +oid sha256:6addc180f1fbfe33b03b3616c1f9fefa5d0a4a68972de4bc2739b69b893ad49e +size 23497999 diff --git a/tg_owt-packager.py b/tg_owt-packager.py deleted file mode 100644 index 78ffb2b..0000000 --- a/tg_owt-packager.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/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) diff --git a/tg_owt-packager.sh b/tg_owt-packager.sh index 547b44e..774b675 100644 --- a/tg_owt-packager.sh +++ b/tg_owt-packager.sh @@ -2,14 +2,16 @@ # 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="c9cc4390ab951f2cbc103ff783a11f398b27660b" +# tg_owt_origin="4a60ce1ab9fdb962004c6a959f682ace3db50cbd" +# use xuzhao9's fork to workaround the h264 dlopen issue +tg_owt_origin="0342ae21ee2cc6c6052798bc8fa6b737d9a66418" rm -rf tg_owt \ && mkdir tg_owt \ && cd tg_owt \ && git init tg_owt \ && cd tg_owt \ - && git remote add origin https://github.com/desktop-app/tg_owt.git \ + && 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 \