2022-04-17 18:07:11 +08:00

160 lines
4.5 KiB
YAML

name: wechat-devtools # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: WeChat Devtools for Linux # 79 char long summary
description: |
WeChat Devtools for Linux.
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
architectures:
- build-on: [amd64]
run-on: [amd64]
# pull
# build
# stage
# prime
# snap
# /root/parts/my-part/src/nw
parts:
# compiler:
# plugin: nil
# source: https://download.fastgit.org/msojocs/wechat-devtools-linux/releases/download/v0.6/compiler.tar.xz
node-js:
plugin: dump
source: https://npmmirror.com/mirrors/node/v16.4.2/node-v16.4.2-linux-x64.tar.gz
# source: './cache/node-v16.4.2-linux-x64.tar.gz'
organize:
"*": nodejs/
stage:
- nodejs/*
devtools:
plugin: dump
source: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203070&version_type=1
# source: ./cache/wechat_devtools_1.05.2201240_x64.exe
source-type: 7z
source-subdir: ./code
build-environment:
- PATH: "$SNAPCRAFT_STAGE/nodejs/bin:$PATH"
- NW_VERSION: 0.55.0
# - NW_PACKAGE_DIR: "$SNAPCRAFT_PART_BUILD/code/package.nw"
# - srcdir: "$SNAPCRAFT_PROJECT_DIR"
build-packages:
- python2.7
- libxkbfile-dev
- pkg-config
- libkrb5-dev
- gcc
- g++
- make
- openssl
- libssh2-1-dev
override-build: |
env
echo "3"
ls -l $SNAPCRAFT_STAGE
ls -l $SNAPCRAFT_PROJECT_DIR
# 执行构建脚本
chmod -R 755 $SNAPCRAFT_PART_BUILD/code/package.nw
npm install node-gyp nw-gyp -g --registry=https://registry.npm.taobao.org
node-gyp install --registry=https://registry.npm.taobao.org
cp -r "${SNAPCRAFT_PROJECT_DIR}/tools" "$SNAPCRAFT_PART_BUILD/code/tools"
cp -r "${SNAPCRAFT_PROJECT_DIR}/compiler" "$SNAPCRAFT_PART_BUILD/code/compiler"
for script in fix-package-name.js fix-cli.sh fix-core.sh fix-other.sh; do
echo -e "\e[1;34mrun ${script}\e[0m"
"${SNAPCRAFT_PART_BUILD}/code/tools/${script}"
done
# 构建模块
"${SNAPCRAFT_PART_BUILD}/code/tools/rebuild-node-modules.sh" $NW_VERSION
rm -rf "${SNAPCRAFT_PART_BUILD}/code/tools"
snapcraftctl build
stage-packages:
- libxkbfile1
- git-core
override-prime: |
snapcraftctl prime
rm -rf node node.exe
cp "$SNAPCRAFT_PRIME/nodejs/bin/node" "$SNAPCRAFT_PRIME/node"
ln -s "node" "node.exe"
after:
- node-js
# - compiler
# - desktop-gnome-platform
nw-js:
plugin: dump
source: https://npmmirror.com/mirrors/nwjs/v0.55.0/nwjs-sdk-v0.55.0-linux-x64.tar.gz
# source: ./cache/nwjs-sdk-v0.55.0-linux-x64.tar.gz
stage-packages:
- libnss3
- libnspr4
run-script:
plugin: nil
override-build: |
snapcraftctl build
cp "${SNAPCRAFT_PROJECT_DIR}/bin/wechat-devtools-snap" "$SNAPCRAFT_PART_INSTALL/wechat-devtools-snap"
stage:
- wechat-devtools-snap
zzz:
plugin: nil
# source: https://npmmirror.com/mirrors/nwjs/v0.53.1/nwjs-sdk-v0.53.1-linux-x64.tar.gz
override-stage: |
echo "6"
env
ls -l $SNAPCRAFT_STAGE
apps:
wechat-devtools:
# autostart: wechat-devtools.desktop
command: desktop-launch $SNAP/wechat-devtools-snap
environment:
WECHAT_DEVTOOLS_DIR: $SNAP/nwjs
APPDATA: "$SNAP_USER_DATA/wechat_devtools"
PATH: "$SNAP/node/bin:$SNAP/nwjs:$PATH"
USERPROFILE: $SNAP_USER_DATA
GIT_EXEC_PATH: $SNAP/usr/lib/git-core
extensions:
- gnome-3-34
plugs:
- desktop
- desktop-legacy
- opengl
- mount-observe
- x11
- wayland
- network
- network-bind
- gsettings
- browser-support
- password-manager-service
plugs:
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/data-dir/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes
# platform_snap:
# interface: content
# target: $SNAP/gnome-platform
# default-provider: gnome-3-34-1804