From 85e4e0fe4e9c652ab0c234f7a1c45b12f6a80dce Mon Sep 17 00:00:00 2001 From: Kingtous Date: Sat, 7 Jan 2023 23:55:41 +0800 Subject: [PATCH 1/5] feat: add appimage build for flutter --- appimage/AppImageBuilder.yml | 90 +++++++++++++++++++++++++++++++++ flutter/linux/my_application.cc | 10 +++- 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 appimage/AppImageBuilder.yml diff --git a/appimage/AppImageBuilder.yml b/appimage/AppImageBuilder.yml new file mode 100644 index 000000000..e5e424d0b --- /dev/null +++ b/appimage/AppImageBuilder.yml @@ -0,0 +1,90 @@ +# appimage-builder recipe see https://appimage-builder.readthedocs.io for details +version: 1 +script: + - rm -rf ./AppDir || true + - bsdtar -zxvf ../rustdesk-1.2.0.deb + - tar -xvf ./data.tar.xz + - mkdir ./AppDir + - mv ./usr ./AppDir/usr + # 32x32 icon + - for i in {32,64,128}; do mkdir -p ./AppDir/usr/share/icons/hicolor/$i\x$i/apps/; cp ../res/$i\x$i.png ./AppDir/usr/share/icons/hicolor/$i\x$i/apps/rustdesk.png; done + # desktop file + # - sed -i "s/Icon=\/usr\/share\/rustdesk\/files\/rustdesk.png/Icon=rustdesk/g" ./AppDir/usr/share/applications/rustdesk.desktop + - rm -rf ./AppDir/usr/share/applications +AppDir: + path: ./AppDir + app_info: + id: rustdesk + name: rustdesk + icon: rustdesk + version: 1.2.0 + exec: usr/lib/rustdesk/rustdesk + exec_args: $@ + apt: + arch: + - amd64 + allow_unauthenticated: true + sources: + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic universe + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates universe + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic multiverse + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates multiverse + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted + universe multiverse + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security universe + - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security multiverse + - sourceline: deb http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu + bionic main + include: + - libc6:amd64 + - libgtk-3-0 + - libxcb-randr0 + - libxdo3 + - libxfixes3 + - libxcb-shape0 + - libxcb-xfixes0 + - libasound2 + - libsystemd0 + - curl + - libva-drm2 + - libva-x11-2 + - libvdpau1 + - libgstreamer-plugins-base1.0-0 + exclude: + - humanity-icon-theme + - hicolor-icon-theme + - adwaita-icon-theme + - ubuntu-mono + files: + include: [] + exclude: + - usr/share/man + - usr/share/doc/*/README.* + - usr/share/doc/*/changelog.* + - usr/share/doc/*/NEWS.* + - usr/share/doc/*/TODO.* + runtime: + env: + GIO_MODULE_DIR: $APPDIR/usr/lib/x86_64-linux-gnu/gio/modules/ + test: + fedora-30: + image: appimagecrafters/tests-env:fedora-30 + command: ./AppRun + debian-stable: + image: appimagecrafters/tests-env:debian-stable + command: ./AppRun + archlinux-latest: + image: appimagecrafters/tests-env:archlinux-latest + command: ./AppRun + centos-7: + image: appimagecrafters/tests-env:centos-7 + command: ./AppRun + ubuntu-xenial: + image: appimagecrafters/tests-env:ubuntu-xenial + command: ./AppRun +AppImage: + arch: x86_64 + update-information: guess diff --git a/flutter/linux/my_application.cc b/flutter/linux/my_application.cc index 215c6f0ee..21e25fa28 100644 --- a/flutter/linux/my_application.cc +++ b/flutter/linux/my_application.cc @@ -23,7 +23,15 @@ static void my_application_activate(GApplication* application) { GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); // we have custom window frame gtk_window_set_decorated(window, FALSE); - + // try setting icon for rustdesk, which uses the system cache + GtkIconTheme* theme = gtk_icon_theme_get_default(); + gint icons[4] = {256, 128, 64, 32}; + for (int i = 0; i < 4; i++) { + GdkPixbuf* icon = gtk_icon_theme_load_icon(theme, "rustdesk", icons[i], GTK_ICON_LOOKUP_NO_SVG, NULL); + if (icon != nullptr) { + gtk_window_set_icon(window, icon); + } + } // Use a header bar when running in GNOME as this is the common style used // by applications and is the setup most users will be using (e.g. Ubuntu // desktop). From b28e4b0e608ce2af7ece861275ea0ca6227aad16 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Sun, 8 Jan 2023 00:22:15 +0800 Subject: [PATCH 2/5] feat: appimage nightly ci --- .github/workflows/flutter-nightly.yml | 26 ++++++++++++++++++++++++-- appimage/AppImageBuilder.yml | 17 +++++++---------- flutter/pubspec.yaml | 2 +- res/64x64.png | Bin 0 -> 2264 bytes 4 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 res/64x64.png diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 7ce940b89..1be4bb001 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -1162,7 +1162,7 @@ jobs: - name: Prepare env run: | sudo apt update -y - sudo apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev + sudo apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev libarchive-tools mkdir -p ./target/release/ - name: Restore the rustdesk lib file @@ -1217,7 +1217,8 @@ jobs: shell: bash run: | for name in rustdesk*??.deb; do - mv "$name" "${name%%.deb}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb" + # use cp to duplicate deb files to fit other packages. + cp "$name" "${name%%.deb}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb" done - name: Publish debian package @@ -1285,6 +1286,27 @@ jobs: files: | res/rustdesk*.zst + - name: Build appimage package + if: ${{ matrix.job.extra-build-features == '' }} + shell: bash + run: | + # set-up appimage-builder + wget -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage + chmod +x appimage-builder-x86_64.AppImage + sudo mv appimage-builder-x86_64.AppImage /usr/local/bin/appimage-builder + # run appimage-builder + pushd appimage + appimage-builder --skip-tests + + - name: Publish appimage package + if: ${{ matrix.job.extra-build-features == '' }} + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + ./appimage/rustdesk-${{ env.VERSION }}-*.AppImage + - name: Publish fedora28/centos8 package if: ${{ matrix.job.extra-build-features == '' }} uses: softprops/action-gh-release@v1 diff --git a/appimage/AppImageBuilder.yml b/appimage/AppImageBuilder.yml index e5e424d0b..ae95fd2ce 100644 --- a/appimage/AppImageBuilder.yml +++ b/appimage/AppImageBuilder.yml @@ -25,17 +25,14 @@ AppDir: - amd64 allow_unauthenticated: true sources: - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic universe - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates universe - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic multiverse - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates multiverse - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic main restricted + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic universe + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic multiverse + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse + - sourceline: deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security universe - - sourceline: deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security multiverse - sourceline: deb http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu bionic main include: diff --git a/flutter/pubspec.yaml b/flutter/pubspec.yaml index 4826f6198..705f4650c 100644 --- a/flutter/pubspec.yaml +++ b/flutter/pubspec.yaml @@ -63,7 +63,7 @@ dependencies: desktop_multi_window: git: url: https://github.com/Kingtous/rustdesk_desktop_multi_window - ref: e6d30bde98bd0f4ff50a130e5b1068138307bd03 + ref: 057e6eb1bc7dcbcf9dafd1384274a611e4fe7124 freezed_annotation: ^2.0.3 flutter_custom_cursor: ^0.0.2 window_size: diff --git a/res/64x64.png b/res/64x64.png new file mode 100644 index 0000000000000000000000000000000000000000..d93638e6eb1d82b24807d7b3d0a6ec5c72e0bd86 GIT binary patch literal 2264 zcmZ{mc`($E8^=G+bwsXBQ6Wdv((Wq6y1vdWSJqYJT4${*i(T}kB}e4Uy;jFYuH0<0 zlv}$JQqGlgNx6?u{Cwv(^PBnoW`6U`^So!?&%EaS=kvr{m>Kc$i17dbz=t%}w>(mv zf0~Q)XqI>fFpfkLZER@@0HJaK5E%^sdq-B}0ssU-0pPnc0H|jJfT%yQ@dn~(!RdP4 zNFO--r=C)a(vKVv7HMh#VzPh)guuRvMPo+}1*xxVg&X}jcGur}2n<@Cq^fdDMYD73 zn~3NNaNrGI-DJd>OmT2EnwO@JIY($DE!sc!cPe*n0I2Br3!&5MF}~l2Y!XG z736y_FuqC0Q*ojZt!S@axxaL^)k)D#=m71Xu{^NEP6v9sXMl!S&BSKF>D@gr?xZc> zmA9wYWPGvR!UH(ndRTb*H=0Db9dTOVkqN8Sj93Atp)ZCY68qhOJzJ3rXQWX`rW~`2 z^d>wN;!7j+l&I?2!-EVG21K%IyJs15sfgw*J7Rz=y~K@f?8sDqx;rzp#<@1oxLi=mQVQX)Zzo#v#Xn%H&MziYA+3TrCT zA1gN5_3>^sH9r26pUNdTs<+9aggn=obN=4UO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a2 zaP;0bSEXu)><_SBm7)KtS_FCf55H3tOFc6-1m(a9d8dL<0^^b`u|;YaUgd5THtnRM z*j$6NIQ0%Gkwp%*dnJw5{RMcV0>dLAYp-^=wR4@8d?tcM3es10#`2P>UN4$<+4M6@s30Q9*_du+R dkN^KNYU*& Date: Sun, 8 Jan 2023 08:23:06 +0800 Subject: [PATCH 3/5] fix: use tmp folder to download appimage-builder --- .github/workflows/flutter-nightly.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 1be4bb001..57a9b2eac 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -1291,9 +1291,11 @@ jobs: shell: bash run: | # set-up appimage-builder + pushd /tmp wget -O appimage-builder-x86_64.AppImage https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage chmod +x appimage-builder-x86_64.AppImage sudo mv appimage-builder-x86_64.AppImage /usr/local/bin/appimage-builder + popd # run appimage-builder pushd appimage appimage-builder --skip-tests From 3bf2d749fe44d41db48a1122846d909d8d3d66ab Mon Sep 17 00:00:00 2001 From: Kingtous Date: Sun, 8 Jan 2023 08:58:30 +0800 Subject: [PATCH 4/5] add: sudo priviledge --- .github/workflows/flutter-nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 57a9b2eac..b6f82cf2b 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -1298,7 +1298,7 @@ jobs: popd # run appimage-builder pushd appimage - appimage-builder --skip-tests + sudo appimage-builder --skip-tests - name: Publish appimage package if: ${{ matrix.job.extra-build-features == '' }} From 9245e13057fca11a4509994b56cc0db00c3383c6 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Sun, 8 Jan 2023 10:27:00 +0800 Subject: [PATCH 5/5] fix: use appimage feature --- .github/workflows/flutter-nightly.yml | 16 ++++++++++++++-- build.py | 7 +++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index b6f82cf2b..eb13edf15 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -599,6 +599,12 @@ jobs: os: ubuntu-20.04, extra-build-features: "flatpak", } + - { + arch: x86_64, + target: x86_64-unknown-linux-gnu, + os: ubuntu-20.04, + extra-build-features: "appimage", + } # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } steps: - name: Maximize build space @@ -1148,6 +1154,12 @@ jobs: os: ubuntu-18.04, extra-build-features: "flatpak", } + - { + arch: x86_64, + target: x86_64-unknown-linux-gnu, + os: ubuntu-18.04, + extra-build-features: "appimage", + } # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } steps: - name: Checkout source code @@ -1287,7 +1299,7 @@ jobs: res/rustdesk*.zst - name: Build appimage package - if: ${{ matrix.job.extra-build-features == '' }} + if: ${{ matrix.job.extra-build-features == 'appimage' }} shell: bash run: | # set-up appimage-builder @@ -1301,7 +1313,7 @@ jobs: sudo appimage-builder --skip-tests - name: Publish appimage package - if: ${{ matrix.job.extra-build-features == '' }} + if: ${{ matrix.job.extra-build-features == 'appimage' }} uses: softprops/action-gh-release@v1 with: prerelease: true diff --git a/build.py b/build.py index 75d6fcd89..6b107ff4b 100755 --- a/build.py +++ b/build.py @@ -99,6 +99,11 @@ def make_parser(): action='store_true', help='Build rustdesk libs with the flatpak feature enabled' ) + parser.add_argument( + '--appimage', + action='store_true', + help='Build rustdesk libs with the appimage feature enabled' + ) parser.add_argument( '--skip-cargo', action='store_true', @@ -236,6 +241,8 @@ def get_features(args): features.append('flutter') if args.flatpak: features.append('flatpak') + if args.appimage: + features.append('appimage') print("features:", features) return features