红联Linux门户
Linux帮助

如何打包electronic-wechat(微信)为snap包

发布时间:2017-02-04 10:10:31来源:ubuntutouch作者:ubuntutouch
基于开发者程路的项目:https://github.com/dawndiy/electronic-wechat-snap,我对该项目做了一些小的修改.但最终把electronic-wechat打包为snap应用.
 
1)方案一
在整个方案中,我们直接把一个稳定编译好的发布直接下载打包.这个项目的源码:
https://github.com/liu-xiao-guo/wechat
 
snapcraft.yaml
name: electronic-wechat  
version: '1.4.0'  
summary: A better WeChat on macOS and Linux. Built with Electron.  
description: |  
Electronic WeChat is a unoffical WeChat client. A better WeChat on  
macOS and Linux. Built with Electron.  
grade: stable # must be 'stable' to release into candidate/stable channels  
confinement: strict # use 'strict' once you have the right plugs and slots
apps:  
electronic-wechat:  
command: desktop-launch $SNAP/wechat.wrapper  
plugs:  
- unity7  
- opengl  
- network  
- pulseaudio  
- home  
- browser-support  
- gsettings  
- x11  
parts:  
electronic-wechat:  
plugin: dump  
source: https://github.com/geeeeeeeeek/electronic-wechat/releases/download/v1.4.0/linux-x64.tar.gz  
stage-packages:  
- libnss3  
- fontconfig-config  
- gnome-themes-standard  
- fonts-wqy-microhei  
- libasound2-data  
- fcitx-frontend-gtk2  
- overlay-scrollbar-gtk2  
- libatk-adaptor  
- libcanberra-gtk-module  
filesets:  
no-easy-install-files:  
- -usr/sbin/update-icon-caches  
- -README.md  
stage:  
- $no-easy-install-files  
prime:  
- $no-easy-install-files  
wechat-copy:  
plugin: dump  
source: .  
filesets:  
wechat.wrapper: wechat.wrapper  
after:   
- electronic-wechat  
- desktop-gtk2
在这里,我们直接在地址https://github.com/geeeeeeeeek/electronic-wechat/releases/download/v1.4.0/linux-x64.tar.gz下载已经编译好的稳定的版本,并进行打包.这里我们可以利用dump plugin来帮我们进行安装.
 
2)方案二
我们可以利用最新的代码来编译,并打包.这个项目的源码在:
https://github.com/liu-xiao-guo/wechat1
 
snapcraft.yaml
name: electronic-wechat  
version: '1.4.0'  
summary: A better WeChat on macOS and Linux. Built with Electron.  
description: |  
Electronic WeChat is a unoffical WeChat client. A better WeChat on  
macOS and Linux. Built with Electron.  
grade: stable # must be 'stable' to release into candidate/stable channels  
confinement: strict # use 'strict' once you have the right plugs and slots
apps:  
electronic-wechat:  
command: desktop-launch $SNAP/wechat.wrapper  
plugs:  
- unity7  
- opengl  
- network  
- pulseaudio  
- home  
- browser-support  
- gsettings  
- x11
parts:  
electronic-wechat:  
plugin: nodejs  
source-type: git  
source: https://github.com/geeeeeeeeek/electronic-wechat/  
source-branch: production  
npm-run:  
- build:linux  
install: cp -r dist $SNAPCRAFT_PART_INSTALL  
stage-packages:  
- libnss3  
- fontconfig-config  
- gnome-themes-standard  
- fonts-wqy-microhei  
- libasound2-data  
- fcitx-frontend-gtk2  
- overlay-scrollbar-gtk2  
- libatk-adaptor  
- libcanberra-gtk-module  
filesets:  
no-easy-install-files:  
- -usr/sbin/update-icon-caches  
- -README.md  
stage:  
- $no-easy-install-files  
prime:  
- $no-easy-install-files  
wechat-copy:  
plugin: dump  
source: .  
filesets:  
wechat.wrapper: wechat.wrapper  
after:   
- electronic-wechat  
- desktop-gtk2
最新的代码在地址https://github.com/geeeeeeeeek/electronic-wechat/可以找到.我们利用nodejs plugin来帮我们进行打包.在这里,我们使用了snapcraft的Scriplets来覆盖我们的nodejs plugin中的install:
install: cp -r dist $SNAPCRAFT_PART_INSTALL
我们在项目的根目录下打入如下的命令:
$ snapcraft
它将最终帮我们生成我们所需要的.snap文件.我们可以安装到我们的系统中:
$ sudo snap install electronic-wechat_1.4.0_amd64.snap --dangerous
如何打包electronic-wechat(微信)为snap包
我们可以看到electronic-wechat已经被成功安装到我的电脑中.运行我们的应用:
如何打包electronic-wechat(微信)为snap包
如何打包electronic-wechat(微信)为snap包
如何打包electronic-wechat(微信)为snap包
 
本文永久更新地址:http://www.linuxdiyf.com/linux/28127.html