1
0

Accepting request 1184208 from home:manfred-h:server:messaging

- Updated to version 5.2.0
  * Pay for content with Telegram Stars.
  * Enable local passcode unlock by Windows Hello and Touch ID.
  * Allow opening forums, topics and archive in a separate window.
- Updated to version 5.1.8
  * Support nice blockquotes and code blocks edition when composing
    messages.
  * Support collapsing blockquotes and specifying syntax highlight
    language.
  * Support nice spoiler animation in the message composing input
    field.
- Update tg_owt to git commit c9cc4390ab951f2cbc103ff783a11f398b27660b

OBS-URL: https://build.opensuse.org/request/show/1184208
OBS-URL: https://build.opensuse.org/package/show/server:messaging/telegram-desktop?expand=0&rev=326
This commit is contained in:
Xu Zhao 2024-07-01 13:48:38 +00:00 committed by Git OBS Bridge
commit 9bce24ff6c
14 changed files with 3149 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,16 @@
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
@@ -94,11 +94,8 @@ 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_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

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>

View File

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

View File

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

2552
telegram-desktop.changes Normal file

File diff suppressed because it is too large Load Diff

320
telegram-desktop.spec Normal file
View File

@ -0,0 +1,320 @@
#
# spec file for package telegram-desktop
#
# Copyright (c) 2024 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
Name: telegram-desktop
Version: 5.2.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: 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
# Usage: bash tg_owt-packager.sh
Source1: tg_owt-packager.py
Source2: tg_owt-packager.sh
Source3: tg_owt-master.zip
%if %{with use_system_rnnoise}
# PATCH-FIX-OPENSUSE
Patch1: 0001-use-bundled-webrtc.patch
%else
Source4: rnnoise-git20210122.tar.gz
# PATCH-FIX-OPENSUSE
Patch1: 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
# 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
%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: 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(libavcodec)
BuildRequires: pkgconfig(libavdevice)
BuildRequires: pkgconfig(libavfilter)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
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: 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}-full
%autopatch -p1
mkdir ../Libraries
# If not TW, unpack rnnoise source
%if %{without use_system_rnnoise}
%setup -q -T -D -b 4 -n tdesktop-%{version}-full
mv ../rnnoise-git20210122 ../Libraries/rnnoise
%endif
cd ../
unzip -q %{SOURCE3}
mv tg_owt-master Libraries/tg_owt
%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
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_SPECIAL_TARGET=linux \
-DTG_OWT_LIBJPEG_INCLUDE_PATH=/usr/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}-full
# 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

3
tg_owt-master.zip Normal file
View File

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

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="c9cc4390ab951f2cbc103ff783a11f398b27660b"
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 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