Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2380|回复: 9
打印 上一主题 下一主题

Telegram Desktop V2.0.1版编译

[复制链接]

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
跳转到指定楼层
楼主
发表于 2020-4-13 10:33:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Qter 于 2020-4-14 15:30 编辑

https://github.com/hechengjin/tdesktop

git clone https://github.com/hechengjin/tdesktop.git

cd tdesktop/
查询v2.几以后的tag
git tag -l "v2.*"
没有返回,但实际官方已经tag到v2.0.1

git remote -v
origin  https://github.com/hechengjin/tdesktop.git (fetch)
origin  https://github.com/hechengjin/tdesktop.git (push)
发现只有origin的fetch和push只有自己的地址,当fork一个项目时,可以指定源地址让你的项目保持同步。
git remote add upstream https://github.com/telegramdesktop/tdesktop.git
git remote -v
发现多了upstream的fetch和push
upstream        https://github.com/telegramdesktop/tdesktop.git (fetch)
upstream        https://github.com/telegramdesktop/tdesktop.git (push)
git fetch upstream
后就可以实现真正的同步更新了。
git tag -l "v2.*"
后发现最新的tag也一起下来了。
git push --tags  #将新的tag推送到fork项目
checkout到指定tag的代码
先在本地建立一个与tag对应的分支
然后将tag的pull下来就可以了
git checkout -b v2.0.1 v2.0.1
git pull upstream v2.0.1
  1. git checkout dev
  2. git push origin v2.0.1:v2.0.1  出现错误 error: src refspec v2.0.1 matches more than one
  3. git tag -d v2.0.1  ---执行这步 解决上面错误
  4. git push origin v2.0.1:v2.0.1 完成
  5. ----但上面四步操作,并没有在fork库上创建新的v2.0.1分支
复制代码
直接在v2.0.1分支下执行下面命令创建新分支在远程库上
git push origin HEAD:refs/heads/v2.0.1



上面步骤已经完成,故v2.0.1分支已经存在 直接切换到v2.0.1分支即可。


回复

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
沙发
 楼主| 发表于 2020-4-19 13:59:20 | 只看该作者
本帖最后由 Qter 于 2020-4-19 14:21 编辑

git clone https://github.com/hechengjin/tdesktop_TBuild.git

开始菜单 Visual Studio 2019->x86 Native Tools Command Prompt for VS 2019
  1. cd ThirdParty
  2. git clone https://github.com/desktop-app/patches.git
  3. cd patches
  4. git checkout 395b620
  5. cd ../
  6. git clone https://chromium.googlesource.com/external/gyp
  7. cd gyp
  8. git checkout 9f2a7bb1
  9. git apply ../patches/gyp.diff
  10. cd ..\..
复制代码
但在执行 git clone https://chromium.googlesource.com/external/gyp

fatal: unable to access 'https://chromium.googlesource.com/external/gyp/': Failed to connect to chromium.googlesource.com port 443: Timed out
,在cmd下运行如下代码config --globalhttp.proxy "localhost:1080",
或 模式:全局-Built-in rule

Add GYP and Ninja to your PATH:
  • Open Control Panel -> System -> Advanced system settings
  • Press Environment Variables...
  • Select Path
  • Press Edit
  • Add BuildPath\ThirdParty\gyp value
  • Add BuildPath\ThirdParty\Ninja value


回复 支持 反对

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
板凳
 楼主| 发表于 2020-4-19 14:33:10 | 只看该作者
本帖最后由 Qter 于 2020-4-25 10:40 编辑

Clone source code and prepare librarie

git clone --recursive 用于循环克隆git子项目



  1. SET PATH=%cd%\ThirdParty\Strawberry\perl\bin;%cd%\ThirdParty\Python27;%cd%\ThirdParty\NASM;%cd%\ThirdParty\jom;%cd%\ThirdParty\cmake\bin;%cd%\ThirdParty\yasm;%PATH%

  2. git clone --recursive https://github.com/hechengjin/tdesktop

  3. git checkout origin/v2.0.1

  4. git checkout -b v2.0.1
  5. git add .

  6. \tdesktop_TBuild\tdesktop>git status
  7. On branch v2.0.1
  8. Changes to be committed:
  9.   (use "git restore --staged <file>..." to unstage)
  10.         modified:   Telegram/lib_base

复制代码
mkdir Libraries
cd Libraries

SET LibrariesPath=%cd%
回复 支持 反对

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
地板
 楼主| 发表于 2020-4-19 22:45:33 | 只看该作者
本帖最后由 Qter 于 2020-4-20 00:39 编辑

在依赖项目中依次执行哪下命令:
  1. cd lzma\C\Util\LzmaLib
  2. msbuild LzmaLib.sln /property:Configuration=Debug
  3. msbuild LzmaLib.sln /property:Configuration=Release
  4. cd ..\..\..\..

  5. cd openssl_1_1_1
  6. perl Configure no-shared debug-VC-WIN32
  7. nmake
  8. mkdir out32.dbg
  9. move libcrypto.lib out32.dbg
  10. move libssl.lib out32.dbg
  11. move ossl_static.pdb out32.dbg\ossl_static
  12. nmake clean
  13. move out32.dbg\ossl_static out32.dbg\ossl_static.pdb
  14. perl Configure no-shared VC-WIN32
  15. nmake
  16. mkdir out32
  17. move libcrypto.lib out32
  18. move libssl.lib out32
  19. move ossl_static.pdb out32
  20. cd ..


  21. cd zlib
  22. cd contrib\vstudio\vc14
  23. msbuild zlibstat.vcxproj /property:Configuration=Debug
  24. msbuild zlibstat.vcxproj /property:Configuration=ReleaseWithoutAsm
  25. cd ..\..\..\..

  26. cd openal-soft
  27. cd build
  28. cmake -G "Visual Studio 16 2019" -A Win32 -D LIBTYPE:STRING=STATIC -D FORCE_STATIC_VCRT:STRING=ON ..
  29. msbuild OpenAL.vcxproj /property:Configuration=Debug
  30. msbuild OpenAL.vcxproj /property:Configuration=Release
  31. cd ..\..


  32. cd breakpad\src\client\windows
  33. gyp --no-circular-check breakpad_client.gyp --format=ninja
  34. cd ..\..
  35. ninja -C out/Debug common crash_generation_client exception_handler
  36. ninja -C out/Release common crash_generation_client exception_handler
  37. cd tools\windows\dump_syms
  38. gyp dump_syms.gyp
  39. msbuild dump_syms.vcxproj /property:Configuration=Release
  40. cd ..\..\..\..\..


  41. cd opus\win32\VS2015
  42. msbuild opus.sln /property:Configuration=Debug /property:Platform="Win32"
  43. msbuild opus.sln /property:Configuration=Release /property:Platform="Win32"

  44. cd ..\..\..\..
  45. SET PATH_BACKUP_=%PATH%
  46. SET PATH=%cd%\ThirdParty\msys64\usr\bin;%PATH%
  47. cd Libraries

  48. cd ffmpeg
  49. set CHERE_INVOKING=enabled_from_arguments
  50. set MSYS2_PATH_TYPE=inherit
  51. bash --login ../../tdesktop/Telegram/Patches/build_ffmpeg_win.sh

  52. SET PATH=%PATH_BACKUP_%
  53. cd ..

复制代码
执行 bash --login ../../tdesktop/Telegram/Patches/build_ffmpeg_win.sh 时有如下错误:


:: 正在同步软件包数据库...
错误:无法从 repo.msys2.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw32.db'
错误:无法从 sourceforge.net : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw32.db'
错误:无法从 www2.futureware.at : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw32.db'
错误:无法从 mirror.yandex.ru : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw32.db'
错误:无法升级 mingw32 (下载数据库出错)
错误:无法从 repo.msys2.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw64.db'
错误:无法从 sourceforge.net : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw64.db'
错误:无法从 www2.futureware.at : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw64.db'
错误:无法从 mirror.yandex.ru : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw64.db'
错误:无法升级 mingw64 (下载数据库出错)
错误:无法从 repo.msys2.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'msys.db'
错误:无法从 sourceforge.net : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'msys.db'
错误:无法从 www2.futureware.at : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'msys.db'
错误:无法从 mirror.yandex.ru : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'msys.db'
错误:无法升级 msys (下载数据库出错)
错误:同步所有数据库失败

baacloud模式改为:全局-Built-in rule

回复 支持 反对

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
5#
 楼主| 发表于 2020-4-25 00:40:02 | 只看该作者
本帖最后由 Qter 于 2020-5-1 20:15 编辑





SET PATH=%PATH_BACKUP_%

cd ..

  1. git clone git://code.qt.io/qt/qt5.git qt_5_12_5
  2. cd qt_5_12_5
  3. perl init-repository --module-subset=qtbase,qtimageformats
  4. git checkout v5.12.5
  5. git submodule update qtbase
  6. git submodule update qtimageformats
  7. cd qtbase
  8. git apply ../../patches/qtbase_5_12_5.diff
  9. cd ..

  10. configure -prefix "%LibrariesPath%\Qt-5.12.5" -debug-and-release -force-debug-info -opensource -confirm-license -static -static-runtime -I "%LibrariesPath%\openssl_1_1_1\include" -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="%LibrariesPath%\openssl_1_1_1\out32.dbg\libssl.lib %LibrariesPath%\openssl_1_1_1\out32.dbg\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" OPENSSL_LIBS_RELEASE="%LibrariesPath%\openssl_1_1_1\out32\libssl.lib %LibrariesPath%\openssl_1_1_1\out32\libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib" -mp -nomake examples -nomake tests -platform win32-msvc

  11. jom -j4
  12. jom -j4 install
  13. cd ..
复制代码



回复 支持 反对

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
6#
 楼主| 发表于 2020-5-1 20:54:44 | 只看该作者
本帖最后由 Qter 于 2020-5-1 22:33 编辑

Build the project
Go to BuildPath\tdesktop\Telegram and run (using your api_id and api_hash)
configure.bat -D TDESKTOP_API_ID=YOUR_API_ID -D TDESKTOP_API_HASH=YOUR_API_HASH -D DESKTOP_APP_USE_PACKAGED=OFF


Warn about uninitialized values.
-- Building for: Visual Studio 16 2019
CMake Error at CMakeLists.txt:7 (cmake_minimum_required):
  CMake 3.16 or higher is required.  You are running version 3.15.0-rc1


-- Configuring incomplete, errors occurred!

>cmake.exe --version
cmake version 3.15.0-rc1

CMake suite maintained and supported by Kitware (kitware.com/cmake).
升级CMake 到3.16.6https://cmake.org/download/

https://github.com/Kitware/CMake ... .16.6-win64-x64.zip


Open BuildPath\tdesktop\out\Telegram.sln in Visual Studio 2019
Select Telegram project and press Build > Build Telegram (Debug and Release configurations)--------------
严重性        代码        说明        项目        文件        行        禁止显示状态
错误        C2220        以下警告被视为错误  --下列文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
tdesktop\Telegram\ThirdParty\libtgvoip\webrtc_dsp\modules/audio_processing/agc2/biquad_filter.h(1,1): warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
Libraries\ffmpeg\libavutil\rational.h        1       
tdesktop\Telegram\lib_ui\ui\text\text.cpp        1870       
tdesktop\Telegram\ThirdParty\libtgvoip\VoIPController.cpp        3489       

进行如下修改
双击错误信息打开对应文件
文件->xxx文件另存为
保存下拉框中选择 编码保存
在打开的对话框中选择  Unicode(UTF-8 带签名)- 代码页65001
----------------
The result Telegram.exe will be located in D:\TBuild\tdesktop\out\Debug (and Release)




回复 支持 反对

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
7#
 楼主| 发表于 2020-5-10 22:25:07 | 只看该作者
添加新文件修改 \tdesktop\Telegram\CMakeLists.txt 文件然后运行
>configure.bat -D TDESKTOP_API_ID=1097907 -D TDESKTOP_API_HASH=ee883954816a61ce8d0a2d0101faa8e8 -D DESKTOP_APP_USE_PACKAGED=OFF
回复 支持 反对

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
8#
 楼主| 发表于 2020-5-11 11:00:55 | 只看该作者
回复 支持 反对

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
9#
 楼主| 发表于 2020-5-11 19:18:00 | 只看该作者
回复 支持 反对

使用道具 举报

1228

主题

1996

帖子

7572

积分

认证用户组

Rank: 5Rank: 5

积分
7572
10#
 楼主| 发表于 2020-9-29 10:42:01 | 只看该作者
打开 设置 对话框-> 这里同时按下Alt + Shift 键 再点击 语言,会弹出选择语言资源文件对话框
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-4-25 22:51 , Processed in 0.063663 second(s), 18 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表