编译linphone-desktop 要涉及很多开源工具以及对版本也有要求,这次花了有一周多时间才编译出来,主要是在 M1 本本windows 11 arm虚拟机里操作,用VS2022 来打包,主要做了一些修改: 图标、名称、中文汉化、主色调等,内容都附上,给有需要的人参考, 话不多说一边上图一边说:
1、用release编译与RelWithDebInfo区别就是没有deb文件,包更小.
2、官方界面一些汉化并不完整,基本这回都给汉化了.
这里去掉了一些不想要的功能;linphone账号登录、会议、录音等
3、视频这官方中文乱码
这里解决了这个获取中文名乱码问题,代码是写死,可以正常通讯,有没有其它问题,有待测试;AV1这里不显示主要是编译时是在M1 ARM CPU 没有通过就限制了,在 intel cpu上可以正常.
官方的还有一些中文没有翻译
这里一些个人觉得比较合适的就翻译了一些,基本上所有地方都有翻译.就不一一截图.
好了正式开始:
步骤:
环境准备:
如果你的版本环境照官方的安装说明就没问题的,主要是我这里环境不同的是用VS2022 以及在ARM CPU:
以下是官方安装说明:
Specific instructions for the Windows platform
- Install main tools:
MinGW/MSYS2
: download- Follow instructions on their "Getting Started" page.
- Install toolchains and prepare python:
pacman -Sy --needed base-devel mingw-w64-x86_64-toolchain
pacman -S python3-pip
inMSYS2 MSYS
consolepython3 -m pip install pystache six
incmd
- In this order, add
C:\msys64\mingw64\bin
,C:\msys64\
andC:\msys64\usr\bin
in your PATH environement variable from Windows advanced settings. Binaries from the msys folder (not from mingw32/64) doesn't fully support Windows Path and thus, they are to be avoided.
When building the SDK, it will install automatically from MSYS2 : toolchain
, python
, doxygen
, perl
, yasm
, gawk
, bzip2
, nasm
, sed
, patch
, pkg-config
, gettext
, glib2
, intltool
and graphviz
(if needed)
-
git
: useMSYS2 :downloadpacman -S git
or -
Visual Studio must also be properly configured with addons. Under "Tools"->"Obtain tools and features", make sure that the following components are installed:
- Tasks: Select Windows Universal Platform development, Desktop C++ Development, .NET Development
-
Ensure that you have downloaded the
Qt msvc2019 version
(64-bit). Note thatQt msvc2019
can be use with earlier version of Visual Studio. -
Or open a Command line with Visual Studio
Developer Command Prompt for VS 2019
and call qtenv2.bat that is in your qt binaries eg:C:\Qt\<version>\msvc2019\bin\qtenv2.bat
-
Build as usual with adding
-A x64
tocmake ..
(General Steps) :
cmake .. -DCMAKE_BUILD_PARALLEL_LEVEL=10 -DCMAKE_BUILD_TYPE=RelWithDebInfo -A x64
The default build is very long. It is prefered to use the Ninja generator-G "Ninja"
cmake --build . --target ALL_BUILD --parallel 10 --config RelWithDebInfo
- The project folder will be in the build directory and binaries should be in the OUTPUT folder.
我的安装,注意事项:
1、vs2022 下载的是社区版本,安装时注意选择 Windows SDK 10、VC+++ 桌面开发环境、C# 桌面开发环境
2、python用的是自己独立安装的,不是用msys2里的.msys2里的要把 usr/bin/python.exe python3.exe 重命名或删除
安装six pystache 用独立下载安装python安装
还得注意,新版本的python没有了python3.exe 得直接在python.exe目录下复制一份python.exe为python3.exe 要么cmake配置时找不到python
3、设置环境变量时不能用 msys2的mingw32/bin加进去,要么编译时不认VC++ 会用mingw
如: C:\msys64\mingw64\bin 一定不要加进去path里!!
4、除了上面官方说的环境软件之外,还需要
7z . 安装记得后加上 path .
以及 meson perl 这个可以直接通过msys2 安装 pacman -S meson perl
然后doxygen nasm ninja yasm 等我也是另外下载,不用pacman来安装 ,这个看个人想法.应该不影响.
5、QT5 的下载
QT现在下载如果直接通过官网下载,需要在线安装,但我没找到能下载到QT5的,都是6版本,然后还得注册登录下载等很麻烦,这里推荐直接从国内镜像去下载解压即可:
可以把这里的所有7z都下载下载后一起解压即可,用wget 批量下载:
wget -c -r -np -nd --accept=7z https://mirror.sjtu.edu.cn/qt/online/qtsdkrepository/windows_x86/desktop/qt5_5152/qt.qt5.5152.win64_msvc2019_64/
下载完后直接用7z解决即可.
然后PATH:就这样
set PATH=C:\Python3\Scripts;C:\python3;C:\Qt\Qt5.13.2\5.13.2\msvc2017_64\bin;C:\msys64;C:\msys64\usr\bin;c:\Program Files\7-Zip\;C:\Program Files (x86)\doxygen\bin;%PATH%
还有带上两个QT目录
set QT_DIR=C:\QT\5.15.2\msvc2019_64
set Qt5_DIR=C:\QT\5.15.2\msvc2019_64\lib\cmake\Qt5
还有7z
set 7Z_PROGRAM=c:\Program Files\7-Zip\7z.exe
图片替换
图片、图标替换:
linphone-app/assets/images/linphone_logo.svg
linphone-app/assets/icon.ico
汉化:
./linphone-app/assets/languages/zh_CN.ts
应用名称:
./linphone-app/application_info.cmake
最后开始编译:
主要看你要不要打包deb 不要的话MAKE_BUILD_TYPE就直接用Release ,打包时会更小,
1、由于在ARM上AV1编译失败,我这是就把AV1编译取消 加上: -DBUILD_DAV1D=OFF
2、要生成安装加上 -DENABLE_APP_PACKAGING=ON
生成配置环境完整理命令:
#这个看具体的网络环境,有的下载也很快,下载后有2G多,所以要耐心等,如果没正常下载,要重新下载,关系后面编译问题,一般后面编译不能过,报少这个少那个就有可能是代码没下载完整
git clone https://gitlab.linphone.org/BC/public/linphone-desktop.git --recursive
#进入代码目录
cd linphone-desktop
#建立一个编译目录
mkdir build
cd build
#生成编译配置
cmake .. -DBUILD_DAV1D=OFF -DENABLE_APP_PACKAGING=ON -DCMAKE_BUILD_PARALLEL_LEVEL=10 -DCMAKE_BUILD_TYPE=Release -G "Ninja"
编译:
cmake --build . --parallel 10 --config Release
打包
cmake --install .
git 源代码:
如果GIT下载慢的可以从这里下载,已经打包好,无需积分可下载,一共4个文件.7z自解压文件.下载后放同一个目录解压即可.
linphone-src-git-20240509.7z.exe
https://download.youkuaiyun.com/download/pinke/89299860
linphone-src-git-20240509.7z.001
https://download.youkuaiyun.com/download/pinke/89299884
linphone-src-git-20240509.7z.002
https://download.youkuaiyun.com/download/pinke/89299888
linphone-src-git-20240509.7z.003
https://download.youkuaiyun.com/download/pinke/89299891
linphone-src-git-20240509.7z.004
https://download.youkuaiyun.com/download/pinke/89299880
其它参考:
中文相关:
MSVC utf8 : /utf-8(将源字符集和执行字符集设置为 UTF-8) | Microsoft Learn
图标相关:
iconfont.cn
icons8.com
svg转 ico File information - URL, name, size and QR code