From 1b8d41eee99a2c4a757c7fff35d7bdf72c80e7f1 Mon Sep 17 00:00:00 2001 From: msojocs Date: Mon, 4 Apr 2022 17:45:48 +0800 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 76aac0f6a5ecae98c28b77ffc016a79d530584b1 Author: msojocs Date: Sun Apr 3 23:05:16 2022 +0800 fix: build commit 3099858f56eab1db82c9965a60c323869898e37f Author: msojocs Date: Sun Apr 3 22:11:24 2022 +0800 update commit 150a944c026f14e6e4157ed84243560565a89818 Author: msojocs Date: Sat Mar 26 20:22:43 2022 +0800 test commit 6fa17ebca20f2980f08774c56a48dfa1b5ea6381 Author: msojocs Date: Sat Mar 26 19:05:35 2022 +0800 fix: deepin build commit 3c373a8f6fa765741c3a974d72833b3e240adb2a Author: msojocs Date: Sat Mar 26 18:06:43 2022 +0800 update: deepin build commit f29fa16289132b40ef1d85992600770cfd2ba298 Author: msojocs Date: Fri Mar 25 22:42:45 2022 +0800 使用debuild commit 324d866482c77a9b7bb4715eebed9c149af7b1d8 Author: msojocs Date: Wed Mar 23 09:35:12 2022 +0800 fix: krb5 commit e463415599a04fae282cb36e8a5d3ee2ebae2239 Author: msojocs Date: Tue Mar 22 22:58:52 2022 +0800 feat: flatpak commit 83677cba04e9d84a1ef12cfdeacb0f1e779b4e8c Merge: 7ff73e1 41ad887 Author: msojocs Date: Tue Mar 22 13:27:06 2022 +0800 Merge branch 'master' into flatpak commit 7ff73e13c795ef1e84b6a6f09fb9347de3600947 Author: msojocs Date: Fri Mar 11 22:44:35 2022 +0800 test --- .github/workflows/release.yml | 95 ++++++++++--------- .vscode/settings.json | 10 ++ changelog.md | 1 + docker/entrypoint | 4 +- readme.md | 5 +- res/deepin/DEBIAN/control | 7 -- res/deepin/debian/changelog | 8 ++ res/deepin/debian/compat | 1 + res/deepin/debian/control | 13 +++ res/deepin/debian/install | 2 + res/deepin/debian/rules | 21 ++++ res/deepin/debian/shlibs.local | 0 .../io.github.msojocs.wechat-devtools.yml | 83 ++++++++++++++++ tools/build-deepin copy.sh | 93 ++++++++++++++++++ tools/build-deepin.sh | 23 +++-- tools/build-flatpak.sh | 73 ++++++++++++++ 16 files changed, 372 insertions(+), 67 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 res/deepin/DEBIAN/control create mode 100644 res/deepin/debian/changelog create mode 100644 res/deepin/debian/compat create mode 100644 res/deepin/debian/control create mode 100644 res/deepin/debian/install create mode 100755 res/deepin/debian/rules create mode 100644 res/deepin/debian/shlibs.local create mode 100644 res/flatpak/io.github.msojocs.wechat-devtools.yml create mode 100755 tools/build-deepin copy.sh create mode 100755 tools/build-flatpak.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 90f5917..6dfe2d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: push: tags: - v* - branches: [ master, build] + branches: [ master, dev] pull_request: branches: [ master ] # # Allows you to run this workflow manually from the Actions tab @@ -155,55 +155,55 @@ jobs: name: wechat-devtools-${{ matrix.ARCH }}.build path: tmp/build - build-deb: - name: Build Deb Package - needs: - - build-src - runs-on: ubuntu-18.04 + # build-deb: + # name: Build Deb Package + # needs: + # - build-src + # runs-on: ubuntu-18.04 - strategy: - matrix: - ARCH: ['x86_64'] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + # strategy: + # matrix: + # ARCH: ['x86_64'] + # # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - steps: - - uses: actions/checkout@v2 - - name: Download artifacts - uses: actions/download-artifact@v2 + # steps: + # - uses: actions/checkout@v2 + # - name: Download artifacts + # uses: actions/download-artifact@v2 - - name: Generate TAG - id: Tag - run: | - tag='continuous' - name='Continuous Build' - if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then - tag='${{ github.ref_name }}' - name='${{ github.ref_name }}' - fi - echo "tag result: $tag - $name" - echo "::set-output name=tag::$tag" - echo "::set-output name=name::$name" + # - name: Generate TAG + # id: Tag + # run: | + # tag='continuous' + # name='Continuous Build' + # if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then + # tag='${{ github.ref_name }}' + # name='${{ github.ref_name }}' + # fi + # echo "tag result: $tag - $name" + # echo "::set-output name=tag::$tag" + # echo "::set-output name=name::$name" - - name: Build Deb Package - run: | - export BUILD_VERSION=${{ steps.tag.outputs.tag }} - ls -l - mkdir -p tmp/build - tools/build-prepare.sh - tools/build-deb.sh ${{ steps.tag.outputs.tag }} - export NO_WINE=true - tools/build-prepare.sh - tools/build-deb.sh ${{ steps.tag.outputs.tag }} + # - name: Build Deb Package + # run: | + # export BUILD_VERSION=${{ steps.tag.outputs.tag }} + # ls -l + # mkdir -p tmp/build + # tools/build-prepare.sh + # tools/build-deb.sh ${{ steps.tag.outputs.tag }} + # export NO_WINE=true + # tools/build-prepare.sh + # tools/build-deb.sh ${{ steps.tag.outputs.tag }} - - name: Upload artifact - uses: actions/upload-artifact@v2.3.1 - with: - # Artifact name - name: wechat-devtools-${{ matrix.ARCH }}.build - path: tmp/build + # - name: Upload artifact + # uses: actions/upload-artifact@v2.3.1 + # with: + # # Artifact name + # name: wechat-devtools-${{ matrix.ARCH }}.build + # path: tmp/build - build-deepin: - name: Build Deepin Package + build-deb: + name: Build DEB Package needs: - build-src runs-on: ubuntu-18.04 @@ -233,14 +233,15 @@ jobs: - name: Build Deepin Package run: | + sudo apt-get install -y build-essential fakeroot devscripts git git-buildpackage debhelper debmake lintian pbuilder export BUILD_VERSION=${{ steps.tag.outputs.tag }} ls -l mkdir -p tmp/build tools/build-prepare.sh - sudo env NO_WINE=false tools/build-deepin.sh ${{ steps.tag.outputs.tag }} + env NO_WINE=false tools/build-deepin.sh ${{ steps.tag.outputs.tag }} export NO_WINE=true tools/build-prepare.sh - sudo env NO_WINE=true tools/build-deepin.sh ${{ steps.tag.outputs.tag }} + env NO_WINE=true tools/build-deepin.sh ${{ steps.tag.outputs.tag }} - name: Upload artifact uses: actions/upload-artifact@v2.3.1 @@ -327,7 +328,7 @@ jobs: needs: - build-tar - build-deb - - build-deepin + # - build-deepin - build-arch runs-on: ubuntu-latest steps: diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f8cf3bb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "files.watcherExclude": { + "**/.git/objects/**": true, + "**/.git/subtree-cache/**": true, + "**/node_modules/*/**": true, + "**/.hg/store/**": true, + ".flatpak/**": true, + "_build/**": true + } +} \ No newline at end of file diff --git a/changelog.md b/changelog.md index da10e66..0405d43 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 1.05.2203070-7 / 2022-03-19 - fix: cli +- 兼容ubuntu16.04 # 1.05.2203070-6 / 2022-03-19 - feat: wcc node模块支持wxml引用 diff --git a/docker/entrypoint b/docker/entrypoint index 6658962..777e6b7 100755 --- a/docker/entrypoint +++ b/docker/entrypoint @@ -29,5 +29,5 @@ rm -rf node nwjs package.nw # exec ./tools/rebuild-node-modules 0.53.1 ./tools/setup-wechat-devtools-bash -chmod -R 777 tmp node nwjs package.nw -ls -l package.nw +# chmod -R 777 tmp node nwjs package.nw +# ls -l package.nw diff --git a/readme.md b/readme.md index 14cc1f2..9ce24d1 100644 --- a/readme.md +++ b/readme.md @@ -142,11 +142,12 @@ git clone https://github.com/msojocs/wechat-devtools-linux.git 微信开发者工具版权归腾讯公司所有,本项目旨在交流学习之用。如有不当之处,请联系本人,邮箱:jiyecafe@gmail.com # 赞赏 - 如果这个仓库让你感到舒适,可以点个Star或者请我喝杯咖啡(请尽量带上github昵称): + 如果这个仓库让你感到舒适,可以点个Star或者请这个菜鸡大学生喝杯咖啡(请尽量带上github昵称): ![赞赏码](https://user-images.githubusercontent.com/20937135/154661198-93854dc1-c8ba-4c97-a7ab-9f8de26c0226.png) # 感谢赞赏支持 1. *喆 2. @shaoxp - 3. . \ No newline at end of file + 3. . + 4. IvesSSa \ No newline at end of file diff --git a/res/deepin/DEBIAN/control b/res/deepin/DEBIAN/control deleted file mode 100644 index de2ac60..0000000 --- a/res/deepin/DEBIAN/control +++ /dev/null @@ -1,7 +0,0 @@ -Package: io.github.msojocs.wechat-devtools -Version: BUILD_VERSION -Section: utils -Priority: optional -Architecture: amd64 -Maintainer: msojocs -Description: WeChat Devtools For Linux. diff --git a/res/deepin/debian/changelog b/res/deepin/debian/changelog new file mode 100644 index 0000000..2b1230f --- /dev/null +++ b/res/deepin/debian/changelog @@ -0,0 +1,8 @@ +io.github.msojocs.wechat-devtools (1.05.2203070-7) unstable; urgency=medium + + * fix: + - cli + * 兼容 + - ubuntu16.04 + + -- msojocs Wed, 23 Mar 2022 14:56:04 +0800 diff --git a/res/deepin/debian/compat b/res/deepin/debian/compat new file mode 100644 index 0000000..9a03714 --- /dev/null +++ b/res/deepin/debian/compat @@ -0,0 +1 @@ +10 \ No newline at end of file diff --git a/res/deepin/debian/control b/res/deepin/debian/control new file mode 100644 index 0000000..ac4c781 --- /dev/null +++ b/res/deepin/debian/control @@ -0,0 +1,13 @@ +Source: io.github.msojocs.wechat-devtools +Maintainer: msojocs +Standards-Version: BUILD_VERSION +Priority: optional +Section: application + +Package: io.github.msojocs.wechat-devtools +Architecture: amd64 +Description: WeChat Devtools For Linux. + To help developers develop and debug Weixin Mini Programs more simply and efficiently, + Tencent have launched the new Weixin DevTools based on the original Official Account + web debugging tools. Therefore, we now have two developer modes (Official Account web + debugging) and (Mini Program debugging). This version is unofficial. diff --git a/res/deepin/debian/install b/res/deepin/debian/install new file mode 100644 index 0000000..1f1e5db --- /dev/null +++ b/res/deepin/debian/install @@ -0,0 +1,2 @@ +opt . +usr . \ No newline at end of file diff --git a/res/deepin/debian/rules b/res/deepin/debian/rules new file mode 100755 index 0000000..007a364 --- /dev/null +++ b/res/deepin/debian/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +DH_VERBOSE = 1 + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +override_dh_strip_nondeterminism: + +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info + +%: + dh "$@" diff --git a/res/deepin/debian/shlibs.local b/res/deepin/debian/shlibs.local new file mode 100644 index 0000000..e69de29 diff --git a/res/flatpak/io.github.msojocs.wechat-devtools.yml b/res/flatpak/io.github.msojocs.wechat-devtools.yml new file mode 100644 index 0000000..f72b945 --- /dev/null +++ b/res/flatpak/io.github.msojocs.wechat-devtools.yml @@ -0,0 +1,83 @@ +app-id: io.github.msojocs.wechat-devtools +runtime: org.freedesktop.Platform +runtime-version: '21.08' +sdk: org.freedesktop.Sdk +command: startup +finish-args: + # X11 + XShm access + - --share=ipc + - --socket=x11 + # Wayland access + - --socket=wayland + # Needs to talk to the network: + - --share=network + # Needs to save files locally + - --filesystem=host + - --metadata=X-DConf=migrate-path=/org/gnome/dictionary/ +modules: + - name: nwjs + buildsystem: simple + sources: + - type: dir + # url: https://npm.taobao.org/mirrors/nwjs/v0.53.1/nwjs-sdk-v0.53.1-linux-x64.tar.gz + # md5: b6f49803c51d0abacca2d1e566c7fe19 + path: nwjs + build-commands: + - ls -l + - rm package.nw + - mkdir -p /app/opt/nwjs + - cp -r . /app/opt/nwjs + - name: package.nw + buildsystem: simple + sources: + - type: dir + # url: https://npm.taobao.org/mirrors/nwjs/v0.53.1/nwjs-sdk-v0.53.1-linux-x64.tar.gz + # md5: b6f49803c51d0abacca2d1e566c7fe19 + path: package.nw + build-commands: + - ls -l + - mkdir -p /app/opt/package.nw + - cp -r . /app/opt/package.nw + - name: wechat-devtools + buildsystem: simple + build-commands: + - install -Dm755 wechat-devtools /app/opt/bin/wechat-devtools + - install -Dm755 startup.sh /app/bin/startup + - install -Dm644 io.github.msojocs.wechat_devtools.desktop /app/share/applications/io.github.msojocs.wechat-devtools.desktop + - install -Dm644 io.github.msojocs.wechat_devtools.svg /app/share/icons/hicolor/scalable/apps/io.github.msojocs.wechat-devtools.svg + - ar p libgssapi-krb5-2_1.18.3-6+deb11u1_amd64.deb data.tar.xz | tar -xJ + - ar p libkrb5-3_1.18.3-6+deb11u1_amd64.deb data.tar.xz | tar -xJ + - ar p libk5crypto3_1.18.3-6+deb11u1_amd64.deb data.tar.xz | tar -xJ + - ar p libkrb5support0_1.18.3-6+deb11u1_amd64.deb data.tar.xz | tar -xJ + - ar p libkeyutils1_1.6.1-2_amd64.deb data.tar.xz | tar -xJ + - ls -l + post-install: + - rm -rf usr/share/{doc,man} + - cp -dr usr/* $FLATPAK_DEST/ + - cp -dr lib/* $FLATPAK_DEST/lib + # - cp -dr opt/* $FLATPAK_DEST/ + sources: + - type: file + path: bin/wechat-devtools + - type: file + path: startup.sh + - type: file + path: io.github.msojocs.wechat_devtools.desktop + - type: file + path: io.github.msojocs.wechat_devtools.svg + - type: file + url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libgssapi-krb5-2_1.18.3-6+deb11u1_amd64.deb + sha256: 2ab853cbd0494c06fa694906c6eeea4df79720f461c76d080eb21a3e98f44115 + - type: file + url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libkrb5-3_1.18.3-6+deb11u1_amd64.deb + sha256: afb9dced3fcbdbc439a166eaa217dbfd485585842f12ce4587123009618e8bfe + - type: file + url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libk5crypto3_1.18.3-6+deb11u1_amd64.deb + sha256: 4a010fc69322b6be9e141a76593f46e6588c968ee3b7cf79a3b8b7efda9aeeba + - type: file + url: http://ftp.cn.debian.org/debian/pool/main/k/krb5/libkrb5support0_1.18.3-6+deb11u1_amd64.deb + sha256: 1f19908dbd37bd2ba9b3b3c9eb6ab8bee9a72f72745e6887f5366bb5fece654b + - type: file + url: http://ftp.cn.debian.org/debian/pool/main/k/keyutils/libkeyutils1_1.6.1-2_amd64.deb + sha256: f01060b434d8cad3c58d5811d2082389f11b3db8152657d6c22c1d298953f2a5 + \ No newline at end of file diff --git a/tools/build-deepin copy.sh b/tools/build-deepin copy.sh new file mode 100755 index 0000000..258f92c --- /dev/null +++ b/tools/build-deepin copy.sh @@ -0,0 +1,93 @@ +#!/bin/bash +set -e +notice() { + echo -e "\033[36m $1 \033[0m " +} +fail() { + echo -e "\033[41;37m 失败 \033[0m $1" +} + + +root_dir=$(cd `dirname $0`/.. && pwd -P) +DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" ) +DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}" +echo $BUILD_VERSION +if [ -n "$1" ];then + export BUILD_VERSION=$1 +fi +if [ -z "$BUILD_VERSION" ];then + export BUILD_VERSION='continuous' +fi +if [ "$BUILD_VERSION" == "continuous" ];then + export BUILD_VERSION="v${DEVTOOLS_VERSION}-continuous" +fi + +notice "检查版本号 -> $BUILD_VERSION" +INPUT_VERSION=$( echo $BUILD_VERSION | sed 's/v//' | sed 's/-.*//' ) +if [[ "$INPUT_VERSION" != "$DEVTOOLS_VERSION" ]];then + fail "传入版本号与实际版本号不一致!" + exit 1 +fi + +############ 准备构建deb包所需的文件及结构 ################ +package_name="io.github.msojocs.wechat-devtools" +if [[ $NO_WINE == 'true' ]];then + BUILD_MARK='no_wine' + package_name="${package_name}-no-wine" +else + BUILD_MARK='wine' + NAME_SUFFIX=" (wine)" + package_name="${package_name}-wine" +fi + +echo "root_dir: $root_dir" +tmp_dir="$root_dir/tmp" +build_dir="$root_dir/tmp/$package_name" +base_dir="$build_dir/opt/apps/$package_name" + +# Remove any previous build +rm -rf $build_dir +# Make usr and icons dirs +notice "Make Dirs" +mkdir -p $base_dir/{entries,files} +mkdir -p $base_dir/entries/{applications,icons/hicolor/scalable/apps/,mime,plugins,services} +mkdir -p $base_dir/files/{bin/bin,doc,lib} + +notice "COPY Files" +cp -r "$root_dir/res/deepin"/* $build_dir +mv "$build_dir/opt/apps/io.github.msojocs.wechat-devtools"/* $base_dir +rm -r "$build_dir/opt/apps/io.github.msojocs.wechat-devtools" +sed -i "s/BUILD_VERSION/${BUILD_VERSION//v/}/" "$build_dir/debian/control" "$base_dir/info" +sed -i "s/io.github.msojocs.wechat-devtools/$package_name/g" "$base_dir/info" "$build_dir/debian/control" +\cp -rf "$root_dir/bin/wechat-devtools" "$base_dir/files/bin/bin/wechat-devtools" + +# desktop +\cp -rf "$root_dir/res/template.desktop" "$base_dir/entries/applications/$package_name.desktop" +sed -i "s#Icon=dir/res/icons/wechat-devtools.svg#Icon=$package_name#" "$base_dir/entries/applications/$package_name.desktop" +sed -i "s#dir#/opt/apps/$package_name/files/bin#" "$base_dir/entries/applications/$package_name.desktop" +sed -i "s/WeChat Dev Tools/WeChat Dev Tools$NAME_SUFFIX/g" "$base_dir/info" "$base_dir/entries/applications/$package_name.desktop" +sed -i "s/微信开发者工具/微信开发者工具$NAME_SUFFIX/g" "$base_dir/entries/applications/$package_name.desktop" + +\cp -rf "$root_dir/res/icons/wechat-devtools.svg" "$base_dir/entries/icons/hicolor/scalable/apps/$package_name.svg" + +# 主体文件 +cp -r "$root_dir/package.nw" "$base_dir/files/bin/package.nw" +cp -r "$root_dir/nwjs" "$base_dir/files/bin/nwjs" +if [ -f "$root_dir/node/bin/node" ];then + rm -rf "$base_dir/files/bin/nwjs"/{node,node.exe} + cp "$root_dir/node/bin/node" "$base_dir/files/bin/nwjs/node" + cd "$base_dir/files/bin/nwjs/" && ln -s "node" "node.exe" +fi +# chown -R root:root "$base_dir" + +notice "BUILD DEB Package" +cd "$build_dir" +ls -l "$build_dir" +mkdir -p "$root_dir/tmp/build" + +if [[ ! $NO_WINE -eq 'true' ]];then + echo "Depends: wine, wine-binfmt" >> "$build_dir/debian/control" +fi + +# dpkg-deb -b . "$root_dir/tmp/build/WeChat_Dev_Tools_${BUILD_VERSION}_amd64_${BUILD_MARK}_deepin.deb" +debuild \ No newline at end of file diff --git a/tools/build-deepin.sh b/tools/build-deepin.sh index 13ed69a..73af988 100755 --- a/tools/build-deepin.sh +++ b/tools/build-deepin.sh @@ -21,7 +21,6 @@ fi if [ "$BUILD_VERSION" == "continuous" ];then export BUILD_VERSION="v${DEVTOOLS_VERSION}-continuous" fi -echo $BUILD_VERSION notice "检查版本号 -> $BUILD_VERSION" INPUT_VERSION=$( echo $BUILD_VERSION | sed 's/v//' | sed 's/-.*//' ) @@ -41,10 +40,9 @@ else package_name="${package_name}-wine" fi -root_dir=$(cd `dirname $0`/.. && pwd -P) echo "root_dir: $root_dir" tmp_dir="$root_dir/tmp" -build_dir="$root_dir/tmp/deepin" +build_dir="$root_dir/tmp/$package_name" base_dir="$build_dir/opt/apps/$package_name" # Remove any previous build @@ -59,8 +57,8 @@ notice "COPY Files" cp -r "$root_dir/res/deepin"/* $build_dir mv "$build_dir/opt/apps/io.github.msojocs.wechat-devtools"/* $base_dir rm -r "$build_dir/opt/apps/io.github.msojocs.wechat-devtools" -sed -i "s/BUILD_VERSION/${BUILD_VERSION//v/}/" "$build_dir/DEBIAN/control" "$base_dir/info" -sed -i "s/io.github.msojocs.wechat-devtools/$package_name/g" "$base_dir/info" "$build_dir/DEBIAN/control" +sed -i "s/BUILD_VERSION/${BUILD_VERSION//v/}/" "$build_dir/debian/control" "$base_dir/info" +sed -i "s/io.github.msojocs.wechat-devtools/$package_name/g" "$base_dir/info" "$build_dir/debian/control" "$build_dir/debian/changelog" \cp -rf "$root_dir/bin/wechat-devtools" "$base_dir/files/bin/bin/wechat-devtools" # desktop @@ -72,6 +70,11 @@ sed -i "s/微信开发者工具/微信开发者工具$NAME_SUFFIX/g" "$base_dir/ \cp -rf "$root_dir/res/icons/wechat-devtools.svg" "$base_dir/entries/icons/hicolor/scalable/apps/$package_name.svg" +# 兼容普通deb +mkdir -p "$build_dir/usr/share/applications" "$build_dir/usr/share/icons/hicolor/scalable/apps" +\cp -rf "$base_dir/entries/applications/$package_name.desktop" "$build_dir/usr/share/applications/$package_name.desktop" +\cp -rf "$base_dir/entries/icons/hicolor/scalable/apps/$package_name.svg" "$build_dir/usr/share/icons/hicolor/scalable/apps/$package_name.svg" + # 主体文件 cp -r "$root_dir/package.nw" "$base_dir/files/bin/package.nw" cp -r "$root_dir/nwjs" "$base_dir/files/bin/nwjs" @@ -80,15 +83,17 @@ if [ -f "$root_dir/node/bin/node" ];then cp "$root_dir/node/bin/node" "$base_dir/files/bin/nwjs/node" cd "$base_dir/files/bin/nwjs/" && ln -s "node" "node.exe" fi -chown -R root:root "$base_dir" +# chown -R root:root "$base_dir" notice "BUILD DEB Package" cd "$build_dir" ls -l "$build_dir" mkdir -p "$root_dir/tmp/build" -if [[ ! $NO_WINE -eq 'true' ]];then - echo "Depends: wine, wine-binfmt" >> "$build_dir/DEBIAN/control" +if [[ $NO_WINE != 'true' ]];then + echo "添加wine依赖 - $NO_WINE" + echo "Depends: wine, wine-binfmt" >> "$build_dir/debian/control" fi -dpkg-deb -b . "$root_dir/tmp/build/WeChat_Dev_Tools_${BUILD_VERSION}_amd64_${BUILD_MARK}_deepin.deb" +debuild --no-tgz-check -i -I -b -us -uc +mv $tmp_dir/*.deb $tmp_dir/build \ No newline at end of file diff --git a/tools/build-flatpak.sh b/tools/build-flatpak.sh new file mode 100755 index 0000000..9c8527e --- /dev/null +++ b/tools/build-flatpak.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +# 参数: +# $1 - 版本 v1.05.2203030-2 +# $2 - 平台 x86_64 + +set -e +notice() { + echo -e "\033[36m $1 \033[0m " +} +fail() { + echo -e "\033[41;37m 失败 \033[0m $1" +} + +if [ -n "$1" ];then + export VERSION=$1 +fi +if [ -n "$2" ];then + export ARCH=$2 +fi + +root_dir=$(cd `dirname $0`/.. && pwd -P) +tmp_dir="$root_dir/tmp" +app_dir="$tmp_dir/Flatpak" +build_dir="$tmp_dir/build" +mkdir -p $build_dir + +notice "检查版本号" +DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" ) +DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}" +INPUT_VERSION=$( echo $VERSION | sed 's/v//' | sed 's/-.*//' ) +# if [[ "$INPUT_VERSION" != "$DEVTOOLS_VERSION" ]];then +# fail "传入版本号与实际版本号不一致!" +# exit 1 +# fi + +# Remove any previous build +rm -rf $app_dir +# Make usr and icons dirs +mkdir -p $app_dir/bin + +notice "COPY FILES" +cp "$root_dir/bin/wechat-devtools" "$app_dir/bin/wechat-devtools" +cp "$root_dir/res/icons/wechat-devtools.svg" "$app_dir/io.github.msojocs.wechat_devtools.svg" +\cp -rf "$root_dir/res/flatpak"/* "$app_dir" +cp $root_dir/res/template.desktop "$app_dir/io.github.msojocs.wechat_devtools.desktop" +sed -i 's/Icon=dir\/res\/icons\/wechat-devtools.svg/Icon=io.github.msojocs.wechat_devtools/' "$app_dir/io.github.msojocs.wechat_devtools.desktop" +sed -i 's/Exec=dir\/bin\/wechat-devtools/Exec=startup/' "$app_dir/io.github.msojocs.wechat_devtools.desktop" +cp -r "$root_dir/package.nw" "$app_dir/package.nw" +cp -r "$root_dir/nwjs" "$app_dir/nwjs" +if [ -f $root_dir/node/bin/node ];then + rm -rf "$app_dir/nwjs/node" "$app_dir/nwjs/node.exe" + cp "$root_dir/node/bin/node" "$app_dir/nwjs/node" + cd "$app_dir/nwjs/" && ln -s "node" "node.exe" +fi + +notice "MAKE FLATPAK" + +cd $app_dir + +# 此处关键参照 https://unix.stackexchange.com/questions/412869/how-to-allow-gui-application-in-flatpak-to-run-cli-tool +cat > startup.sh <<- 'EOF' +#!/bin/sh +export PATH="/var/run/host/usr/bin:$PATH" +export LD_LIBRARY_PATH="/app/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" +exec /app/opt/bin/wechat-devtools +EOF + +# flatpak-builder build-dir io.github.msojocs.wechat-devtools.yml --force-clean + +flatpak-builder build-dir io.github.msojocs.wechat-devtools.yml --install --force-clean --user + +flatpak run io.github.msojocs.wechat-devtools \ No newline at end of file