aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo <thinkabit.ukim@gmail.com>2019-04-23 00:20:41 -0300
committerKevin Daudt <kdaudt@alpinelinux.org>2019-05-11 21:03:50 +0000
commitf67c498b9d45004ac18e3929e5f3578c9893b99f (patch)
tree44efe5eed3391011a60eb623388f78a51971e0f0
parent199296e63294be05bd25c20e8e648e8817fc0272 (diff)
downloadaports-f67c498b9d45004ac18e3929e5f3578c9893b99f.tar.bz2
aports-f67c498b9d45004ac18e3929e5f3578c9893b99f.tar.xz
testing/telegram-desktop: fetch source from upstream
-rw-r--r--testing/telegram-desktop/APKBUILD167
-rw-r--r--testing/telegram-desktop/FindBreakpad.cmake19
-rw-r--r--testing/telegram-desktop/PrecompiledHeader-cmake.patch35
-rw-r--r--testing/telegram-desktop/Telegram.cmake241
-rw-r--r--testing/telegram-desktop/TelegramCodegen.cmake97
-rw-r--r--testing/telegram-desktop/TelegramCodegenTools.cmake33
-rw-r--r--testing/telegram-desktop/TelegramTests.cmake62
-rw-r--r--testing/telegram-desktop/ThirdParty-crl.cmake17
-rw-r--r--testing/telegram-desktop/ThirdParty-libtgvoip-webrtc.cmake371
-rw-r--r--testing/telegram-desktop/ThirdParty-libtgvoip.cmake38
-rw-r--r--testing/telegram-desktop/add-private-qt-functions.patch101
-rw-r--r--testing/telegram-desktop/dynamic-linking-qt5.patch47
-rw-r--r--testing/telegram-desktop/fix-missing-use-of-pch.patch11
-rw-r--r--testing/telegram-desktop/libtgvoip.patch16
-rw-r--r--testing/telegram-desktop/no-pulse.patch23
-rw-r--r--testing/telegram-desktop/tdesktop.patch585
16 files changed, 1162 insertions, 701 deletions
diff --git a/testing/telegram-desktop/APKBUILD b/testing/telegram-desktop/APKBUILD
index e6f4f864c9..d951cff246 100644
--- a/testing/telegram-desktop/APKBUILD
+++ b/testing/telegram-desktop/APKBUILD
@@ -1,14 +1,15 @@
# Maintainer: Alex Raschi <raschi.alex@gmail.com>
+# Contributor: Leo <thinkabit.ukim@gmail.com>
pkgname=telegram-desktop
pkgver=1.6.7
-_pkgurl="https://github.com/telegramdesktop/tdesktop.git"
# https://github.com/telegramdesktop/tdesktop/blob/v$pkgver/docs/building-cmake.md
-_gypver=702ac58e477214c635d9b541932e75a95d349352
-_gypurl="https://chromium.googlesource.com/external/gyp"
-_rangever=0.5.0
-_rangeurl="https://github.com/ericniebler/range-v3.git"
+_libtgvoip_commit=e7010506210fbb3a6704d7ac1276b3334f9ab6c9
+_GSL_commit=d846fe50a3f0bb7767c7e087a05f4be95f4da0ec
+_variant_commit=550ac2f159ca883d360c196149b466955c77a573
+_crl_commit=84072fba75f14620935e5e91788ce603daeb1988
pkgrel=0
pkgdesc="Telegram Desktop messaging app"
+options="!check" # Requires Catch2 to be packaged.
url="https://desktop.telegram.org/"
arch="all !s390x"
license="GPL-3.0-or-later WITH OpenSSL"
@@ -30,71 +31,81 @@ makedepends="cmake
alsa-lib-dev
libexecinfo-dev
python2
+ xxhash-dev
+ range-v3-dev
grep"
-source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.gz
- libtgvoip.patch
+source="
+ $pkgname-$pkgver.tar.gz::https://github.com/telegramdesktop/tdesktop/archive/v${pkgver}.tar.gz
+ libtgvoip-$_libtgvoip_commit.tar.gz::https://github.com/telegramdesktop/libtgvoip/archive/${_libtgvoip_commit}.tar.gz
+ GSL-$_GSL_commit.tar.gz::https://github.com/Microsoft/GSL/archive/${_GSL_commit}.tar.gz
+ variant-$_variant_commit.tar.gz::https://github.com/mapbox/variant/archive/${_variant_commit}.tar.gz
+ crl-$_crl_commit.tar.gz::https://github.com/telegramdesktop/crl/archive/${_crl_commit}.tar.gz
musl.patch
no-gtk2.patch
no-pulse.patch
- tdesktop.patch
xdg.patch
ppc64le-enable-arch.patch
- system-wide-fonts.patch"
-builddir="$srcdir/$pkgname-$pkgver"
-_reldir="$builddir/out/Release"
+ system-wide-fonts.patch
+ FindBreakpad.cmake
+ Telegram.cmake
+ TelegramCodegen.cmake
+ TelegramCodegenTools.cmake
+ TelegramTests.cmake
+ ThirdParty-crl.cmake
+ ThirdParty-libtgvoip-webrtc.cmake
+ ThirdParty-libtgvoip.cmake
+ PrecompiledHeader-cmake.patch
+ add-private-qt-functions.patch
+ fix-missing-use-of-pch.patch
+ dynamic-linking-qt5.patch"
+builddir="$srcdir/tdesktop-$pkgver"
-snapshot() {
- local libs="$builddir"/Libraries
+prepare() {
+ cd "$builddir"
- mkdir -p "$srcdir"
- cd "$srcdir"
- git clone --recurse-submodules "$_pkgurl" -b "v$pkgver" "$builddir"
+ rmdir Telegram/ThirdParty/libtgvoip
+ rmdir Telegram/ThirdParty/GSL
+ rmdir Telegram/ThirdParty/variant
+ rmdir Telegram/ThirdParty/crl
- # clone also gyp and range-v3
- mkdir "$libs"
- cd "$libs"
- git clone --recurse-submodules "$_gypurl" -b "master" gyp
- git clone --recurse-submodules "$_rangeurl" -b "$_rangever" range-v3
- cd gyp
- # chromium.googlesource.com doesn't support cloning commits
- git reset --hard "$_gypver"
+ # Copy fetched libraries to their appropriate locations
+ mv ../libtgvoip-${_libtgvoip_commit} "${builddir}"/Telegram/ThirdParty/libtgvoip
+ mv ../GSL-${_GSL_commit} "${builddir}"/Telegram/ThirdParty/GSL
+ mv ../variant-${_variant_commit} "${builddir}"/Telegram/ThirdParty/variant
+ mv ../crl-${_crl_commit} "${builddir}"/Telegram/ThirdParty/crl
- cd "$srcdir"
- find "$builddir" -name .git -exec rm -rf {} +
- # git archive doesn't support submodules
- tar czf "$builddir".tar.gz "${builddir##*/}"
- scp "$builddir".tar.gz dev.alpinelinux.org:/archive/$pkgname/
-}
+ # Copy cmake files
+ mv ../Telegram.cmake "${builddir}"/Telegram/CMakeLists.txt
+ mv ../ThirdParty-crl.cmake "${builddir}"/Telegram/ThirdParty/crl/CMakeLists.txt
+ mv ../ThirdParty-libtgvoip.cmake "${builddir}"/Telegram/ThirdParty/libtgvoip/CMakeLists.txt
+ mv ../ThirdParty-libtgvoip-webrtc.cmake \
+ "${builddir}"/Telegram/ThirdParty/libtgvoip/webrtc_dsp/CMakeLists.txt
+
+ mkdir -p "${builddir}"/Telegram/cmake
+ mv ../FindBreakpad.cmake "${builddir}"/Telegram/cmake
+ mv ../TelegramCodegen.cmake "${builddir}"/Telegram/cmake
+ mv ../TelegramTests.cmake "${builddir}"/Telegram/cmake
+
+ mkdir -p "${builddir}"/Telegram/native
+ mv ../TelegramCodegenTools.cmake "${builddir}"/Telegram/native/CMakeLists.txt
-prepare() {
cd "$builddir/Telegram/ThirdParty"
rm -rf minizip # we have this system-wide
- cd "$builddir/Libraries"
- patch -p1 -i "$builddir"/Telegram/Patches/gyp.diff -d "gyp"
-
default_prepare
}
build() {
- cd "$builddir/Telegram/gyp"
+ cd "$builddir"/Telegram/native
+ CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
+ make
+
+ mkdir "$builddir"/Telegram/telegram-build
+ cd "$builddir"/Telegram/telegram-build
export CPPFLAGS="$CPPFLAGS -Winvalid-pch"
export CXXFLAGS="$CXXFLAGS -Winvalid-pch"
-
- # https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/telegram-desktop#n80
- ../../Libraries/gyp/gyp \
- -Dapi_id=17349 \
- -Dapi_hash=344583e45741c457fe1862106095a5eb \
- -Dbuild_defines="TDESKTOP_DISABLE_CRASH_REPORTS,TDESKTOP_DISABLE_AUTOUPDATE,TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME,TDESKTOP_DISABLE_GTK_INTEGRATION,TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION" \
- -Gconfig=Release \
- --depth=. \
- --generator-output=../.. \
- -Goutput_dir=out \
- Telegram.gyp \
- --format=cmake
-
- cd "$_reldir"
- printf '%s\n' 'set_target_properties(Telegram PROPERTIES SKIP_BUILD_RPATH TRUE)' >> CMakeLists.txt
+ export CXXFLAGS="$CXXFLAGS -DTDESKTOP_API_ID=17349"
+ export CXXFLAGS="$CXXFLAGS -DTDESKTOP_API_HASH=344583e45741c457fe1862106095a5eb"
if [ "$CBUILD" != "$CHOST" ]; then
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
@@ -105,35 +116,23 @@ build() {
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
- -DCMAKE_ASM_COMPILER=as \
- ${CMAKE_CROSSOPTS}
+ -DENABLE_PULSEAUDIO=OFF \
+ -DENABLE_CRASH_REPORTS=OFF \
+ -DENABLE_GTK_INTEGRATION=OFF \
+ -DBUILD_TESTS=OFF \
+ ${CMAKE_CROSSOPTS} ..
make
}
-check() {
- local test
-
- cd "$_reldir"
- for test in tests_*; do
- ./"$test"
- done
-}
-
package() {
- local size
-
- cd "$_reldir"
+ cd "$builddir"/Telegram/telegram-build
mkdir -p "$pkgdir"/usr/bin
- mv Telegram "$pkgdir"/usr/bin/telegram-desktop
-
- cd "$builddir"
- mkdir -p "$pkgdir"/usr/share/applications
- mv lib/xdg/telegramdesktop.desktop "$pkgdir"/usr/share/applications/telegram-desktop.desktop
+ make DESTDIR="$pkgdir" install
- mkdir -p "$pkgdir"/usr/share/kservices5
- mv lib/xdg/tg.protocol "$pkgdir"/usr/share/kservices5
+ # Fix name to be telegram-desktop
+ mv "$pkgdir"/usr/bin/Telegram "$pkgdir"/usr/bin/telegram-desktop
- cd Telegram/Resources/art
+ cd "${builddir}"/Telegram/Resources/art
mkdir -p "$pkgdir"/usr/share/icons/hicolor
for size in 16 32 48 64 128 256 512; do
mkdir -p "$pkgdir"/usr/share/icons/hicolor/"$size"x"$size"/apps
@@ -141,12 +140,26 @@ package() {
done
}
-sha512sums="7a6775c42869617789862594a0665b2b9e6a1b3a05162f3c684a0fcc9960f608404a0f21f1edea261ab01e0bc0fa843a37e0cf1b0c189f3d5593cbe1abd8bcf8 telegram-desktop-1.6.7.tar.gz
-9ee0dbc4b04454a2f440daa381df765616962e8e8c4330e96851dbc5f2a283da687282d666d2667aac67c3467d2079a94e4fef358dbb18eb24a064d55adc7a40 libtgvoip.patch
+sha512sums="1292b686e47c82f7670e1a528092222c8a61532a9ed64d0e4d3879fa95037b284aa40a956ac1c6739262c4fdf22fb5e9492f6747e971668297cca142a51c5b46 telegram-desktop-1.6.7.tar.gz
+a8ef97da8ab50fdbb166933b8e8fd7b6d7db95a95dcdcd92f6882e1f1104e283a6dece5cf4c40bd8d56738efac3e3905bb403287ede2ec2dc5ace3815df4b097 libtgvoip-e7010506210fbb3a6704d7ac1276b3334f9ab6c9.tar.gz
+83560cb0c39b6a4781e916c6081ad2728296e1b19760ca1b6426a8431fb6d7093760a882c539dd77152f5892fe081b1795af6366ea91385bb10aba6adf27170f GSL-d846fe50a3f0bb7767c7e087a05f4be95f4da0ec.tar.gz
+537ce0a1731274da63a5be063311f7113c1391081e43970663a994b82a7b2e860302406c2931184789661d86343b2c60064c7014b73dc42799573f5b93bc12ff variant-550ac2f159ca883d360c196149b466955c77a573.tar.gz
+a148b62500c2c735065a0612d7168ee671e9b251b822efea90d25718fe0f0fc2abb8f4c93360d6ac38242c669a2d4349ea917cdc63564ebc4a8825fde13666fb crl-84072fba75f14620935e5e91788ce603daeb1988.tar.gz
fc672d8168f6b2807e596570bc57f3b89296891b5d62b8e12b38193ed4919e4eb17efd72691c4086fb0ff4383de54695a9faf9874a0727a0980ef35e5ca4bee7 musl.patch
cb01655dd097b68e89b15e6e4b1f6da10c52e8bec681eeef9807ca376283b10cb3da34acc976c790f3c8dea05acbef1ba1967612920a2e4acb3b9da79e251a0d no-gtk2.patch
-9df70f5057fd9938cab87529693ad9617da0fdbb9084ff57395cd540343a0dcc1ecfba4f868b0043b252fe1aca33d0d214fb07931860296e66fbf11825f95fb9 no-pulse.patch
-cdcc343e8507aed807ffb683f2b728db78c3b981a765746bbda59a97c00b373bfeb13c4251e36e8bc78c84728e91f964eb9d31616b4082393e074d7c12b44454 tdesktop.patch
+90caf4e67f1fb8bcb26455553b90e35d247cbf67097508bd430f7f790aad9e2ae1646b0ea174013c87c331fb37e60633031187a24787e6a73ca73b706d741739 no-pulse.patch
8de8c0508177da5fcac4f2dcee4d8baef4b99f74f1dca296567bc3689a6bd17a47c1c945df504abc8811b82a687010d0709503c7c32e47d2ebb1cf0e374c80c5 xdg.patch
3647ad5fff6326ba9c75fa98189a08c0909af8d1c2b704c8c62fd9da6603f5162af3176c37daa67eb5896bebe3814bf1fd66b9e93c78cbd9b439e472d0db4b44 ppc64le-enable-arch.patch
-ce6be003220267bac5483caf8302b492e1581892bc36d35a61236ebf9f9d766b8bd2159557a1c36256aa85f461797a38bfaae57b12da7a72101b21c0b17ed653 system-wide-fonts.patch"
+ce6be003220267bac5483caf8302b492e1581892bc36d35a61236ebf9f9d766b8bd2159557a1c36256aa85f461797a38bfaae57b12da7a72101b21c0b17ed653 system-wide-fonts.patch
+8b75da50a8212cd7c77e497ad5a49290e2656a2e01037d179cd6270105337a9adb238814f98bdf7a3e954ce8661dc3183a7400533067f9a21e38133a6628563a FindBreakpad.cmake
+485133c447b3414c60e94c074639404768798ec6993095ed108c3b927b6fd423dfee0b68c5c3e12e0d87cc1e53042ab1e76641290c2f71fb29db21245013d72f Telegram.cmake
+56aaf0e35ba1989d463ffa2699e7c0a7235168599f0720f66ff159f03541920e04e5944554b4d1b3a0893cf4581ff50ff00600b54522d24d59fa7192e4f80c0a TelegramCodegen.cmake
+f6e42004d36c69497fd635f1bbd9779027fef1b44fc506cba85ff19c5e49e6b41008782ffb65d59ef4acef78dc0a671c285789ae21cb7a67a9b215c28a2c2eeb TelegramCodegenTools.cmake
+4726ba77330d61f952c7e5af82454cc5536cd92634150406ea5dbc303acfd1d33093334b9b04cf06aa4adca84d97553f28b44dcc554d10af8052352f265c9505 TelegramTests.cmake
+fe1a860184fc31888430d8efb5d12bcf57ef0ed7d64a9570159b906138e987e711e52ea87e3e0567bf749f0336d394aba8a7af9bae6b156c621a13f0aa301b6e ThirdParty-crl.cmake
+2282dedd3d6551893674272ea1308d0c36469711ecf52d1ac2cdc719ab0560a35abc968cc903678dd4e3c2454324e18bcb897b46c597a02013c6d75a7406fffe ThirdParty-libtgvoip-webrtc.cmake
+72b7e188c6787b05f68031f24d901194315243a8b8fb5c3e0c10f1e7c75554ae147810e4d47fa2a0fdf7323da07f48b1cd4a6b840cffd65af96ad9a997e4caff ThirdParty-libtgvoip.cmake
+4f6e4d73fe5774a2fe813b9424438d86e23cfb47483b9f2be56ff14bc471c6312e93549a3a712f1b4e51a0663dc6df086134f5b139536709234a31a695635677 PrecompiledHeader-cmake.patch
+d7f8db23af250156b73b47ad4b1996b73643eb224c969cd1da2929eedfa23a3784ccf8a5728070f464891c621ec6f786e5da323f5bbb2a2cfba999cf80d9dec4 add-private-qt-functions.patch
+6289d5a3eb224ebb05ab64e23ca3d081e617d905cec07edbba423265dc617548005eeb643ce5dfb2fcef9ac774e9f7b64150729bd894ca0e94af0e2aea9c823b fix-missing-use-of-pch.patch
+ad7f1b811b7907b24e0708c5b8f7531891e163b3edebebb159e47cbc24a9201a6ddb5f276f4d0968f84c6d928997f1e94fe9ca678b31e9aad90cdf28449ce39f dynamic-linking-qt5.patch"
diff --git a/testing/telegram-desktop/FindBreakpad.cmake b/testing/telegram-desktop/FindBreakpad.cmake
new file mode 100644
index 0000000000..42da3f50cd
--- /dev/null
+++ b/testing/telegram-desktop/FindBreakpad.cmake
@@ -0,0 +1,19 @@
+find_path(BREAKPAD_CLIENT_INCLUDE_DIR
+ NAMES client/linux/handler/exception_handler.h
+ PATH_SUFFIXES breakpad
+)
+
+find_library(BREAKPAD_CLIENT_LIBRARY
+ NAMES breakpad_client
+)
+
+find_package_handle_standard_args(Breakpad DEFAULT_MSG
+ BREAKPAD_CLIENT_LIBRARY
+ BREAKPAD_CLIENT_INCLUDE_DIR
+)
+
+add_library(breakpad_client STATIC IMPORTED)
+add_dependencies(breakpad_client breakpad_build)
+
+set_property(TARGET breakpad_client PROPERTY IMPORTED_LOCATION ${BREAKPAD_CLIENT_LIBRARY})
+set_property(TARGET breakpad_client PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${BREAKPAD_CLIENT_INCLUDE_DIR})
diff --git a/testing/telegram-desktop/PrecompiledHeader-cmake.patch b/testing/telegram-desktop/PrecompiledHeader-cmake.patch
new file mode 100644
index 0000000000..d0d6bce829
--- /dev/null
+++ b/testing/telegram-desktop/PrecompiledHeader-cmake.patch
@@ -0,0 +1,35 @@
+--- a/Telegram/gyp/PrecompiledHeader.cmake
++++ b/Telegram/gyp/PrecompiledHeader.cmake
+@@ -79,7 +79,6 @@ function(export_all_flags _filename _source_name_for_flags)
+ endfunction()
+
+ function(add_precompiled_header _target _input)
+- if(CMAKE_COMPILER_IS_GNUCXX)
+ get_filename_component(_name ${_input} NAME)
+ set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
+ set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch")
+@@ -112,7 +111,7 @@ function(add_precompiled_header _target _input)
+ set(_compiler_FLAGS "@${_pch_c_flags_file}")
+ add_custom_command(
+ OUTPUT "${_output_c}"
+- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}"
++ COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}"
+ DEPENDS "${_pchfile}" "${_pch_c_flags_file}"
+ IMPLICIT_DEPENDS C "${_pch_header}"
+ COMMENT "Precompiling ${_name} for ${_target} (C)")
+@@ -123,7 +122,7 @@ function(add_precompiled_header _target _input)
+ set(_compiler_FLAGS "@${_pch_cpp_flags_file}")
+ add_custom_command(
+ OUTPUT "${_output_cxx}"
+- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
++ COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
+ DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}"
+ IMPLICIT_DEPENDS CXX "${_pch_header}"
+ COMMENT "Precompiling ${_name} for ${_target} (C++)")
+@@ -161,5 +160,4 @@ function(add_precompiled_header _target _input)
+ OBJECT_DEPENDS "${_object_depends}")
+ endif()
+ endforeach()
+- endif(CMAKE_COMPILER_IS_GNUCXX)
+ endfunction()
+
diff --git a/testing/telegram-desktop/Telegram.cmake b/testing/telegram-desktop/Telegram.cmake
new file mode 100644
index 0000000000..f389bbc287
--- /dev/null
+++ b/testing/telegram-desktop/Telegram.cmake
@@ -0,0 +1,241 @@
+cmake_minimum_required(VERSION 3.8)
+
+project(TelegramDesktop)
+
+set(CMAKE_CXX_STANDARD 17)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+include(GNUInstallDirs)
+
+list(APPEND CMAKE_MODULE_PATH
+ ${CMAKE_SOURCE_DIR}/gyp
+ ${CMAKE_SOURCE_DIR}/cmake
+)
+
+option(BUILD_TESTS "Build all available test suites" OFF)
+option(ENABLE_CRASH_REPORTS "Enable crash reports" ON)
+option(ENABLE_GTK_INTEGRATION "Enable GTK integration" ON)
+option(USE_LIBATOMIC "Link Statically against libatomic.a" OFF)
+option(ENABLE_OPENAL_EFFECTS "Enable OpenAL effects" ON)
+
+find_package(LibLZMA REQUIRED)
+find_package(OpenAL REQUIRED)
+find_package(OpenSSL REQUIRED)
+find_package(Threads REQUIRED)
+find_package(X11 REQUIRED)
+find_package(ZLIB REQUIRED)
+
+find_package(Qt5 REQUIRED COMPONENTS Core DBus Gui Widgets Network)
+get_target_property(QTCORE_INCLUDE_DIRS Qt5::Core INTERFACE_INCLUDE_DIRECTORIES)
+list(GET QTCORE_INCLUDE_DIRS 0 QT_INCLUDE_DIR)
+
+foreach(__qt_module IN ITEMS QtCore QtGui)
+ list(APPEND QT_PRIVATE_INCLUDE_DIRS
+ ${QT_INCLUDE_DIR}/${__qt_module}/${Qt5_VERSION}
+ ${QT_INCLUDE_DIR}/${__qt_module}/${Qt5_VERSION}/${__qt_module}
+ )
+endforeach()
+message(STATUS "Using Qt private include directories: ${QT_PRIVATE_INCLUDE_DIRS}")
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(FFMPEG REQUIRED libavcodec libavformat libavutil libswresample libswscale)
+pkg_check_modules(LIBDRM REQUIRED libdrm)
+pkg_check_modules(LIBVA REQUIRED libva libva-drm libva-x11)
+pkg_check_modules(MINIZIP REQUIRED minizip)
+
+set(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/ThirdParty)
+list(APPEND THIRD_PARTY_INCLUDE_DIRS
+ ${THIRD_PARTY_DIR}/crl/src
+ ${THIRD_PARTY_DIR}/GSL/include
+ ${THIRD_PARTY_DIR}/emoji_suggestions
+ ${THIRD_PARTY_DIR}/libtgvoip
+ ${THIRD_PARTY_DIR}/variant/include
+)
+
+add_subdirectory(${THIRD_PARTY_DIR}/crl)
+add_subdirectory(${THIRD_PARTY_DIR}/libtgvoip)
+
+set(TELEGRAM_SOURCES_DIR ${CMAKE_SOURCE_DIR}/SourceFiles)
+set(TELEGRAM_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/Resources)
+
+include_directories(${TELEGRAM_SOURCES_DIR})
+
+set(GENERATED_DIR ${CMAKE_BINARY_DIR}/generated)
+file(MAKE_DIRECTORY ${GENERATED_DIR})
+
+include(TelegramCodegen)
+set_property(SOURCE ${TELEGRAM_GENERATED_SOURCES} PROPERTY SKIP_AUTOMOC ON)
+
+set(QRC_FILES
+ Resources/qrc/telegram.qrc
+ Resources/qrc/telegram_emoji_1.qrc
+ Resources/qrc/telegram_emoji_2.qrc
+ Resources/qrc/telegram_emoji_3.qrc
+ Resources/qrc/telegram_emoji_4.qrc
+ Resources/qrc/telegram_emoji_5.qrc
+
+ # This only disables system plugin search path
+ # We do not want this behavior for system build
+ # Resources/qrc/telegram_linux.qrc
+)
+
+file(GLOB FLAT_SOURCE_FILES
+ SourceFiles/*.cpp
+ SourceFiles/base/*.cpp
+ SourceFiles/calls/*.cpp
+ SourceFiles/chat_helpers/*.cpp
+ SourceFiles/core/*.cpp
+ SourceFiles/data/*.cpp
+ SourceFiles/dialogs/*.cpp
+ SourceFiles/history/*.cpp
+ SourceFiles/inline_bots/*.cpp
+ SourceFiles/intro/*.cpp
+ SourceFiles/lang/*.cpp
+ SourceFiles/mtproto/*.cpp
+ SourceFiles/overview/*.cpp
+ SourceFiles/passport/*.cpp
+ SourceFiles/platform/linux/*.cpp
+ SourceFiles/profile/*.cpp
+ SourceFiles/settings/*.cpp
+ SourceFiles/storage/*.cpp
+ SourceFiles/storage/cache/*.cpp
+ SourceFiles/support/*cpp
+ ${THIRD_PARTY_DIR}/emoji_suggestions/*.cpp
+)
+file(GLOB FLAT_EXTRA_FILES
+ SourceFiles/qt_static_plugins.cpp
+ SourceFiles/base/*_tests.cpp
+ SourceFiles/base/tests_main.cpp
+ SourceFiles/passport/passport_edit_identity_box.cpp
+ SourceFiles/passport/passport_form_row.cpp
+ SourceFiles/storage/*_tests.cpp
+ SourceFiles/storage/*_win.cpp
+ SourceFiles/storage/cache/*_tests.cpp
+)
+list(REMOVE_ITEM FLAT_SOURCE_FILES ${FLAT_EXTRA_FILES})
+
+file(GLOB_RECURSE SUBDIRS_SOURCE_FILES
+ SourceFiles/boxes/*.cpp
+ SourceFiles/export/*.cpp
+ SourceFiles/history/*.cpp
+ SourceFiles/info/*.cpp
+ SourceFiles/media/*.cpp
+ SourceFiles/ui/*.cpp
+ SourceFiles/window/*.cpp
+)
+
+add_executable(Telegram WIN32 ${QRC_FILES} ${FLAT_SOURCE_FILES} ${SUBDIRS_SOURCE_FILES})
+
+set(TELEGRAM_COMPILE_DEFINITIONS
+ TDESKTOP_DISABLE_AUTOUPDATE
+ TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
+ NOMINMAX
+ __STDC_FORMAT_MACROS
+)
+
+set(TELEGRAM_INCLUDE_DIRS
+ ${FFMPEG_INCLUDE_DIRS}
+ ${GENERATED_DIR}
+ ${LIBDRM_INCLUDE_DIRS}
+ ${LIBLZMA_INCLUDE_DIRS}
+ ${LIBVA_INCLUDE_DIRS}
+ ${MINIZIP_INCLUDE_DIRS}
+ ${OPENAL_INCLUDE_DIR}
+ ${QT_PRIVATE_INCLUDE_DIRS}
+ ${THIRD_PARTY_INCLUDE_DIRS}
+ ${ZLIB_INCLUDE_DIR}
+)
+
+set(TELEGRAM_LINK_LIBRARIES
+ xxhash
+ crl
+ tgvoip
+ OpenSSL::Crypto
+ OpenSSL::SSL
+ Qt5::DBus
+ Qt5::Network
+ Qt5::Widgets
+ Threads::Threads
+ ${FFMPEG_LIBRARIES}
+ ${LIBDRM_LIBRARIES}
+ ${LIBLZMA_LIBRARIES}
+ ${LIBVA_LIBRARIES}
+ ${MINIZIP_LIBRARIES}
+ ${OPENAL_LIBRARY}
+ ${X11_X11_LIB}
+ ${ZLIB_LIBRARY_RELEASE}
+)
+
+if(ENABLE_CRASH_REPORTS)
+ find_package(Breakpad REQUIRED)
+ list(APPEND TELEGRAM_LINK_LIBRARIES
+ breakpad_client
+ )
+else()
+ list(APPEND TELEGRAM_COMPILE_DEFINITIONS
+ TDESKTOP_DISABLE_CRASH_REPORTS
+ )
+endif()
+
+if(USE_LIBATOMIC)
+ list(APPEND TELEGRAM_LINK_LIBRARIES libatomic.a)
+endif(USE_LIBATOMIC)
+
+if(ENABLE_GTK_INTEGRATION)
+ pkg_check_modules(APPINDICATOR REQUIRED appindicator3-0.1)
+ pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
+ list(APPEND TELEGRAM_INCLUDE_DIRS
+ ${APPINDICATOR_INCLUDE_DIRS}
+ ${GTK3_INCLUDE_DIRS}
+ )
+ list(APPEND TELEGRAM_LINK_LIBRARIES
+ ${APPINDICATOR_LIBRARIES}
+ ${GTK3_LIBRARIES}
+ )
+else()
+ list(APPEND TELEGRAM_COMPILE_DEFINITIONS
+ TDESKTOP_DISABLE_GTK_INTEGRATION
+ )
+endif()
+
+if(ENABLE_OPENAL_EFFECTS)
+ list(APPEND TELEGRAM_COMPILE_DEFINITIONS
+ AL_ALEXT_PROTOTYPES
+ )
+else()
+ list(APPEND TELEGRAM_COMPILE_DEFINITIONS
+ TDESKTOP_DISABLE_OPENAL_EFFECTS
+ )
+endif()
+
+if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
+ list(APPEND TELEGRAM_COMPILE_DEFINITIONS
+ Q_OS_LINUX64
+ )
+else()
+ list(APPEND TELEGRAM_COMPILE_DEFINITIONS
+ Q_OS_LINUX32
+ )
+endif()
+
+target_sources(Telegram PRIVATE ${TELEGRAM_GENERATED_SOURCES})
+add_dependencies(Telegram telegram_codegen)
+
+include(PrecompiledHeader)
+add_precompiled_header(Telegram SourceFiles/stdafx.h)
+
+target_compile_definitions(Telegram PUBLIC ${TELEGRAM_COMPILE_DEFINITIONS})
+target_include_directories(Telegram PUBLIC ${TELEGRAM_INCLUDE_DIRS})
+target_link_libraries(Telegram ${TELEGRAM_LINK_LIBRARIES})
+
+set_target_properties(Telegram PROPERTIES AUTOMOC_MOC_OPTIONS -bTelegram_pch/stdafx.h)
+
+if(BUILD_TESTS)
+ include(TelegramTests)
+endif()
+
+install(TARGETS Telegram RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${CMAKE_SOURCE_DIR}/../lib/xdg/telegramdesktop.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
diff --git a/testing/telegram-desktop/TelegramCodegen.cmake b/testing/telegram-desktop/TelegramCodegen.cmake
new file mode 100644
index 0000000000..8f99693284
--- /dev/null
+++ b/testing/telegram-desktop/TelegramCodegen.cmake
@@ -0,0 +1,97 @@
+set(TELEGRAM_GENERATED_SOURCES)
+
+set(IMPORT_EXECUTABLES "native/ImportExecutables.cmake" CACHE FILEPATH "POINT")
+INCLUDE(${IMPORT_EXECUTABLES})
+
+add_custom_command(
+ OUTPUT
+ ${GENERATED_DIR}/scheme.h
+ ${GENERATED_DIR}/scheme.cpp
+ COMMAND python ${TELEGRAM_SOURCES_DIR}/codegen/scheme/codegen_scheme.py -o${GENERATED_DIR} ${TELEGRAM_RESOURCES_DIR}/scheme.tl
+ DEPENDS ${TELEGRAM_RESOURCES_DIR}/scheme.tl
+ COMMENT "Codegen scheme.tl"
+)
+list(APPEND TELEGRAM_GENERATED_SOURCES
+ ${GENERATED_DIR}/scheme.h
+ ${GENERATED_DIR}/scheme.cpp
+)
+
+file(GLOB_RECURSE STYLES
+ ${TELEGRAM_RESOURCES_DIR}/*.palette
+ ${TELEGRAM_RESOURCES_DIR}/*.style
+ ${TELEGRAM_SOURCES_DIR}/*.style
+)
+set(GENERATED_STYLES)
+foreach(STYLE ${STYLES})
+ get_filename_component(STYLE_FILENAME ${STYLE} NAME)
+ get_filename_component(STYLE_NAME ${STYLE} NAME_WE)
+ if (${STYLE} MATCHES \\.palette$)
+ set(THIS_GENERATED_STYLES
+ ${GENERATED_DIR}/styles/palette.h
+ ${GENERATED_DIR}/styles/palette.cpp
+ )
+ else()
+ set(THIS_GENERATED_STYLES
+ ${GENERATED_DIR}/styles/style_${STYLE_NAME}.h
+ ${GENERATED_DIR}/styles/style_${STYLE_NAME}.cpp
+ )
+ endif()
+
+ # style generator does not like '-' in file path, so let's use relative paths...
+ add_custom_command(
+ OUTPUT ${THIS_GENERATED_STYLES}
+ COMMAND codegen_style -IResources -ISourceFiles -o${GENERATED_DIR}/styles ${STYLE}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ DEPENDS codegen_style ${STYLE}
+ COMMENT "Codegen style ${STYLE_FILENAME}"
+ )
+ set(GENERATED_STYLES ${GENERATED_STYLES} ${THIS_GENERATED_STYLES})
+endforeach()
+list(APPEND TELEGRAM_GENERATED_SOURCES ${GENERATED_STYLES})
+
+add_custom_command(
+ OUTPUT
+ ${GENERATED_DIR}/emoji.h
+ ${GENERATED_DIR}/emoji.cpp
+ ${GENERATED_DIR}/emoji_suggestions_data.h
+ ${GENERATED_DIR}/emoji_suggestions_data.cpp
+ COMMAND codegen_emoji -o${GENERATED_DIR} ${TELEGRAM_RESOURCES_DIR}/emoji_autocomplete.json
+ DEPENDS codegen_emoji
+ COMMENT "Codegen emoji"
+)
+
+list(APPEND TELEGRAM_GENERATED_SOURCES
+ ${GENERATED_DIR}/emoji.h
+ ${GENERATED_DIR}/emoji.cpp
+ ${GENERATED_DIR}/emoji_suggestions_data.h
+ ${GENERATED_DIR}/emoji_suggestions_data.cpp
+)
+
+add_custom_command(
+ OUTPUT
+ ${GENERATED_DIR}/lang_auto.h
+ ${GENERATED_DIR}/lang_auto.cpp
+ COMMAND codegen_lang -o${GENERATED_DIR} ${TELEGRAM_RESOURCES_DIR}/langs/lang.strings
+ DEPENDS codegen_lang
+ COMMENT "Codegen lang"
+)
+list(APPEND TELEGRAM_GENERATED_SOURCES
+ ${GENERATED_DIR}/lang_auto.h
+ ${GENERATED_DIR}/lang_auto.cpp
+)
+
+add_custom_command(
+ OUTPUT
+ ${GENERATED_DIR}/numbers.h
+ ${GENERATED_DIR}/numbers.cpp
+ COMMAND codegen_numbers -o${GENERATED_DIR} ${TELEGRAM_RESOURCES_DIR}/numbers.txt
+ DEPENDS codegen_numbers
+ COMMENT "Codegen numbers"
+)
+list(APPEND TELEGRAM_GENERATED_SOURCES
+ ${GENERATED_DIR}/numbers.h
+ ${GENERATED_DIR}/numbers.cpp
+)
+
+add_custom_target(telegram_codegen DEPENDS ${TELEGRAM_GENERATED_SOURCES})
+
diff --git a/testing/telegram-desktop/TelegramCodegenTools.cmake b/testing/telegram-desktop/TelegramCodegenTools.cmake
new file mode 100644
index 0000000000..611c5b5a81
--- /dev/null
+++ b/testing/telegram-desktop/TelegramCodegenTools.cmake
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 3.8)
+
+project(TelegramCodegen)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+find_package(Qt5 REQUIRED Core Gui)
+
+set(TELEGRAM_SOURCES_DIR ${CMAKE_SOURCE_DIR}/../SourceFiles)
+include_directories(${TELEGRAM_SOURCES_DIR})
+
+file(GLOB CODEGEN_COMMON_SOURCES
+ ${TELEGRAM_SOURCES_DIR}/codegen/common/*.h
+ ${TELEGRAM_SOURCES_DIR}/codegen/common/*.cpp
+)
+
+add_library(codegen_common OBJECT ${CODEGEN_COMMON_SOURCES})
+target_include_directories(codegen_common PUBLIC $<TARGET_PROPERTY:Qt5::Core,INTERFACE_INCLUDE_DIRECTORIES>)
+target_compile_options(codegen_common PUBLIC $<TARGET_PROPERTY:Qt5::Core,INTERFACE_COMPILE_OPTIONS>)
+
+foreach(TOOL emoji lang numbers style)
+ file(GLOB CODEGEN_${TOOL}_SOURCES
+ ${TELEGRAM_SOURCES_DIR}/codegen/${TOOL}/*.h
+ ${TELEGRAM_SOURCES_DIR}/codegen/${TOOL}/*.cpp
+ )
+
+ add_executable(codegen_${TOOL} ${CODEGEN_${TOOL}_SOURCES} $<TARGET_OBJECTS:codegen_common>)
+ target_link_libraries(codegen_${TOOL} Qt5::Core Qt5::Gui)
+endforeach()
+
+EXPORT(TARGETS codegen_emoji codegen_lang codegen_numbers codegen_style FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake )
+
diff --git a/testing/telegram-desktop/TelegramTests.cmake b/testing/telegram-desktop/TelegramTests.cmake
new file mode 100644
index 0000000000..bcb83508fc
--- /dev/null
+++ b/testing/telegram-desktop/TelegramTests.cmake
@@ -0,0 +1,62 @@
+#find_package(catch REQUIRED)
+set(catch_INCLUDE /usr/include/catch)
+
+file(GLOB LIST_TESTS_PY gyp/tests/list_tests.py)
+file(GLOB TESTS_LIST_TXT gyp/tests/tests_list.txt)
+
+add_executable(tests_algorithm
+ SourceFiles/base/algorithm_tests.cpp
+ SourceFiles/base/tests_main.cpp
+)
+
+add_executable(tests_flags
+ SourceFiles/base/flags_tests.cpp
+ SourceFiles/base/tests_main.cpp
+)
+
+add_executable(tests_flat_map
+ SourceFiles/base/flat_map_tests.cpp
+ SourceFiles/base/tests_main.cpp
+)
+
+add_executable(tests_flat_set
+ SourceFiles/base/flat_set_tests.cpp
+ SourceFiles/base/tests_main.cpp
+)
+
+add_executable(tests_rpl
+ SourceFiles/rpl/operators_tests.cpp
+ SourceFiles/rpl/producer_tests.cpp
+ SourceFiles/rpl/variable_tests.cpp
+ SourceFiles/base/tests_main.cpp
+)
+
+target_link_libraries(tests_algorithm Qt5::Core)
+target_link_libraries(tests_flags Qt5::Core)
+target_link_libraries(tests_flat_map Qt5::Core)
+target_link_libraries(tests_flat_set Qt5::Core)
+target_link_libraries(tests_rpl Qt5::Core)
+
+target_include_directories(tests_algorithm PUBLIC
+ ${catch_INCLUDE}
+)
+target_include_directories(tests_flags PUBLIC
+ ${catch_INCLUDE}
+)
+target_include_directories(tests_flat_map PUBLIC
+ ${catch_INCLUDE}
+ ${THIRD_PARTY_DIR}/GSL/include
+ ${THIRD_PARTY_DIR}/variant/include
+)
+target_include_directories(tests_flat_set PUBLIC
+ ${catch_INCLUDE}
+)
+target_include_directories(tests_rpl PUBLIC
+ ${catch_INCLUDE}
+ ${THIRD_PARTY_DIR}/GSL/include
+ ${THIRD_PARTY_DIR}/variant/include
+)
+
+enable_testing()
+add_test(tests python ${LIST_TESTS_PY} --input ${TESTS_LIST_TXT})
+
diff --git a/testing/telegram-desktop/ThirdParty-crl.cmake b/testing/telegram-desktop/ThirdParty-crl.cmake
new file mode 100644
index 0000000000..7752c61510
--- /dev/null
+++ b/testing/telegram-desktop/ThirdParty-crl.cmake
@@ -0,0 +1,17 @@
+project(crl)
+
+find_package(Qt5 REQUIRED COMPONENTS Core)
+
+file(GLOB CRL_SOURCE_FILES
+ src/crl/common/*.cpp
+ src/crl/dispatch/*.cpp
+ src/crl/qt/*.cpp
+ src/crl/winapi/*.cpp
+ src/crl/linux/*.cpp
+ src/crl/crl_time.cpp
+)
+
+add_library(${PROJECT_NAME} STATIC ${CRL_SOURCE_FILES})
+
+target_include_directories(${PROJECT_NAME} PUBLIC src)
+target_link_libraries(${PROJECT_NAME} Qt5::Core)
diff --git a/testing/telegram-desktop/ThirdParty-libtgvoip-webrtc.cmake b/testing/telegram-desktop/ThirdParty-libtgvoip-webrtc.cmake
new file mode 100644
index 0000000000..7785761598
--- /dev/null
+++ b/testing/telegram-desktop/ThirdParty-libtgvoip-webrtc.cmake
@@ -0,0 +1,371 @@
+project(webrtc)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+list(APPEND WEBRTC_C_SOURCE_FILES
+ "modules/third_party/fft/fft.c"
+ "modules/audio_coding/codecs/isac/main/source/pitch_estimator.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/arith_routines_logist.c"
+ "modules/audio_coding/codecs/isac/main/source/filterbanks.c"
+ "modules/audio_coding/codecs/isac/main/source/transform.c"
+ "modules/audio_coding/codecs/isac/main/source/pitch_filter.c"
+ "modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c"
+ "modules/audio_coding/codecs/isac/main/source/filter_functions.c"
+ "modules/audio_coding/codecs/isac/main/source/decode.c"
+ "modules/audio_coding/codecs/isac/main/source/lattice.c"
+ "modules/audio_coding/codecs/isac/main/source/intialize.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c"
+ "modules/audio_coding/codecs/isac/main/source/encode.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_analysis.c"
+ "modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c"
+ "modules/audio_coding/codecs/isac/main/source/entropy_coding.c"
+ "modules/audio_coding/codecs/isac/main/source/isac_vad.c"
+ "modules/audio_coding/codecs/isac/main/source/arith_routines.c"
+ "modules/audio_coding/codecs/isac/main/source/crc.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/decode_bwe.c"
+ "modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/isac.c"
+ "modules/audio_processing/ns/nsx_core.c"
+ "modules/audio_processing/ns/noise_suppression_x.c"
+ "modules/audio_processing/ns/nsx_core_c.c"
+ "modules/audio_processing/ns/ns_core.c"
+ "modules/audio_processing/ns/noise_suppression.c"
+ "modules/audio_processing/agc/legacy/analog_agc.c"
+ "modules/audio_processing/agc/legacy/digital_agc.c"
+ "common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
+ "common_audio/third_party/fft4g/fft4g.c"
+ "common_audio/ring_buffer.c"
+ "common_audio/signal_processing/complex_fft.c"
+ "common_audio/signal_processing/filter_ma_fast_q12.c"
+ "common_audio/signal_processing/levinson_durbin.c"
+ "common_audio/signal_processing/auto_corr_to_refl_coef.c"
+ "common_audio/signal_processing/resample_by_2_internal.c"
+ "common_audio/signal_processing/energy.c"
+ "common_audio/signal_processing/sqrt_of_one_minus_x_squared.c"
+ "common_audio/signal_processing/downsample_fast.c"
+ "common_audio/signal_processing/splitting_filter1.c"
+ "common_audio/signal_processing/filter_ar_fast_q12.c"
+ "common_audio/signal_processing/spl_init.c"
+ "common_audio/signal_processing/lpc_to_refl_coef.c"
+ "common_audio/signal_processing/cross_correlation.c"
+ "common_audio/signal_processing/division_operations.c"
+ "common_audio/signal_processing/auto_correlation.c"
+ "common_audio/signal_processing/get_scaling_square.c"
+ "common_audio/signal_processing/resample.c"
+ "common_audio/signal_processing/min_max_operations.c"
+ "common_audio/signal_processing/refl_coef_to_lpc.c"
+ "common_audio/signal_processing/filter_ar.c"
+ "common_audio/signal_processing/vector_scaling_operations.c"
+ "common_audio/signal_processing/resample_fractional.c"
+ "common_audio/signal_processing/real_fft.c"
+ "common_audio/signal_processing/ilbc_specific_functions.c"
+ "common_audio/signal_processing/complex_bit_reverse.c"
+ "common_audio/signal_processing/randomization_functions.c"
+ "common_audio/signal_processing/copy_set_operations.c"
+ "common_audio/signal_processing/resample_by_2.c"
+ "common_audio/signal_processing/get_hanning_window.c"
+ "common_audio/signal_processing/resample_48khz.c"
+ "common_audio/signal_processing/spl_inl.c"
+ "common_audio/signal_processing/spl_sqrt.c"
+ "common_audio/vad/vad_sp.c"
+ "common_audio/vad/webrtc_vad.c"
+ "common_audio/vad/vad_filterbank.c"
+ "common_audio/vad/vad_core.c"
+ "common_audio/vad/vad_gmm.c"
+)
+
+list(APPEND WEBRTC_CXX_SOURCE_FILES
+ "system_wrappers/source/field_trial.cc"
+ "system_wrappers/source/metrics.cc"
+ "system_wrappers/source/cpu_features.cc"
+ "absl/strings/internal/memutil.cc"
+ "absl/strings/string_view.cc"
+ "absl/strings/ascii.cc"
+ "absl/types/bad_optional_access.cc"
+ "absl/types/optional.cc"
+ "absl/base/internal/raw_logging.cc"
+ "absl/base/internal/throw_delegate.cc"
+ "rtc_base/race_checker.cc"
+ "rtc_base/strings/string_builder.cc"
+ "rtc_base/memory/aligned_malloc.cc"
+ "rtc_base/timeutils.cc"
+ "rtc_base/platform_file.cc"
+ "rtc_base/string_to_number.cc"
+ "rtc_base/thread_checker_impl.cc"
+ "rtc_base/stringencode.cc"
+ "rtc_base/stringutils.cc"
+ "rtc_base/checks.cc"
+ "rtc_base/platform_thread.cc"
+ "rtc_base/criticalsection.cc"
+ "rtc_base/platform_thread_types.cc"
+ "rtc_base/event.cc"
+ "rtc_base/event_tracer.cc"
+ "rtc_base/logging_webrtc.cc"
+ "third_party/rnnoise/src/rnn_vad_weights.cc"
+ "third_party/rnnoise/src/kiss_fft.cc"
+ "api/audio/audio_frame.cc"
+ "api/audio/echo_canceller3_config.cc"
+ "api/audio/echo_canceller3_factory.cc"
+ "modules/third_party/fft/fft.c"
+ "modules/audio_coding/codecs/isac/main/source/pitch_estimator.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/pitch_gain_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/arith_routines_logist.c"
+ "modules/audio_coding/codecs/isac/main/source/filterbanks.c"
+ "modules/audio_coding/codecs/isac/main/source/transform.c"
+ "modules/audio_coding/codecs/isac/main/source/pitch_filter.c"
+ "modules/audio_coding/codecs/isac/main/source/encode_lpc_swb.c"
+ "modules/audio_coding/codecs/isac/main/source/filter_functions.c"
+ "modules/audio_coding/codecs/isac/main/source/decode.c"
+ "modules/audio_coding/codecs/isac/main/source/lattice.c"
+ "modules/audio_coding/codecs/isac/main/source/intialize.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c"
+ "modules/audio_coding/codecs/isac/main/source/encode.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_analysis.c"
+ "modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c"
+ "modules/audio_coding/codecs/isac/main/source/entropy_coding.c"
+ "modules/audio_coding/codecs/isac/main/source/isac_vad.c"
+ "modules/audio_coding/codecs/isac/main/source/arith_routines.c"
+ "modules/audio_coding/codecs/isac/main/source/crc.c"
+ "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/decode_bwe.c"
+ "modules/audio_coding/codecs/isac/main/source/spectrum_ar_model_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/pitch_lag_tables.c"
+ "modules/audio_coding/codecs/isac/main/source/isac.c"
+ "modules/audio_processing/rms_level.cc"
+ "modules/audio_processing/echo_detector/normalized_covariance_estimator.cc"
+ "modules/audio_processing/echo_detector/moving_max.cc"
+ "modules/audio_processing/echo_detector/circular_buffer.cc"
+ "modules/audio_processing/echo_detector/mean_variance_estimator.cc"
+ "modules/audio_processing/splitting_filter.cc"
+ "modules/audio_processing/gain_control_impl.cc"
+ "modules/audio_processing/ns/nsx_core.c"
+ "modules/audio_processing/ns/noise_suppression_x.c"
+ "modules/audio_processing/ns/nsx_core_c.c"
+ "modules/audio_processing/ns/ns_core.c"
+ "modules/audio_processing/ns/noise_suppression.c"
+ "modules/audio_processing/audio_buffer.cc"
+ "modules/audio_processing/typing_detection.cc"
+ "modules/audio_processing/include/audio_processing_statistics.cc"
+ "modules/audio_processing/include/audio_generator_factory.cc"
+ "modules/audio_processing/include/aec_dump.cc"
+ "modules/audio_processing/include/audio_processing.cc"
+ "modules/audio_processing/include/config.cc"
+ "modules/audio_processing/agc2/interpolated_gain_curve.cc"
+ "modules/audio_processing/agc2/agc2_common.cc"
+ "modules/audio_processing/agc2/gain_applier.cc"
+ "modules/audio_processing/agc2/adaptive_agc.cc"
+ "modules/audio_processing/agc2/adaptive_digital_gain_applier.cc"
+ "modules/audio_processing/agc2/limiter.cc"
+ "modules/audio_processing/agc2/saturation_protector.cc"
+ "modules/audio_processing/agc2/rnn_vad/spectral_features_internal.cc"
+ "modules/audio_processing/agc2/rnn_vad/rnn.cc"
+ "modules/audio_processing/agc2/rnn_vad/pitch_search_internal.cc"
+ "modules/audio_processing/agc2/rnn_vad/spectral_features.cc"
+ "modules/audio_processing/agc2/rnn_vad/pitch_search.cc"
+ "modules/audio_processing/agc2/rnn_vad/features_extraction.cc"
+ "modules/audio_processing/agc2/rnn_vad/fft_util.cc"
+ "modules/audio_processing/agc2/rnn_vad/lp_residual.cc"
+ "modules/audio_processing/agc2/adaptive_mode_level_estimator_agc.cc"
+ "modules/audio_processing/agc2/vector_float_frame.cc"
+ "modules/audio_processing/agc2/noise_level_estimator.cc"
+ "modules/audio_processing/agc2/agc2_testing_common.cc"
+ "modules/audio_processing/agc2/fixed_digital_level_estimator.cc"
+ "modules/audio_processing/agc2/fixed_gain_controller.cc"
+ "modules/audio_processing/agc2/vad_with_level.cc"
+ "modules/audio_processing/agc2/limiter_db_gain_curve.cc"
+ "modules/audio_processing/agc2/down_sampler.cc"
+ "modules/audio_processing/agc2/signal_classifier.cc"
+ "modules/audio_processing/agc2/noise_spectrum_estimator.cc"
+ "modules/audio_processing/agc2/compute_interpolated_gain_curve.cc"
+ "modules/audio_processing/agc2/biquad_filter.cc"
+ "modules/audio_processing/agc2/adaptive_mode_level_estimator.cc"
+ "modules/audio_processing/transient/moving_moments.cc"
+ "modules/audio_processing/transient/wpd_tree.cc"
+ "modules/audio_processing/transient/wpd_node.cc"
+ "modules/audio_processing/transient/transient_suppressor.cc"
+ "modules/audio_processing/transient/transient_detector.cc"
+ "modules/audio_processing/low_cut_filter.cc"
+ "modules/audio_processing/level_estimator_impl.cc"
+ "modules/audio_processing/three_band_filter_bank.cc"
+ "modules/audio_processing/aec/echo_cancellation.cc"
+ "modules/audio_processing/aec/aec_resampler.cc"
+ "modules/audio_processing/aec/aec_core.cc"
+ "modules/audio_processing/aec/aec_core_sse2.cc"
+ "modules/audio_processing/voice_detection_impl.cc"
+ "modules/audio_processing/echo_cancellation_impl.cc"
+ "modules/audio_processing/gain_control_for_experimental_agc.cc"
+ "modules/audio_processing/agc/agc.cc"
+ "modules/audio_processing/agc/loudness_histogram.cc"
+ "modules/audio_processing/agc/agc_manager_direct.cc"
+ "modules/audio_processing/agc/legacy/analog_agc.c"
+ "modules/audio_processing/agc/legacy/digital_agc.c"
+ "modules/audio_processing/agc/utility.cc"
+ "modules/audio_processing/audio_processing_impl.cc"
+ "modules/audio_processing/audio_generator/file_audio_generator.cc"
+ "modules/audio_processing/gain_controller2.cc"
+ "modules/audio_processing/residual_echo_detector.cc"
+ "modules/audio_processing/noise_suppression_impl.cc"
+ "modules/audio_processing/aecm/aecm_core.cc"
+ "modules/audio_processing/aecm/aecm_core_c.cc"
+ "modules/audio_processing/aecm/echo_control_mobile.cc"
+ "modules/audio_processing/aec3/render_reverb_model.cc"
+ "modules/audio_processing/aec3/reverb_model_fallback.cc"
+ "modules/audio_processing/aec3/echo_remover_metrics.cc"
+ "modules/audio_processing/aec3/matched_filter_lag_aggregator.cc"
+ "modules/audio_processing/aec3/render_delay_buffer2.cc"
+ "modules/audio_processing/aec3/echo_path_variability.cc"
+ "modules/audio_processing/aec3/frame_blocker.cc"
+ "modules/audio_processing/aec3/subtractor.cc"
+ "modules/audio_processing/aec3/aec3_fft.cc"
+ "modules/audio_processing/aec3/fullband_erle_estimator.cc"
+ "modules/audio_processing/aec3/suppression_filter.cc"
+ "modules/audio_processing/aec3/block_processor.cc"
+ "modules/audio_processing/aec3/subband_erle_estimator.cc"
+ "modules/audio_processing/aec3/render_delay_controller_metrics.cc"
+ "modules/audio_processing/aec3/render_delay_buffer.cc"
+ "modules/audio_processing/aec3/vector_buffer.cc"
+ "modules/audio_processing/aec3/erl_estimator.cc"
+ "modules/audio_processing/aec3/aec_state.cc"
+ "modules/audio_processing/aec3/adaptive_fir_filter.cc"
+ "modules/audio_processing/aec3/render_delay_controller.cc"
+ "modules/audio_processing/aec3/skew_estimator.cc"
+ "modules/audio_processing/aec3/echo_path_delay_estimator.cc"
+ "modules/audio_processing/aec3/block_framer.cc"
+ "modules/audio_processing/aec3/erle_estimator.cc"
+ "modules/audio_processing/aec3/reverb_model.cc"
+ "modules/audio_processing/aec3/cascaded_biquad_filter.cc"
+ "modules/audio_processing/aec3/render_buffer.cc"
+ "modules/audio_processing/aec3/subtractor_output.cc"
+ "modules/audio_processing/aec3/stationarity_estimator.cc"
+ "modules/audio_processing/aec3/render_signal_analyzer.cc"
+ "modules/audio_processing/aec3/subtractor_output_analyzer.cc"
+ "modules/audio_processing/aec3/suppression_gain.cc"
+ "modules/audio_processing/aec3/echo_audibility.cc"
+ "modules/audio_processing/aec3/block_processor_metrics.cc"
+ "modules/audio_processing/aec3/moving_average.cc"
+ "modules/audio_processing/aec3/reverb_model_estimator.cc"
+ "modules/audio_processing/aec3/aec3_common.cc"
+ "modules/audio_processing/aec3/residual_echo_estimator.cc"
+ "modules/audio_processing/aec3/matched_filter.cc"
+ "modules/audio_processing/aec3/reverb_decay_estimator.cc"
+ "modules/audio_processing/aec3/render_delay_controller2.cc"
+ "modules/audio_processing/aec3/suppression_gain_limiter.cc"
+ "modules/audio_processing/aec3/main_filter_update_gain.cc"
+ "modules/audio_processing/aec3/echo_remover.cc"
+ "modules/audio_processing/aec3/downsampled_render_buffer.cc"
+ "modules/audio_processing/aec3/matrix_buffer.cc"
+ "modules/audio_processing/aec3/block_processor2.cc"
+ "modules/audio_processing/aec3/echo_canceller3.cc"
+ "modules/audio_processing/aec3/block_delay_buffer.cc"
+ "modules/audio_processing/aec3/fft_buffer.cc"
+ "modules/audio_processing/aec3/comfort_noise_generator.cc"
+ "modules/audio_processing/aec3/shadow_filter_update_gain.cc"
+ "modules/audio_processing/aec3/filter_analyzer.cc"
+ "modules/audio_processing/aec3/reverb_frequency_response.cc"
+ "modules/audio_processing/aec3/decimator.cc"
+ "modules/audio_processing/echo_control_mobile_impl.cc"
+ "modules/audio_processing/logging/apm_data_dumper.cc"
+ "modules/audio_processing/vad/voice_activity_detector.cc"
+ "modules/audio_processing/vad/standalone_vad.cc"
+ "modules/audio_processing/vad/pitch_internal.cc"
+ "modules/audio_processing/vad/vad_circular_buffer.cc"
+ "modules/audio_processing/vad/vad_audio_proc.cc"
+ "modules/audio_processing/vad/pole_zero_filter.cc"
+ "modules/audio_processing/vad/pitch_based_vad.cc"
+ "modules/audio_processing/vad/gmm.cc"
+ "modules/audio_processing/utility/ooura_fft.cc"
+ "modules/audio_processing/utility/delay_estimator_wrapper.cc"
+ "modules/audio_processing/utility/ooura_fft_sse2.cc"
+ "modules/audio_processing/utility/delay_estimator.cc"
+ "modules/audio_processing/utility/block_mean_calculator.cc"
+ "common_audio/window_generator.cc"
+ "common_audio/channel_buffer.cc"
+ "common_audio/fir_filter_factory.cc"
+ "common_audio/wav_header.cc"
+ "common_audio/real_fourier_ooura.cc"
+ "common_audio/audio_util.cc"
+ "common_audio/fir_filter_sse.cc"
+ "common_audio/resampler/push_sinc_resampler.cc"
+ "common_audio/resampler/resampler.cc"
+ "common_audio/resampler/sinc_resampler_sse.cc"
+ "common_audio/resampler/push_resampler.cc"
+ "common_audio/resampler/sinc_resampler.cc"
+ "common_audio/resampler/sinusoidal_linear_chirp_source.cc"
+ "common_audio/wav_file.cc"
+ "common_audio/third_party/spl_sqrt_floor/spl_sqrt_floor.c"
+ "common_audio/third_party/fft4g/fft4g.c"
+ "common_audio/audio_converter.cc"
+ "common_audio/real_fourier.cc"
+ "common_audio/sparse_fir_filter.cc"
+ "common_audio/smoothing_filter.cc"
+ "common_audio/fir_filter_c.cc"
+ "common_audio/ring_buffer.c"
+ "common_audio/signal_processing/complex_fft.c"
+ "common_audio/signal_processing/filter_ma_fast_q12.c"
+ "common_audio/signal_processing/levinson_durbin.c"
+ "common_audio/signal_processing/dot_product_with_scale.cc"
+ "common_audio/signal_processing/auto_corr_to_refl_coef.c"
+ "common_audio/signal_processing/resample_by_2_internal.c"
+ "common_audio/signal_processing/energy.c"
+ "common_audio/signal_processing/sqrt_of_one_minus_x_squared.c"
+ "common_audio/signal_processing/downsample_fast.c"
+ "common_audio/signal_processing/splitting_filter1.c"
+ "common_audio/signal_processing/filter_ar_fast_q12.c"
+ "common_audio/signal_processing/spl_init.c"
+ "common_audio/signal_processing/lpc_to_refl_coef.c"
+ "common_audio/signal_processing/cross_correlation.c"
+ "common_audio/signal_processing/division_operations.c"
+ "common_audio/signal_processing/auto_correlation.c"
+ "common_audio/signal_processing/get_scaling_square.c"
+ "common_audio/signal_processing/resample.c"
+ "common_audio/signal_processing/min_max_operations.c"
+ "common_audio/signal_processing/refl_coef_to_lpc.c"
+ "common_audio/signal_processing/filter_ar.c"
+ "common_audio/signal_processing/vector_scaling_operations.c"
+ "common_audio/signal_processing/resample_fractional.c"
+ "common_audio/signal_processing/real_fft.c"
+ "common_audio/signal_processing/ilbc_specific_functions.c"
+ "common_audio/signal_processing/complex_bit_reverse.c"
+ "common_audio/signal_processing/randomization_functions.c"
+ "common_audio/signal_processing/copy_set_operations.c"
+ "common_audio/signal_processing/resample_by_2.c"
+ "common_audio/signal_processing/get_hanning_window.c"
+ "common_audio/signal_processing/resample_48khz.c"
+ "common_audio/signal_processing/spl_inl.c"
+ "common_audio/signal_processing/spl_sqrt.c"
+ "common_audio/vad/vad_sp.c"
+ "common_audio/vad/vad.cc"
+ "common_audio/vad/webrtc_vad.c"
+ "common_audio/vad/vad_filterbank.c"
+ "common_audio/vad/vad_core.c"
+ "common_audio/vad/vad_gmm.c"
+)
+
+add_library(${PROJECT_NAME} OBJECT ${WEBRTC_C_SOURCE_FILES} ${WEBRTC_CXX_SOURCE_FILES})
+
+target_compile_definitions(${PROJECT_NAME} PUBLIC
+ WEBRTC_APM_DEBUG_DUMP=0
+ WEBRTC_POSIX
+ WEBRTC_LINUX
+ WEBRTC_NS_FLOAT
+)
+
+# TODO: drop include dirs with latest webrtc
+target_include_directories(${PROJECT_NAME} PUBLIC
+ "${CMAKE_CURRENT_LIST_DIR}/.."
+)
+
+if( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" )
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
+endif( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686" )
+
+
diff --git a/testing/telegram-desktop/ThirdParty-libtgvoip.cmake b/testing/telegram-desktop/ThirdParty-libtgvoip.cmake
new file mode 100644
index 0000000000..1b006d0dee
--- /dev/null
+++ b/testing/telegram-desktop/ThirdParty-libtgvoip.cmake
@@ -0,0 +1,38 @@
+project(tgvoip)
+
+option(ENABLE_PULSEAUDIO "Enable pulseaudio" OFF)
+
+add_subdirectory("${PROJECT_SOURCE_DIR}/webrtc_dsp")
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(OPUS REQUIRED opus)
+
+file(GLOB TGVOIP_SOURCE_FILES
+ *.cpp
+ audio/*.cpp
+ os/linux/*.cpp
+ os/posix/*.cpp
+ video/*.cpp
+)
+set(TGVOIP_COMPILE_DEFINITIONS TGVOIP_USE_DESKTOP_DSP WEBRTC_NS_FLOAT WEBRTC_POSIX WEBRTC_LINUX)
+
+if(ENABLE_PULSEAUDIO)
+ pkg_check_modules(LIBPULSE REQUIRED libpulse)
+else()
+ file(GLOB PULSEAUDIO_SOURCE_FILES
+ os/linux/*Pulse.cpp
+ os/linux/*Pulse.h
+ )
+ list(REMOVE_ITEM TGVOIP_SOURCE_FILES ${PULSEAUDIO_SOURCE_FILES})
+ list(APPEND TGVOIP_COMPILE_DEFINITIONS WITHOUT_PULSE)
+endif()
+
+add_library(${PROJECT_NAME} STATIC ${TGVOIP_SOURCE_FILES} $<TARGET_OBJECTS:webrtc>)
+
+target_compile_definitions(${PROJECT_NAME} PUBLIC ${TGVOIP_COMPILE_DEFINITIONS})
+target_include_directories(${PROJECT_NAME} PUBLIC
+ "${OPUS_INCLUDE_DIRS}"
+ "${CMAKE_CURRENT_LIST_DIR}/webrtc_dsp"
+)
+target_link_libraries(${PROJECT_NAME} dl ${OPUS_LIBRARIES})
+
diff --git a/testing/telegram-desktop/add-private-qt-functions.patch b/testing/telegram-desktop/add-private-qt-functions.patch
new file mode 100644
index 0000000000..54b678a901
--- /dev/null
+++ b/testing/telegram-desktop/add-private-qt-functions.patch
@@ -0,0 +1,101 @@
+diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp
+new file mode 100644
+index 0000000..4a722b8
+--- /dev/null
++++ b/Telegram/SourceFiles/qt_functions.cpp
+@@ -0,0 +1,94 @@
++/****************************************************************************
++**
++** Copyright (C) 2015 The Qt Company Ltd.
++** Contact: http://www.qt.io/licensing/
++**
++** This file contains some parts of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:LGPL21$
++** Commercial License Usage
++** Licensees holding valid commercial Qt licenses may use this file in
++** accordance with the commercial license agreement provided with the
++** Software or, alternatively, in accordance with the terms contained in
++** a written agreement between you and The Qt Company. For licensing terms
++** and conditions see http://www.qt.io/terms-conditions. For further
++** information use the contact form at http://www.qt.io/contact-us.
++**
++** GNU Lesser General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU Lesser
++** General Public License version 2.1 or version 3 as published by the Free
++** Software Foundation and appearing in the file LICENSE.LGPLv21 and
++** LICENSE.LGPLv3 included in the packaging of this file. Please review the
++** following information to ensure the GNU Lesser General Public License
++** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
++** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
++**
++** As a special exception, The Qt Company gives you certain additional
++** rights. These rights are described in The Qt Company LGPL Exception
++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++
++/* TODO: find a dynamic library with these symbols. */
++
++/* Debian maintainer: this function is taken from qfiledialog.cpp */
++/*
++ Makes a list of filters from ;;-separated text.
++ Used by the mac and windows implementations
++*/
++QStringList qt_make_filter_list(const QString &filter)
++{
++ QString f(filter);
++
++ if (f.isEmpty())
++ return QStringList();
++
++ QString sep(QLatin1String(";;"));
++ int i = f.indexOf(sep, 0);
++ if (i == -1) {
++ if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
++ sep = QLatin1Char('\n');
++ i = f.indexOf(sep, 0);
++ }
++ }
++
++ return f.split(sep);
++}
++
++/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */
++QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
++ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
++ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe)
++{
++}
++
++/* Debian maintainer: this method is also taken from qtextengine.cpp */
++// Fix up flags and underlineStyle with given info
++void QTextItemInt::initWithScriptItem(const QScriptItem &si)
++{
++ // explicitly initialize flags so that initFontAttributes can be called
++ // multiple times on the same TextItem
++ flags = 0;
++ if (si.analysis.bidiLevel %2)
++ flags |= QTextItem::RightToLeft;
++ ascent = si.ascent;
++ descent = si.descent;
++
++ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
++ underlineStyle = charFormat.underlineStyle();
++ } else if (charFormat.boolProperty(QTextFormat::FontUnderline)
++ || f->d->underline) {
++ underlineStyle = QTextCharFormat::SingleUnderline;
++ }
++
++ // compat
++ if (underlineStyle == QTextCharFormat::SingleUnderline)
++ flags |= QTextItem::Underline;
++
++ if (f->d->overline || charFormat.fontOverline())
++ flags |= QTextItem::Overline;
++ if (f->d->strikeOut || charFormat.fontStrikeOut())
++ flags |= QTextItem::StrikeOut;
++}
+
diff --git a/testing/telegram-desktop/dynamic-linking-qt5.patch b/testing/telegram-desktop/dynamic-linking-qt5.patch
new file mode 100644
index 0000000000..ed07f036a2
--- /dev/null
+++ b/testing/telegram-desktop/dynamic-linking-qt5.patch
@@ -0,0 +1,47 @@
+From 6645b23021d169c8d3fc0f4522e1725571ace288 Mon Sep 17 00:00:00 2001
+From: John Zimmermann <johnz@posteo.net>
+Date: Wed, 26 Sep 2018 20:36:13 +0200
+Subject: [PATCH 2/7] Fix a few bugs that are caused by dynamic linking to qt5.
+
+---
+ Telegram/SourceFiles/core/launcher.cpp | 8 ++++++++
+ Telegram/SourceFiles/qt_static_plugins.cpp | 9 ---------
+ 2 files changed, 8 insertions(+), 9 deletions(-)
+
+diff --git Telegram/SourceFiles/core/launcher.cpp Telegram/SourceFiles/core/launcher.cpp
+index d4bdadc17..bf9066274 100644
+--- a/Telegram/SourceFiles/core/launcher.cpp
++++ b/Telegram/SourceFiles/core/launcher.cpp
+@@ -59,6 +59,14 @@ int Launcher::exec() {
+ Logs::start(this); // must be started before Platform is started
+ Platform::start(); // must be started before QApplication is created
+
++
++ // I don't know why path is not in QT_PLUGIN_PATH by default
++ QCoreApplication::addLibraryPath("/usr/lib/qt/plugins");
++ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors
++ setenv("QT_STYLE_OVERRIDE", "qwerty", false);
++ // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943
++ unsetenv("QT_QPA_PLATFORMTHEME");
++
+ auto result = executeApplication();
+
+ DEBUG_LOG(("Telegram finished, result: %1").arg(result));
+diff --git Telegram/SourceFiles/qt_static_plugins.cpp Telegram/SourceFiles/qt_static_plugins.cpp
+index e29f348c8..122ff0f5d 100644
+--- a/Telegram/SourceFiles/qt_static_plugins.cpp 2018-12-10 16:37:52.000000000 +0100
++++ b/Telegram/SourceFiles/qt_static_plugins.cpp 2018-12-10 16:37:52.000000000 +0100
+@@ -14,7 +14,7 @@
+ Q_IMPORT_PLUGIN(QWebpPlugin)
+ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
+ Q_IMPORT_PLUGIN(QGenericEnginePlugin)
+-#elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC
++#elif 0 // Q_OS_WIN | Q_OS_MAC
+ Q_IMPORT_PLUGIN(QWebpPlugin)
+ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
+ Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
+--
+2.19.0
+
+
+
diff --git a/testing/telegram-desktop/fix-missing-use-of-pch.patch b/testing/telegram-desktop/fix-missing-use-of-pch.patch
new file mode 100644
index 0000000000..ec297a06c4
--- /dev/null
+++ b/testing/telegram-desktop/fix-missing-use-of-pch.patch
@@ -0,0 +1,11 @@
+--- a/Telegram/SourceFiles/storage/cache/storage_cache_database_object.cpp
++++ b/Telegram/SourceFiles/storage/cache/storage_cache_database_object.cpp
+@@ -14,6 +14,7 @@
+ #include "storage/storage_encrypted_file.h"
+ #include "base/flat_map.h"
+ #include "base/algorithm.h"
++#include "base/openssl_help.h"
+ #include <crl/crl.h>
+ #include <xxhash.h>
+ #include <QtCore/QDir>
+
diff --git a/testing/telegram-desktop/libtgvoip.patch b/testing/telegram-desktop/libtgvoip.patch
deleted file mode 100644
index b41166198d..0000000000
--- a/testing/telegram-desktop/libtgvoip.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
-+++ b/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
-@@ -14,11 +14,12 @@
- 'variables': {
- 'tgvoip_src_loc': '.',
- 'official_build_target%': '',
-- 'linux_path_opus_include%': '<(DEPTH)/../../../Libraries/opus/include',
-+ 'linux_path_opus_include%': '/usr/include/opus',
- },
- 'include_dirs': [
- '<(tgvoip_src_loc)/webrtc_dsp',
- '<(linux_path_opus_include)',
-+ '/usr/include/openssl',
- ],
- 'direct_dependent_settings': {
- 'include_dirs': [
diff --git a/testing/telegram-desktop/no-pulse.patch b/testing/telegram-desktop/no-pulse.patch
index 39c965490f..fe0f71f0e8 100644
--- a/testing/telegram-desktop/no-pulse.patch
+++ b/testing/telegram-desktop/no-pulse.patch
@@ -9,26 +9,3 @@
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
---- a/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
-+++ b/Telegram/ThirdParty/libtgvoip/libtgvoip.gyp
-@@ -10,6 +10,7 @@
- 'WEBRTC_APM_DEBUG_DUMP=0',
- 'TGVOIP_USE_DESKTOP_DSP',
- 'WEBRTC_NS_FLOAT',
-+ 'WITHOUT_PULSE',
- ],
- 'variables': {
- 'tgvoip_src_loc': '.',
-@@ -105,12 +106,6 @@
- '<(tgvoip_src_loc)/os/linux/AudioInputALSA.h',
- '<(tgvoip_src_loc)/os/linux/AudioOutputALSA.cpp',
- '<(tgvoip_src_loc)/os/linux/AudioOutputALSA.h',
-- '<(tgvoip_src_loc)/os/linux/AudioOutputPulse.cpp',
-- '<(tgvoip_src_loc)/os/linux/AudioOutputPulse.h',
-- '<(tgvoip_src_loc)/os/linux/AudioInputPulse.cpp',
-- '<(tgvoip_src_loc)/os/linux/AudioInputPulse.h',
-- '<(tgvoip_src_loc)/os/linux/AudioPulse.cpp',
-- '<(tgvoip_src_loc)/os/linux/AudioPulse.h',
-
- # POSIX
- '<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.cpp',
diff --git a/testing/telegram-desktop/tdesktop.patch b/testing/telegram-desktop/tdesktop.patch
deleted file mode 100644
index 2cb7f18f16..0000000000
--- a/testing/telegram-desktop/tdesktop.patch
+++ /dev/null
@@ -1,585 +0,0 @@
---- a/Telegram/Resources/qrc/telegram_linux.qrc
-+++ b/Telegram/Resources/qrc/telegram_linux.qrc
-@@ -1,6 +1,5 @@
- <RCC>
- <qresource prefix="/qt">
-- <file alias="etc/qt.conf">../etc/qt_linux.conf</file>
- </qresource>
- <qresource prefix="/fc">
- <file alias="fc-custom.conf">../fc-custom.conf</file>
---- a/Telegram/SourceFiles/core/launcher.cpp
-+++ b/Telegram/SourceFiles/core/launcher.cpp
-@@ -39,9 +39,10 @@ void Launcher::init() {
-
- QApplication::setApplicationName(qsl("TelegramDesktop"));
-
--#ifndef OS_MAC_OLD
-+#if !defined(Q_OS_MAC) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
-+ // Retina display support is working fine, others are not.
- QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
--#endif // OS_MAC_OLD
-+#endif // not defined Q_OS_MAC and QT_VERSION >= 5.6.0
-
- initHook();
- }
-@@ -59,6 +60,13 @@ int Launcher::exec() {
- Logs::start(this); // must be started before Platform is started
- Platform::start(); // must be started before Sandbox is created
-
-+ // I don't know why path is not in QT_PLUGIN_PATH by default
-+ QCoreApplication::addLibraryPath("/usr/lib/qt5/plugins");
-+ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors
-+ setenv("QT_STYLE_OVERRIDE", "qwerty", false);
-+ // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943
-+ unsetenv("QT_QPA_PLATFORMTHEME");
-+
- auto result = executeApplication();
-
- DEBUG_LOG(("Telegram finished, result: %1").arg(result));
---- /dev/null
-+++ b/Telegram/SourceFiles/qt_functions.cpp
-@@ -0,0 +1,94 @@
-+/****************************************************************************
-+**
-+** Copyright (C) 2015 The Qt Company Ltd.
-+** Contact: http://www.qt.io/licensing/
-+**
-+** This file contains some parts of the Qt Toolkit.
-+**
-+** $QT_BEGIN_LICENSE:LGPL21$
-+** Commercial License Usage
-+** Licensees holding valid commercial Qt licenses may use this file in
-+** accordance with the commercial license agreement provided with the
-+** Software or, alternatively, in accordance with the terms contained in
-+** a written agreement between you and The Qt Company. For licensing terms
-+** and conditions see http://www.qt.io/terms-conditions. For further
-+** information use the contact form at http://www.qt.io/contact-us.
-+**
-+** GNU Lesser General Public License Usage
-+** Alternatively, this file may be used under the terms of the GNU Lesser
-+** General Public License version 2.1 or version 3 as published by the Free
-+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-+** following information to ensure the GNU Lesser General Public License
-+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-+**
-+** As a special exception, The Qt Company gives you certain additional
-+** rights. These rights are described in The Qt Company LGPL Exception
-+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-+**
-+** $QT_END_LICENSE$
-+**
-+****************************************************************************/
-+
-+/* TODO: find a dynamic library with these symbols. */
-+
-+/* Debian maintainer: this function is taken from qfiledialog.cpp */
-+/*
-+ Makes a list of filters from ;;-separated text.
-+ Used by the mac and windows implementations
-+*/
-+QStringList qt_make_filter_list(const QString &filter)
-+{
-+ QString f(filter);
-+
-+ if (f.isEmpty())
-+ return QStringList();
-+
-+ QString sep(QLatin1String(";;"));
-+ int i = f.indexOf(sep, 0);
-+ if (i == -1) {
-+ if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
-+ sep = QLatin1Char('\n');
-+ i = f.indexOf(sep, 0);
-+ }
-+ }
-+
-+ return f.split(sep);
-+}
-+
-+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */
-+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format)
-+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format),
-+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe)
-+{
-+}
-+
-+/* Debian maintainer: this method is also taken from qtextengine.cpp */
-+// Fix up flags and underlineStyle with given info
-+void QTextItemInt::initWithScriptItem(const QScriptItem &si)
-+{
-+ // explicitly initialize flags so that initFontAttributes can be called
-+ // multiple times on the same TextItem
-+ flags = 0;
-+ if (si.analysis.bidiLevel %2)
-+ flags |= QTextItem::RightToLeft;
-+ ascent = si.ascent;
-+ descent = si.descent;
-+
-+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) {
-+ underlineStyle = charFormat.underlineStyle();
-+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline)
-+ || f->d->underline) {
-+ underlineStyle = QTextCharFormat::SingleUnderline;
-+ }
-+
-+ // compat
-+ if (underlineStyle == QTextCharFormat::SingleUnderline)
-+ flags |= QTextItem::Underline;
-+
-+ if (f->d->overline || charFormat.fontOverline())
-+ flags |= QTextItem::Overline;
-+ if (f->d->strikeOut || charFormat.fontStrikeOut())
-+ flags |= QTextItem::StrikeOut;
-+}
---- a/Telegram/SourceFiles/qt_static_plugins.cpp
-+++ b/Telegram/SourceFiles/qt_static_plugins.cpp
-@@ -15,14 +15,4 @@ Q_IMPORT_PLUGIN(QWebpPlugin)
- Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
- Q_IMPORT_PLUGIN(QGenericEnginePlugin)
- #elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC
--Q_IMPORT_PLUGIN(QWebpPlugin)
--Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
--Q_IMPORT_PLUGIN(QConnmanEnginePlugin)
--Q_IMPORT_PLUGIN(QGenericEnginePlugin)
--Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin)
--Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
--Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
--Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)
--Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin)
--Q_IMPORT_PLUGIN(NimfInputContextPlugin)
- #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX
---- a/Telegram/SourceFiles/ui/text/text.cpp
-+++ b/Telegram/SourceFiles/ui/text/text.cpp
-@@ -1760,11 +1760,11 @@ private:
- if (item == -1)
- return;
-
--#ifdef OS_MAC_OLD
-+#if defined(OS_MAC_OLD) || QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
- auto end = _e->findItem(line.from + line.length - 1);
--#else // OS_MAC_OLD
-+#else
- auto end = _e->findItem(line.from + line.length - 1, item);
--#endif // OS_MAC_OLD
-+#endif
-
- auto blockIndex = _lineStartBlock;
- auto currentBlock = _t->_blocks[blockIndex].get();
---- a/Telegram/SourceFiles/ui/text/text_block.cpp
-+++ b/Telegram/SourceFiles/ui/text/text_block.cpp
-@@ -332,6 +332,9 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi
-
- QStackTextEngine engine(part, blockFont->f);
- BlockParser parser(&engine, this, minResizeWidth, _from, part);
-+ QTextLayout layout(part, blockFont->f);
-+ layout.beginLayout();
-+ layout.createLine();
-
- CrashReports::ClearAnnotationRef("CrashString");
- }
---- a/Telegram/SourceFiles/ui/twidget.cpp
-+++ b/Telegram/SourceFiles/ui/twidget.cpp
-@@ -250,9 +250,9 @@ void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton
- , button
- , QGuiApplication::mouseButtons() | button
- , QGuiApplication::keyboardModifiers()
--#ifndef OS_MAC_OLD
-+#if !defined(OS_MAC_OLD) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
- , Qt::MouseEventSynthesizedByApplication
--#endif // OS_MAC_OLD
-+#endif
- );
- ev.setTimestamp(crl::now());
- QGuiApplication::sendEvent(windowHandle, &ev);
---- a/Telegram/gyp/PrecompiledHeader.cmake
-+++ b/Telegram/gyp/PrecompiledHeader.cmake
-@@ -114,7 +114,7 @@ function(add_precompiled_header _target _input)
- set(_compiler_FLAGS "@${_pch_c_flags_file}")
- add_custom_command(
- OUTPUT "${_output_c}"
-- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}"
-+ COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}"
- DEPENDS "${_pchfile}" "${_pch_c_flags_file}"
- IMPLICIT_DEPENDS C "${_pch_header}"
- COMMENT "Precompiling ${_name} for ${_target} (C)")
-@@ -125,7 +125,7 @@ function(add_precompiled_header _target _input)
- set(_compiler_FLAGS "@${_pch_cpp_flags_file}")
- add_custom_command(
- OUTPUT "${_output_cxx}"
-- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
-+ COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}"
- DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}"
- IMPLICIT_DEPENDS CXX "${_pch_header}"
- COMMENT "Precompiling header ${_name} for ${_target} (C++)")
---- a/Telegram/gyp/Telegram.gyp
-+++ b/Telegram/gyp/Telegram.gyp
-@@ -12,7 +12,7 @@
- 'target_name': 'Telegram',
- 'variables': {
- 'variables': {
-- 'libs_loc': '../../../Libraries',
-+ 'libs_loc': '../../Libraries',
- },
- 'libs_loc': '<(libs_loc)',
- 'src_loc': '../SourceFiles',
-@@ -75,7 +75,6 @@
- 'codegen.gyp:codegen_numbers',
- 'codegen.gyp:codegen_style',
- 'tests/tests.gyp:tests',
-- 'utils.gyp:Updater',
- '../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip',
- 'crl.gyp:crl',
- 'lib_base.gyp:lib_base',
-@@ -84,7 +83,6 @@
- ],
-
- 'defines': [
-- 'AL_LIBTYPE_STATIC',
- 'AL_ALEXT_PROTOTYPES',
- 'TGVOIP_USE_CXX11_LIB',
- 'XXH_INLINE_ALL',
-@@ -96,16 +94,9 @@
- 'include_dirs': [
- '<(src_loc)',
- '<(SHARED_INTERMEDIATE_DIR)',
-- '<(libs_loc)/breakpad/src',
-- '<(libs_loc)/lzma/C',
-- '<(libs_loc)/zlib',
-- '<(libs_loc)/ffmpeg',
-- '<(libs_loc)/openal-soft/include',
-- '<(libs_loc)/opus/include',
- '<(libs_loc)/range-v3/include',
-- '<(minizip_loc)',
-- '<(sp_media_key_tap_loc)',
- '<(emoji_suggestions_loc)',
-+ '/usr/include/minizip',
- '<(submodules_loc)/GSL/include',
- '<(submodules_loc)/variant/include',
- '<(submodules_loc)/crl/src',
---- a/Telegram/gyp/lib_base.gyp
-+++ b/Telegram/gyp/lib_base.gyp
-@@ -23,7 +23,7 @@
- 'variables': {
- 'src_loc': '../SourceFiles',
- 'res_loc': '../Resources',
-- 'libs_loc': '../../../Libraries',
-+ 'libs_loc': '../../Libraries',
- 'official_build_target%': '',
- 'submodules_loc': '../ThirdParty',
- 'pch_source': '<(src_loc)/base/base_pch.cpp',
---- a/Telegram/gyp/lib_export.gyp
-+++ b/Telegram/gyp/lib_export.gyp
-@@ -22,7 +22,7 @@
- 'variables': {
- 'src_loc': '../SourceFiles',
- 'res_loc': '../Resources',
-- 'libs_loc': '../../../Libraries',
-+ 'libs_loc': '../../Libraries',
- 'official_build_target%': '',
- 'submodules_loc': '../ThirdParty',
- 'pch_source': '<(src_loc)/export/export_pch.cpp',
---- a/Telegram/gyp/lib_storage.gyp
-+++ b/Telegram/gyp/lib_storage.gyp
-@@ -23,7 +23,7 @@
- 'variables': {
- 'src_loc': '../SourceFiles',
- 'res_loc': '../Resources',
-- 'libs_loc': '../../../Libraries',
-+ 'libs_loc': '../../Libraries',
- 'official_build_target%': '',
- 'submodules_loc': '../ThirdParty',
- 'pch_source': '<(src_loc)/storage/storage_pch.cpp',
---- a/Telegram/gyp/qt.gypi
-+++ b/Telegram/gyp/qt.gypi
-@@ -14,25 +14,21 @@
- [ 'build_macold', {
- 'qt_version%': '5.3.2',
- }, {
-- 'qt_version%': '5.6.2',
-+ 'qt_version%': '<!(echo /usr/include/QtCore/*/ | grep -Po "\d+\.\d+\.\d+")',
- }]
- ],
- },
- 'qt_libs': [
-- 'qwebp',
-- 'Qt5PrintSupport',
-- 'Qt5PlatformSupport',
- 'Qt5Network',
- 'Qt5Widgets',
- 'Qt5Gui',
-- 'qtharfbuzzng',
- ],
- 'qt_version%': '<(qt_version)',
- 'conditions': [
- [ 'build_macold', {
- 'linux_path_qt%': '/usr/local/macold/Qt-<(qt_version)',
- }, {
-- 'linux_path_qt%': '/usr/local/tdesktop/Qt-<(qt_version)',
-+ 'linux_path_qt%': '/usr/lib/qt5',
- }]
- ]
- },
-@@ -72,32 +68,13 @@
- ],
- }],
- [ 'build_linux', {
-- 'qt_lib_prefix': 'lib',
-- 'qt_lib_debug_postfix': '.a',
-- 'qt_lib_release_postfix': '.a',
-+ 'qt_lib_prefix': '',
-+ 'qt_lib_debug_postfix': '',
-+ 'qt_lib_release_postfix': '',
- 'qt_libs': [
-- 'qxcb',
-- 'Qt5XcbQpa',
-- 'qconnmanbearer',
-- 'qgenericbearer',
-- 'qnmbearer',
- '<@(qt_libs)',
- 'Qt5DBus',
- 'Qt5Core',
-- 'qtpcre',
-- 'Xi',
-- 'Xext',
-- 'Xfixes',
-- 'SM',
-- 'ICE',
-- 'fontconfig',
-- 'expat',
-- 'freetype',
-- 'z',
-- 'xcb-shm',
-- 'xcb-xfixes',
-- 'xcb-render',
-- 'xcb-static',
- ],
- }],
- ],
-@@ -127,11 +104,6 @@
- # '<!@(python <(DEPTH)/list_sources.py [sources] <(qt_moc_list_sources_arg))'
- # where [sources] contains all your source files
- 'qt_moc_list_sources_arg': '--moc-prefix SHARED_INTERMEDIATE_DIR/<(_target_name)/moc/moc_',
--
-- 'linux_path_xkbcommon%': '/usr/local',
-- 'linux_lib_ssl%': '/usr/local/ssl/lib/libssl.a',
-- 'linux_lib_crypto%': '/usr/local/ssl/lib/libcrypto.a',
-- 'linux_lib_icu%': 'libicutu.a libicui18n.a libicuuc.a libicudata.a',
- },
-
- 'configurations': {
-@@ -180,14 +152,14 @@
- },
-
- 'include_dirs': [
-- '<(qt_loc)/include',
-- '<(qt_loc)/include/QtCore',
-- '<(qt_loc)/include/QtGui',
-- '<(qt_loc)/include/QtDBus',
-- '<(qt_loc)/include/QtCore/<(qt_version)',
-- '<(qt_loc)/include/QtGui/<(qt_version)',
-- '<(qt_loc)/include/QtCore/<(qt_version)/QtCore',
-- '<(qt_loc)/include/QtGui/<(qt_version)/QtGui',
-+ '/usr/include',
-+ '/usr/include/QtCore',
-+ '/usr/include/QtGui',
-+ '/usr/include/QtDBus',
-+ '/usr/include/QtCore/<(qt_version)',
-+ '/usr/include/QtGui/<(qt_version)',
-+ '/usr/include/QtCore/<(qt_version)/QtCore',
-+ '/usr/include/QtGui/<(qt_version)/QtGui',
- ],
- 'library_dirs': [
- '<(qt_loc)/lib',
-@@ -204,25 +176,14 @@
- ],
- 'conditions': [
- [ 'build_linux', {
-- 'dependencies': [
-- '<(DEPTH)/linux_glibc_wraps.gyp:linux_glibc_wraps',
-- ],
- 'library_dirs': [
- '<(qt_loc)/plugins/platforminputcontexts',
- ],
- 'libraries': [
-- '<(PRODUCT_DIR)/obj.target/liblinux_glibc_wraps.a',
-- '<(linux_path_xkbcommon)/lib/libxkbcommon.a',
- '<@(qt_libs_release)',
-- '<(linux_lib_ssl)',
-- '<(linux_lib_crypto)',
-- '<!@(python -c "for s in \'<(linux_lib_icu)\'.split(\' \'): print(s)")',
-- '-lxcb',
-+ '-lcrypto',
- '-lX11',
-- '-lX11-xcb',
-- '-ldbus-1',
- '-ldl',
-- '-lgthread-2.0',
- '-lglib-2.0',
- '-lpthread',
- ],
-@@ -230,7 +191,6 @@
- '<(qt_loc)/mkspecs/linux-g++',
- ],
- 'ldflags': [
-- '-static-libstdc++',
- '-pthread',
- '-rdynamic',
- ],
---- a/Telegram/gyp/settings_linux.gypi
-+++ b/Telegram/gyp/settings_linux.gypi
-@@ -11,7 +11,6 @@
- 'linux_common_flags': [
- '-pipe',
- '-Wall',
-- '-Werror',
- '-W',
- '-fPIC',
- '-Wno-unused-variable',
-@@ -60,7 +59,6 @@
- ],
- 'defines': [
- '_REENTRANT',
-- 'QT_STATICPLUGIN',
- 'QT_PLUGIN',
- ],
- 'cflags_c': [
---- a/Telegram/gyp/telegram_linux.gypi
-+++ b/Telegram/gyp/telegram_linux.gypi
-@@ -23,18 +23,20 @@
- 'linux_path_va%': '/usr/local',
- 'linux_path_vdpau%': '/usr/local',
- 'linux_path_breakpad%': '/usr/local',
-- 'linux_path_opus_include%': '<(libs_loc)/opus/include',
-+ 'linux_path_opus_include%': '/usr/include/opus',
- 'linux_path_range%': '/usr/local',
- },
- 'include_dirs': [
-+ '/usr/include/openssl',
- '/usr/local/include',
- '<(linux_path_ffmpeg)/include',
- '<(linux_path_openal)/include',
- '<(linux_path_breakpad)/include/breakpad',
- '<(linux_path_opus_include)',
-- '<(linux_path_range)/include',
-+ '<(libs_loc)/range-v3/include',
- ],
- 'library_dirs': [
-+ '/usr/lib/openssl',
- '/usr/local/lib',
- '<(linux_path_ffmpeg)/lib',
- '<(linux_path_openal)/lib',
-@@ -43,26 +45,16 @@
- '<(linux_path_breakpad)/lib',
- ],
- 'libraries': [
-- 'breakpad_client',
-- 'composeplatforminputcontextplugin',
-- 'ibusplatforminputcontextplugin',
-- 'fcitxplatforminputcontextplugin',
-- 'himeplatforminputcontextplugin',
-- 'nimfplatforminputcontextplugin',
-- 'liblzma.a',
-- 'libopenal.a',
-- 'libavformat.a',
-- 'libavcodec.a',
-- 'libswresample.a',
-- 'libswscale.a',
-- 'libavutil.a',
-- 'libopus.a',
-- 'libva-x11.a',
-- 'libva-drm.a',
-- 'libva.a',
-- 'libvdpau.a',
-- 'libdrm.a',
-- 'libz.a',
-+ 'openal',
-+ 'avformat',
-+ 'avcodec',
-+ 'swresample',
-+ 'swscale',
-+ 'avutil',
-+ 'minizip',
-+ 'opus',
-+ 'z',
-+ 'lzma',
- # '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
- ],
- 'cflags_cc': [
-@@ -70,9 +62,6 @@
- '-Wno-maybe-uninitialized',
- ],
- 'ldflags': [
-- '-Wl,-wrap,aligned_alloc',
-- '-Wl,-wrap,secure_getenv',
-- '-Wl,-wrap,clock_gettime',
- '-Wl,--no-as-needed,-lrt',
- ],
- 'configurations': {
-@@ -92,14 +81,10 @@
- },
- 'conditions': [
- [ '"<!(uname -p)" != "x86_64"', {
-- 'ldflags': [
-- '-Wl,-wrap,__divmoddi4',
-- ],
- }], ['not_need_gtk!="True"', {
- 'cflags_cc': [
-- '<!(pkg-config 2> /dev/null --cflags gtk+-2.0)',
-- '<!(pkg-config 2> /dev/null --cflags glib-2.0)',
-- '<!(pkg-config 2> /dev/null --cflags dee-1.0)',
-+ '<!(pkg-config 2> /dev/null --cflags appindicator3-0.1)',
-+ '<!(pkg-config 2> /dev/null --cflags gtk+-3.0)',
- ],
- }], ['<!(pkg-config ayatana-appindicator3-0.1; echo $?) == 0', {
- 'cflags_cc': [ '<!(pkg-config --cflags ayatana-appindicator3-0.1)' ],
---- a/Telegram/gyp/telegram_sources.txt
-+++ b/Telegram/gyp/telegram_sources.txt
-@@ -805,14 +805,7 @@
- <(emoji_suggestions_loc)/emoji_suggestions.cpp
- <(emoji_suggestions_loc)/emoji_suggestions.h
-
--platforms: !win
--<(minizip_loc)/crypt.h
--<(minizip_loc)/ioapi.c
--<(minizip_loc)/ioapi.h
--<(minizip_loc)/zip.c
--<(minizip_loc)/zip.h
--<(minizip_loc)/unzip.c
--<(minizip_loc)/unzip.h
-+<(src_loc)/qt_functions.cpp
-
- platforms: win
- <(res_loc)/winrc/Telegram.rc
---- a/Telegram/gyp/tests/tests.gyp
-+++ b/Telegram/gyp/tests/tests.gyp
-@@ -9,7 +9,7 @@
- '../common.gypi',
- ],
- 'variables': {
-- 'libs_loc': '../../../../Libraries',
-+ 'libs_loc': '../../../Libraries',
- 'src_loc': '../../SourceFiles',
- 'submodules_loc': '../../ThirdParty',
- 'mac_target': '10.10',
---- a/Telegram/gyp/utils.gyp
-+++ b/Telegram/gyp/utils.gyp
-@@ -11,7 +11,7 @@
- 'targets': [{
- 'target_name': 'Updater',
- 'variables': {
-- 'libs_loc': '../../../Libraries',
-+ 'libs_loc': '../../Libraries',
- 'src_loc': '../SourceFiles',
- 'res_loc': '../Resources',
- },
-@@ -57,7 +57,7 @@
- }, {
- 'target_name': 'Packer',
- 'variables': {
-- 'libs_loc': '../../../Libraries',
-+ 'libs_loc': '../../Libraries',
- 'src_loc': '../SourceFiles',
- 'mac_target': '10.10',
- },