Windows下编译打包Spice PC客户端

 

1 环境搭建

1.1 准备工作

安装启动:

  1. 安装替换图标工具: Resource Hacker
  2. 安装exe制作工具: NSIS(提取码:3dfp),在Plugins目录下添加 processwork.dll 插件
  3. 安装编译工具: msys2,在开始菜单中启动 MSYS2 MinGW 64-bit,进入 MINGW64 环境

注意事项:

  1. 生成32位应用程序需要在另一个msys2下的MINGW32 环境下进行
  2. 对于MinGW 32-bit,将下文中出现的 x86_64 替换成 i686 即可
  3. msys2 的安装目录(例如D:\msys64)就是根目录
  4. 所有源码需要下载至根目录,再进行编译安装
1.2 更新软件包
pacman -Syu

软件包 (6) bash-4.4.023-1  filesystem-2018.12-1  mintty-1~2.9.5-1
           msys2-runtime-2.11.2-1  pacman-5.1.2-2  pacman-mirrors-20180604-2

根据提示,关闭 msys2,从开始菜单栏重新启动,然后再执行一次。

1.3 安装开发工具
pacman -S base-devel --noconfirm

:: 在组 base-devel 中有 56 成员:
:: 软件仓库 msys
1) asciidoc  2) autoconf  3) autoconf2.13  4) autogen  5) automake-wrapper  6) automake1.10  7) automake1.11  8) automake1.12  9) automake1.13  10) automake1.14  11) automake1.15  12) automake1.16  13) automake1.6  14) automake1.7  15) automake1.8  16) automake1.9  17) bison  18) diffstat  19) diffutils  20) dos2unix  21) file  22) flex  23) gawk  24) gdb  25) gettext  26) gettext-devel  27) gperf  28) grep  29) groff  30) help2man  31) intltool  32) lemon  33) libtool  34) libunrar  35) libunrar-devel  36) m4  37) make  38) man-db  39) pacman  40) pactoys-git  41) patch  42) patchutils  43) perl  44) pkg-config  45) pkgfile  46) quilt  47) rcs  48) scons  49) sed  50) swig  51) texinfo  52) texinfo-tex  53) ttyrec  54) unrar  55) wget  56) xmlto
1.4 安装工具链
pacman -S mingw-w64-x86_64-toolchain --noconfirm

:: 在组 mingw-w64-x86_64-toolchain 中有 17 成员:
:: 软件仓库 mingw64
1) mingw-w64-x86_64-binutils  2) mingw-w64-x86_64-crt-git  3) mingw-w64-x86_64-gcc  4) mingw-w64-x86_64-gcc-ada  5) mingw-w64-x86_64-gcc-fortran  6) mingw-w64-x86_64-gcc-libgfortran  7) mingw-w64-x86_64-gcc-libs  8) mingw-w64-x86_64-gcc-objc  9) mingw-w64-x86_64-gdb  10) mingw-w64-x86_64-headers-git  11) mingw-w64-x86_64-libmangle-git  12) mingw-w64-x86_64-libwinpthread-git  13) mingw-w64-x86_64-make  14) mingw-w64-x86_64-pkg-config  15) mingw-w64-x86_64-tools-git  16) mingw-w64-x86_64-winpthreads-git  17) mingw-w64-x86_64-winstorecompat-git
1.5 安装依赖包
pacman -S \
mingw-w64-x86_64-gst-libav \
mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good \
mingw-w64-x86_64-gst-plugins-ugly \
mingw-w64-x86_64-gstreamer --noconfirm
pacman -S \
mingw-w64-x86_64-icoutils \
mingw-w64-x86_64-python2-six \
mingw-w64-x86_64-python2-pyparsing --noconfirm
1.6 安装spice-gtk的依赖包

(1)安装spice-gtk 0.35-3及其依赖包

pacman -S mingw-w64-x86_64-spice-gtk --noconfirm

(2)保留依赖包,卸载spice-gtk等

pacman -R mingw-w64-x86_64-spice-gtk \
mingw-w64-x86_64-usbredir \
mingw-w64-x86_64-libusb \
mingw-w64-x86_64-spice-protocol --noconfirm

2 编译客户端

版本说明:

组件名称瘦终端版本pacman默认PC客户端
spice-protocol0.12.130.12.14-10.12.13(make install)
libusb1.0.211.0.22-11.0.22(make install)
usbredir0.7.10.8.0-10.8.0(make install)
spice-gtk0.340.35-30.34(make install)

编译步骤:

  1. spice-protocol 0.12.23
  2. libusb 1.0.22
  3. usbredir 0.8.0
  4. spice-gtk 0.34
  5. clouddesktop-client
2.1 编译spice-protocol

(1)下载spice-protocol 0.12.13源码

git clone http://10.142.233.181:8888/ctg-cache/spice-protocol.git

(2)然后make install

cd /spice-protocol && ./configure && make && make install
2.2 编译libusb

(1)下载libusb-1.0.22源码

git clone http://10.142.233.181:8888/zengzhihua/libusb-1.0.22.git

(2)然后make install

cd /libusb-1.0.22 && ./configure && make && make install
2.3 编译usbredir

(1)下载usbredir-0.8.0源码

git clone http://10.142.233.181:8888/zengzhihua/usbredir-0.8.0.git

(2)然后make install(首次编译时必须执行 sh autogen.sh

cd /usbredir-0.8.0 && sh autogen.sh && ./configure && make && make install
2.4 编译spice-gtk

(1)下载spice-gtk 0.34源码

git clone http://10.142.233.181:8888/zengzhihua/spice-gtk-0.34.git

(2)然后configure

cd /spice-gtk-0.34 && ./configure --disable-werror --enable-vala

成功后出现:

configure:

        Spice-Gtk 0.34
        ==============

        prefix:                   /mingw64
        c compiler:               gcc
        Target:                   Windows

        Gtk:                      3.0
        Coroutine:                winfiber
        PulseAudio:               no
        GStreamer Audio:          yes
        GStreamer Video:          yes
        SASL support:             yes
        Smartcard support:        no
        USB redirection support:  yes
        DBus:                     yes
        WebDAV support:           yes
        LZ4 support:              yes

        Now type 'make' to build spice-gtk        

(3)然后make install

make -j4 && make install

(4)编译完成后执行spicy测试一下

spicy
2.5 编译客户端

(1)下载clouddesktop-client中windows-master分支的源码

git clone -b windows-master http://10.142.233.181:8888/ctg-cache/clouddesktop-client.git clouddesktop-client-windows

(2)然后make install(注:首次编译时必须执行sh autogen.shx.x.x 替换成相应的版本号)

cd /clouddesktop-client-windows && sh autogen.sh && \
./configure --prefix=/CtyunDesktop-x64-x.x.x && \
make -j4 && make install
2.6 快速编译

(1)下载源码(可在 Git Bash 执行)

git clone http://10.142.233.181:8888/ctg-cache/spice-protocol.git && \
git clone http://10.142.233.181:8888/zengzhihua/libusb-1.0.22.git && \
git clone http://10.142.233.181:8888/zengzhihua/usbredir-0.8.0.git && \
git clone http://10.142.233.181:8888/zengzhihua/spice-gtk-0.34.git && \
git clone -b windows-master http://10.142.233.181:8888/ctg-cache/clouddesktop-client.git clouddesktop-client-windows

(2)编译脚本(x.x.x 替换成相应的版本号)

cd /spice-protocol && ./configure && make && make install && \
cd /libusb-1.0.22 && ./configure && make && make install && \
cd /usbredir-0.8.0 && sh autogen.sh && ./configure && make && make install && \
cd /spice-gtk-0.34 && ./configure --disable-werror --enable-vala && make -j4 && make install && \
cd /clouddesktop-client-windows && sh autogen.sh && ./configure --prefix=/CtyunDesktop-x64-x.x.x && make -j4 && ./src/remote-viewer.exe --debug

3 打包客户端

3.1 替换应用程序图标

打开Resource Hacker
(1)Open → 选择 /CtyunDesktop-x64-x.x.x/bin/remote-viewer.exe
(2)Add Binary or Image Resource → 选择 clouddesktop-client-windows/nsis/NSIS-Icon.ico
(3)Save(Ctrl+S)

3.2 修改配置

进入clouddesktop-client-windows/nsis
(1)修改 MakePackage-x64.bat 中的 dirname(CtyunDesktop-x64-x.x.x)
(2)修改 NSIS-Licence-x64.txt 中的 Software Licence (安装程序的许可说明)

3.3 运行脚本

(1)进入clouddesktop-client-windows/nsis,双击运行 MakePackage-x64.bat脚本,成功后进入CtyunDesktop-x64-x.x.x,文件结构如下:

|-- bin/
|-- lib/
|-- log/
|-- plugin/
|-- share/
|-- cloud-desktop-config.ini

(2)修改 cloud-desktop-config.ini 中的 cloud_urls ,对应不同环境的https接口地址

3.4 打包生成exe

进入clouddesktop-client-windows/nsis
(1)使用 HM VNISEdit 2.0.3 打开 NSIS-Setup-x64.nsi
(2)修改版本号: !define PRODUCT_VERSION "x.x.x"
(3)运行脚本:工具栏→NSIS→编译脚本,得到 CtyunDesktop-x64-x.x.x.exe

转载于:https://www.cnblogs.com/zengzhihua/p/10240792.html

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值