From c30479f02fa57012a790542e199f0a9918c9caea Mon Sep 17 00:00:00 2001 From: Kingtous Date: Mon, 27 Mar 2023 10:50:24 +0800 Subject: [PATCH 1/6] feat: add sciter nightly build --- .github/workflows/flutter-ci.yml | 23 +++++++++- .github/workflows/flutter-nightly.yml | 60 ++++++++++++++++++++++++++- .github/workflows/sciter.yml | 53 +++++++++++++++++++++++ 3 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/sciter.yml diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml index ff3f29ee7..5525586de 100644 --- a/.github/workflows/flutter-ci.yml +++ b/.github/workflows/flutter-ci.yml @@ -26,7 +26,7 @@ env: NDK_VERSION: "r23" jobs: - build-for-windows: + build-for-windows-flutter: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} strategy: @@ -92,6 +92,27 @@ jobs: - name: Build rustdesk run: python3 .\build.py --portable --hwcodec --flutter + + # The fallback for the flutter version, we use Sciter for 32bit Windows. + build-for-windows-sciter: + name: ${{ matrix.job.target }} (${{ matrix.job.os }}) + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + # - { target: i686-pc-windows-msvc , os: windows-2019 } + # - { target: x86_64-pc-windows-gnu , os: windows-2019 } + - { target: i686-pc-windows-msvc, os: windows-2019 } + # - { target: aarch64-pc-windows-msvc, os: windows-2019 } + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Build rustdesk sciter + uses: ./.github/workflows/sciter.yml + with: + target: ${{ matrix.job.target }} build-for-macOS: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-args }}] diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index b9fcb6bb4..183c39d68 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -23,7 +23,7 @@ env: RENDEZVOUS_SERVER: '${{ secrets.RENDEZVOUS_SERVER }}' jobs: - build-for-windows: + build-for-windows-flutter: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} strategy: @@ -134,6 +134,64 @@ jobs: files: | ./SignOutput/rustdesk-*.exe + # The fallback for the flutter version, we use Sciter for 32bit Windows. + build-for-windows-sciter: + name: ${{ matrix.job.target }} (${{ matrix.job.os }}) + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + job: + # - { target: i686-pc-windows-msvc , os: windows-2019 } + # - { target: x86_64-pc-windows-gnu , os: windows-2019 } + - { target: i686-pc-windows-msvc, os: windows-2019 } + # - { target: aarch64-pc-windows-msvc, os: windows-2019 } + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Build rustdesk sciter + uses: ./.github/workflows/sciter.yml + with: + target: ${{ matrix.job.target }} + + - name: Sign rustdesk files + uses: GermanBluefox/code-sign-action@v7 + with: + certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' + password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' + certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' + # certificatename: '${{ secrets.CERTNAME }}' + folder: './Release/' + recursive: true + + - name: Build self-extracted executable + shell: bash + run: | + pushd ./libs/portable + python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe + popd + mkdir -p ./SignOutput + mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}.exe + + - name: Sign rustdesk self-extracted file + uses: GermanBluefox/code-sign-action@v7 + with: + certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' + password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' + certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' + # certificatename: '${{ secrets.WINDOWS_PFX_NAME }}' + folder: './SignOutput' + recursive: false + + - name: Publish Release + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + ./SignOutput/rustdesk-*.exe + build-for-macOS: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-args }}] runs-on: ${{ matrix.job.os }} diff --git a/.github/workflows/sciter.yml b/.github/workflows/sciter.yml new file mode 100644 index 000000000..cc0c801d2 --- /dev/null +++ b/.github/workflows/sciter.yml @@ -0,0 +1,53 @@ +name: Build Sciter + +on: + workflow_call: + inputs: + target: + required: true + type: string + outputs: + output_folder: + description: "The relative directory of the executable folder which contains all dependencies for RustDesk." + value: ${{ jobs.build-sciter.outputs.output_folder }} +jobs: + build-sciter: + runs-on: windows-2019 + outputs: + output_folder: ${{ steps.build.outputs.output_folder }} + steps: + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ inputs.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }}-sciter + + - name: Restore from cache and install vcpkg + uses: lukka/run-vcpkg@v7 + with: + setupOnly: true + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + $VCPKG_ROOT/vcpkg install libvpx:x86-windows-static libyuv:x86-windows-static opus:x86-windows-static + shell: bash + + - name: Build rustdesk + id: build + shell: bash + run: | + python3 res/inline-sciter.py + # Replace the link for the ico. + cp flutter/windows/runner/resources/app_icon.ico res/icon.ico + cargo build --features inline --target=${{ matrix.job.target }} --release + mkdir -p ./Release + mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll + echo "output_folder=./Release" >> $GITHUB_OUTPUT From 260694fdaae359d3738399b9c5985453a02cdd13 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Mon, 27 Mar 2023 11:21:23 +0800 Subject: [PATCH 2/6] add: nearby dll check --- .github/workflows/flutter-ci.yml | 72 ++++++++++++++++++++++++++- .github/workflows/flutter-nightly.yml | 35 ++++++++++++- .github/workflows/sciter.yml | 53 -------------------- src/ui.rs | 12 +++++ 4 files changed, 115 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/sciter.yml diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml index 5525586de..428d538bf 100644 --- a/.github/workflows/flutter-ci.yml +++ b/.github/workflows/flutter-ci.yml @@ -109,10 +109,78 @@ jobs: - name: Checkout source code uses: actions/checkout@v3 - - name: Build rustdesk sciter - uses: ./.github/workflows/sciter.yml + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 with: + toolchain: stable target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }}-sciter + + - name: Restore from cache and install vcpkg + uses: lukka/run-vcpkg@v7 + with: + setupOnly: true + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + $VCPKG_ROOT/vcpkg install libvpx:x86-windows-static libyuv:x86-windows-static opus:x86-windows-static + shell: bash + + - name: Build rustdesk + id: build + shell: bash + run: | + python3 res/inline-sciter.py + # Replace the link for the ico. + rm res/icon.ico && cp flutter/windows/runner/resources/app_icon.ico res/icon.ico + cargo build --features inline --target=${{ matrix.job.target }} --release + mkdir -p ./Release + mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll + echo "output_folder=./Release" >> $GITHUB_OUTPUT + + - name: Sign rustdesk files + uses: GermanBluefox/code-sign-action@v7 + with: + certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' + password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' + certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' + # certificatename: '${{ secrets.CERTNAME }}' + folder: './Release/' + recursive: true + + - name: Build self-extracted executable + shell: bash + run: | + pushd ./libs/portable + python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe + popd + mkdir -p ./SignOutput + mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}.exe + + - name: Sign rustdesk self-extracted file + uses: GermanBluefox/code-sign-action@v7 + with: + certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' + password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' + certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' + # certificatename: '${{ secrets.WINDOWS_PFX_NAME }}' + folder: './SignOutput' + recursive: false + + - name: Publish Release + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + ./SignOutput/rustdesk-*.exe build-for-macOS: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-args }}] diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 183c39d68..e9fd70568 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -150,10 +150,41 @@ jobs: - name: Checkout source code uses: actions/checkout@v3 - - name: Build rustdesk sciter - uses: ./.github/workflows/sciter.yml + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 with: + toolchain: stable target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }}-sciter + + - name: Restore from cache and install vcpkg + uses: lukka/run-vcpkg@v7 + with: + setupOnly: true + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + $VCPKG_ROOT/vcpkg install libvpx:x86-windows-static libyuv:x86-windows-static opus:x86-windows-static + shell: bash + + - name: Build rustdesk + id: build + shell: bash + run: | + python3 res/inline-sciter.py + # Replace the link for the ico. + rm res/icon.ico && cp flutter/windows/runner/resources/app_icon.ico res/icon.ico + cargo build --features inline --target=${{ matrix.job.target }} --release + mkdir -p ./Release + mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll + echo "output_folder=./Release" >> $GITHUB_OUTPUT - name: Sign rustdesk files uses: GermanBluefox/code-sign-action@v7 diff --git a/.github/workflows/sciter.yml b/.github/workflows/sciter.yml deleted file mode 100644 index cc0c801d2..000000000 --- a/.github/workflows/sciter.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Build Sciter - -on: - workflow_call: - inputs: - target: - required: true - type: string - outputs: - output_folder: - description: "The relative directory of the executable folder which contains all dependencies for RustDesk." - value: ${{ jobs.build-sciter.outputs.output_folder }} -jobs: - build-sciter: - runs-on: windows-2019 - outputs: - output_folder: ${{ steps.build.outputs.output_folder }} - steps: - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ inputs.job.target }} - override: true - profile: minimal # minimal component installation (ie, no documentation) - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: ${{ matrix.job.os }}-sciter - - - name: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 - with: - setupOnly: true - vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - - - name: Install vcpkg dependencies - run: | - $VCPKG_ROOT/vcpkg install libvpx:x86-windows-static libyuv:x86-windows-static opus:x86-windows-static - shell: bash - - - name: Build rustdesk - id: build - shell: bash - run: | - python3 res/inline-sciter.py - # Replace the link for the ico. - cp flutter/windows/runner/resources/app_icon.ico res/icon.ico - cargo build --features inline --target=${{ matrix.job.target }} --release - mkdir -p ./Release - mv ./target/release/rustdesk.exe ./Release/rustdesk.exe - wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll - echo "output_folder=./Release" >> $GITHUB_OUTPUT diff --git a/src/ui.rs b/src/ui.rs index f7419cd34..8f9d14c54 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -54,6 +54,18 @@ pub fn start(args: &mut [String]) { let dir = "/usr"; sciter::set_library(&(prefix + dir + "/lib/rustdesk/libsciter-gtk.so")).ok(); } + #[cfg(windows)] + // Check if there is a sciter.dll nearby. + if let Ok(exe) = std::env::current_exe() { + if let Some(parent) = exe.parent() { + let sciter_dll_path = parent.join("sciter.dll"); + if sciter_dll_path.exists() { + // Try to set the sciter dll. + let p = sciter_dll_path.to_string_lossy().to_string(); + println!("Found dll:{}, \n {:?}", p, sciter::set_library(&p)); + } + } + } // https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-types.h // https://github.com/rustdesk/rustdesk/issues/132#issuecomment-886069737 #[cfg(windows)] From b8d8bf0a09061043f2b1d98a4ad5bafcf3c2fc43 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Mon, 27 Mar 2023 15:26:20 +0800 Subject: [PATCH 3/6] opt: use cross to build armv7 --- .github/workflows/flutter-nightly.yml | 100 +++++++++++++++++++++++-- .github/workflows/vcpkg-deps-linux.yml | 36 ++++----- Cargo.lock | 4 +- Cross.toml | 21 ++++++ build.py | 51 ++++++++++++- res/install-rust-deps-arm.sh | 11 +++ 6 files changed, 190 insertions(+), 33 deletions(-) create mode 100644 Cross.toml create mode 100644 res/install-rust-deps-arm.sh diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index e9fd70568..f798459e1 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -182,7 +182,7 @@ jobs: rm res/icon.ico && cp flutter/windows/runner/resources/app_icon.ico res/icon.ico cargo build --features inline --target=${{ matrix.job.target }} --release mkdir -p ./Release - mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + mv ./target/${{ matrix.job.target }}/release/rustdesk.exe ./Release/rustdesk.exe wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll echo "output_folder=./Release" >> $GITHUB_OUTPUT @@ -716,7 +716,7 @@ jobs: # use-cross: true, # extra-build-features: "", # } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" } + # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } steps: - name: Maximize build space @@ -846,11 +846,11 @@ jobs: cargo build --lib --features flutter,${{ matrix.job.extra-build-features }} --release ;; armv7) - cp -r /opt/artifacts/vcpkg/installed/lib/* /usr/lib/arm-linux-gnueabihf/ - cp -r /opt/artifacts/vcpkg/installed/include/* /usr/include/ - mkdir -p /vcpkg/installed/arm-linux - ln -s /usr/lib/arm-linux-gnueabihf /vcpkg/installed/arm-linux/lib - ln -s /usr/include /vcpkg/installed/arm-linux/include + # cp -r /opt/artifacts/vcpkg/installed/lib/* /usr/lib/arm-linux-gnueabihf/ + # cp -r /opt/artifacts/vcpkg/installed/include/* /usr/include/ + # mkdir -p /vcpkg/installed/arm-linux + # ln -s /usr/lib/arm-linux-gnueabihf /vcpkg/installed/arm-linux/lib + # ln -s /usr/include /vcpkg/installed/arm-linux/include export VCPKG_ROOT=/vcpkg # disable hwcodec for compilation cargo build --lib --features flutter,${{ matrix.job.extra-build-features }} --release @@ -863,6 +863,90 @@ jobs: name: librustdesk-${{ matrix.job.arch }}-${{ matrix.job.extra-build-features }}.so path: target/release/liblibrustdesk.so + build-rustdesk-sciter-arm: + needs: [build-vcpkg-deps-linux] + name: build-rustdesk(sciter) ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] + runs-on: ${{ matrix.job.os }} + strategy: + fail-fast: false + matrix: + # use a high level qemu-user-static + job: + - { + arch: armv7, + target: arm-unknown-linux-gnueabihf, + deb-arch: armhf, + os: ubuntu-latest, + use-cross: true, + extra-build-features: "", + } + # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } + # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } + steps: + + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: rustdesk-lib-cache + key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} + cache-directories: "/opt/rust-registry" + + - name: Restore vcpkg files + uses: actions/download-artifact@master + with: + name: vcpkg-artifact-${{ matrix.job.arch }} + path: /opt/artifacts/vcpkg/installed + + - name: Install cross tool + run: | + wget https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-gnu.tar.gz + tar -zxvf cross-x86_64-unknown-linux-gnu.tar.gz + mv cross* /usr/local/bin/ + + - name: Build RustDesk + env: + ARCH: ${{ matrix.job.deb-arch }} + VCPKG_ROOT: /opt/artifacts/vcpkg + run: | + python3 ./res/inline-sciter.py + cross build --target ${{ matrix.job.target }} --features inline --release + wget -O ./target/${{ matrix.job.target }}/release/libsciter-gtk.so https://github.com/c-smile/sciter-sdk/blob/master/bin.lnx/arm32/libsciter-gtk.so + ./build.py --package ./target/${{ matrix.job.target }}/release + + - name: Rename rustdesk + shell: bash + run: | + for name in rustdesk*??.deb; do + # 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 + if: ${{ matrix.job.extra-build-features == '' }} + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + + - name: Upload Artifact + uses: actions/upload-artifact@master + if: ${{ contains(matrix.job.extra-build-features, 'flatpak') }} + with: + name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + path: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + build-rustdesk-linux-arm: needs: [build-rustdesk-lib-linux-arm] name: build-rustdesk ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] @@ -893,7 +977,7 @@ jobs: # extra-build-features: "flatpak", # } # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "" } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" } + # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } steps: - name: Checkout source code diff --git a/.github/workflows/vcpkg-deps-linux.yml b/.github/workflows/vcpkg-deps-linux.yml index 89381114a..8eee01011 100644 --- a/.github/workflows/vcpkg-deps-linux.yml +++ b/.github/workflows/vcpkg-deps-linux.yml @@ -10,7 +10,7 @@ jobs: fail-fast: true matrix: job: - # - { arch: armv7, os: ubuntu-20.04 } + - { arch: armv7, os: ubuntu-20.04 } - { arch: x86_64, os: ubuntu-20.04 } - { arch: aarch64, os: ubuntu-20.04 } steps: @@ -46,12 +46,12 @@ jobs: wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null apt update -y apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev + cmake --version + gcc -v ;; aarch64|armv7) - apt install -y curl zip unzip tar git cmake g++ gcc build-essential pkg-config wget nasm yasm ninja-build libjpeg8-dev automake libtool + apt install -y curl zip unzip git esac - cmake --version - gcc -v run: | # disable git safe.directory git config --global --add safe.directory "*" @@ -65,25 +65,19 @@ jobs: ./bootstrap-vcpkg.sh ./vcpkg install libvpx libyuv opus ;; - aarch64|armv7) + aarch64) pushd /artifacts - # libyuv - git clone https://chromium.googlesource.com/libyuv/libyuv || true - pushd libyuv - git pull - mkdir -p build - pushd build + rm -rf rustdesk_thirdparty_lib + git clone https://github.com/Kingtous/rustdesk_thirdparty_lib.git --depth=1 mkdir -p /artifacts/vcpkg/installed - cmake .. -DCMAKE_INSTALL_PREFIX=/artifacts/vcpkg/installed - make -j4 && make install - popd - popd - # libopus, ubuntu 18.04 prebuilt is not be compiled with -fPIC - wget -O opus.tar.gz http://archive.ubuntu.com/ubuntu/pool/main/o/opus/opus_1.1.2.orig.tar.gz - tar -zxvf opus.tar.gz; ls -l - pushd opus-1.1.2 - ./autogen.sh; ./configure --prefix=/artifacts/vcpkg/installed - make -j4; make install + mv ./rustdesk_thirdparty_lib/vcpkg/installed/arm64-linux /artifacts/vcpkg/installed/arm64-linux + ;; + armv7) + pushd /artifacts + rm -rf rustdesk_thirdparty_lib + git clone https://github.com/Kingtous/rustdesk_thirdparty_lib.git --depth=1 + mkdir -p /artifacts/vcpkg/installed + mv ./rustdesk_thirdparty_lib/vcpkg/installed/arm-linux /artifacts/vcpkg/installed/arm-linux ;; esac - name: Upload artifacts diff --git a/Cargo.lock b/Cargo.lock index 6fdb513e4..908f32a8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4674,7 +4674,7 @@ dependencies = [ [[package]] name = "rdev" version = "0.5.0-2" -source = "git+https://github.com/fufesou/rdev#89d2cb5c4bac81da4aafaedcf78af6af7c80c9d0" +source = "git+https://github.com/fufesou/rdev#aeea78dec3e731dd616da09668bbbd835a773d6c" dependencies = [ "cocoa", "core-foundation 0.9.3", @@ -5885,7 +5885,7 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "tfc" version = "0.6.1" -source = "git+https://github.com/fufesou/The-Fat-Controller#1dba9a39c089ac9a7853b9dd5399c1d4aa3157d3" +source = "git+https://github.com/fufesou/The-Fat-Controller#9dd86151525fd010dc93f6bc9b6aedd1a75cc342" dependencies = [ "anyhow", "core-graphics 0.22.3", diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 000000000..952e753a2 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,21 @@ +[build] +build-std = false # do not build the std library. has precedence over xargo +xargo = true # enable the use of xargo by default +# zig = false # do not use zig cc for the builds +default-target = "x86_64-unknown-linux-gnu" # use this target if none is explicitly provided + +[build.env] +volumes = ["VCPKG_ROOT"] # "VOL2_ARG=/path/to/volume" +passthrough = ["VCPKG_ROOT"] + +[target.aarch64-unknown-linux-gnu] +# pre-build = ["env ARCH=arm64 ./res/install-rust-deps.sh"] +# build-std = false # always build the std library. has precedence over xargo +# xargo = false # disable the use of xargo +# image = "test-image" # use a different image for the target +# runner = "qemu-user" # wrapper to run the binary (must be `qemu-system`, `qemu-user`, or `native`). + +[target.arm-unknown-linux-gnueabihf] +pre-build = "./res/install-rust-deps-arm.sh" +# volumes = ["VCPKG_ROOT"] # "VOL2_ARG=/path/to/volume" +# passthrough = ["VCPKG_ROOT"] \ No newline at end of file diff --git a/build.py b/build.py index 4a39f596d..7acf97a7d 100755 --- a/build.py +++ b/build.py @@ -18,6 +18,12 @@ exe_path = 'target/release/' + hbb_name flutter_win_target_dir = 'flutter/build/windows/runner/Release/' skip_cargo = False +def get_arch() -> str: + custom_arch = os.environ.get("ARCH") + if custom_arch is None: + return "amd64" + return custom_arch + def system2(cmd): err = os.system(cmd) if err != 0: @@ -106,6 +112,10 @@ def make_parser(): action='store_true', help='Skip cargo build process, only flutter version + Linux supported currently' ) + parser.add_argument( + "--package", + type=str + ) return parser @@ -251,13 +261,13 @@ def generate_control_file(version): content = """Package: rustdesk Version: %s -Architecture: amd64 +Architecture: %s Maintainer: open-trade Homepage: https://rustdesk.com Depends: 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 Description: A remote control software. -""" % version +""" % (version, get_arch()) file = open(control_file_path, "w") file.write(content) file.close() @@ -307,6 +317,39 @@ def build_flutter_deb(version, features): os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version) os.chdir("..") +def build_deb_from_folder(version, binary_folder): + os.chdir('flutter') + system2('mkdir -p tmpdeb/usr/bin/') + system2('mkdir -p tmpdeb/usr/lib/rustdesk') + system2('mkdir -p tmpdeb/usr/share/rustdesk/files/systemd/') + system2('mkdir -p tmpdeb/usr/share/applications/') + system2('mkdir -p tmpdeb/usr/share/polkit-1/actions') + system2('rm tmpdeb/usr/bin/rustdesk || true') + system2( + f'cp -r ../{binary_folder}/* tmpdeb/usr/lib/rustdesk/') + system2( + 'cp ../res/rustdesk.service tmpdeb/usr/share/rustdesk/files/systemd/') + system2( + 'cp ../res/128x128@2x.png tmpdeb/usr/share/rustdesk/files/rustdesk.png') + system2( + 'cp ../res/rustdesk.desktop tmpdeb/usr/share/applications/rustdesk.desktop') + system2( + 'cp ../res/rustdesk-link.desktop tmpdeb/usr/share/applications/rustdesk-link.desktop') + system2( + 'cp ../res/com.rustdesk.RustDesk.policy tmpdeb/usr/share/polkit-1/actions/') + system2( + "echo \"#!/bin/sh\" >> tmpdeb/usr/share/rustdesk/files/polkit && chmod a+x tmpdeb/usr/share/rustdesk/files/polkit") + + system2('mkdir -p tmpdeb/DEBIAN') + generate_control_file(version) + system2('cp -a ../res/DEBIAN/* tmpdeb/DEBIAN/') + md5_file('usr/share/rustdesk/files/systemd/rustdesk.service') + system2('dpkg-deb -b tmpdeb rustdesk.deb;') + + system2('/bin/rm -rf tmpdeb/') + system2('/bin/rm -rf ../res/DEBIAN/control') + os.rename('rustdesk.deb', '../rustdesk-%s.deb' % version) + os.chdir("..") def build_flutter_dmg(version, features): if not skip_cargo: @@ -381,6 +424,10 @@ def main(): if args.skip_cargo: skip_cargo = True portable = args.portable + package = args.package + if package: + build_deb_from_folder(version, package) + return if windows: # build virtual display dynamic library os.chdir('libs/virtual_display/dylib') diff --git a/res/install-rust-deps-arm.sh b/res/install-rust-deps-arm.sh new file mode 100644 index 000000000..14cf772fd --- /dev/null +++ b/res/install-rust-deps-arm.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# apt-get install -y git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libclang-dev llvm-dev pkg-config g++ gcc libvpx-dev + +# For developers in China, we use sources from ustc. +# sed -i 's/archive.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list +# sed -i 's/security.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list + +dpkg --add-architecture armhf + +apt update -y +apt install -y libdbus-1-dev:armhf pkg-config nasm yasm libglib2.0-dev:armhf libxcb-randr0-dev:armhf libxdo-dev:armhf libxfixes-dev:armhf libxcb-shape0-dev:armhf libxcb-xfixes0-dev:armhf libasound2-dev:armhf libpulse-dev:armhf libgstreamer1.0-dev:armhf libgstreamer-plugins-base1.0-dev:armhf libappindicator3-dev:armhf libvpx-dev:armhf libvdpau-dev:armhf libva-dev:armhf libgtk-3-dev:armhf clang gcc libclang-dev From 67821f1d42b9f6b007f6b8ca6bf2af6576b8c40c Mon Sep 17 00:00:00 2001 From: Kingtous Date: Tue, 28 Mar 2023 00:54:09 +0800 Subject: [PATCH 4/6] fix: change to run on arch opt: use windows latest for sciter --- .github/workflows/flutter-nightly.yml | 136 +++++++++++++++++--------- 1 file changed, 91 insertions(+), 45 deletions(-) diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index f798459e1..642869da1 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -180,7 +180,7 @@ jobs: python3 res/inline-sciter.py # Replace the link for the ico. rm res/icon.ico && cp flutter/windows/runner/resources/app_icon.ico res/icon.ico - cargo build --features inline --target=${{ matrix.job.target }} --release + cargo build --features inline --target=${{ matrix.job.target }} --release --bins mkdir -p ./Release mv ./target/${{ matrix.job.target }}/release/rustdesk.exe ./Release/rustdesk.exe wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll @@ -711,12 +711,12 @@ jobs: # - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" } # - { # arch: armv7, - # target: arm-unknown-linux-gnueabihf, + # target: armv7-unknown-linux-gnueabihf, # os: ubuntu-20.04, # use-cross: true, # extra-build-features: "", # } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } + # - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } steps: - name: Maximize build space @@ -832,30 +832,8 @@ jobs: cat ~/.cargo/config # start build pushd /workspace - # mock - case "${{ matrix.job.arch }}" in - aarch64) - cp -r /opt/artifacts/vcpkg/installed/lib/* /usr/lib/aarch64-linux-gnu/ - cp -r /opt/artifacts/vcpkg/installed/include/* /usr/include/ - ls -l /opt/artifacts/vcpkg/installed/lib/ - mkdir -p /vcpkg/installed/arm64-linux - ln -s /usr/lib/aarch64-linux-gnu /vcpkg/installed/arm64-linux/lib - ln -s /usr/include /vcpkg/installed/arm64-linux/include - export VCPKG_ROOT=/vcpkg - # disable hwcodec for compilation - cargo build --lib --features flutter,${{ matrix.job.extra-build-features }} --release - ;; - armv7) - # cp -r /opt/artifacts/vcpkg/installed/lib/* /usr/lib/arm-linux-gnueabihf/ - # cp -r /opt/artifacts/vcpkg/installed/include/* /usr/include/ - # mkdir -p /vcpkg/installed/arm-linux - # ln -s /usr/lib/arm-linux-gnueabihf /vcpkg/installed/arm-linux/lib - # ln -s /usr/include /vcpkg/installed/arm-linux/include - export VCPKG_ROOT=/vcpkg - # disable hwcodec for compilation - cargo build --lib --features flutter,${{ matrix.job.extra-build-features }} --release - ;; - esac + export VCPKG_ROOT=/opt/artifacts/vcpkg + cargo build --lib --features flutter,${{ matrix.job.extra-build-features }} --release - name: Upload Artifacts uses: actions/upload-artifact@master @@ -874,19 +852,36 @@ jobs: job: - { arch: armv7, - target: arm-unknown-linux-gnueabihf, + target: armv7-unknown-linux-gnueabihf, deb-arch: armhf, os: ubuntu-latest, use-cross: true, extra-build-features: "", } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } + # - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } steps: + - name: Maximize build space + run: | + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + sudo apt update -y + sudo apt install qemu-user-static + - name: Checkout source code uses: actions/checkout@v3 + - name: Set Swap Space + uses: pierotofy/set-swap-space@master + with: + swap-size-gb: 12 + + - name: Free Space + run: | + df + - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: @@ -901,27 +896,78 @@ jobs: key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} cache-directories: "/opt/rust-registry" + - name: Install local registry + run: | + mkdir -p /opt/rust-registry + cargo install cargo-local-registry + + - name: Build local registry + uses: nick-fields/retry@v2 + id: build-local-registry + continue-on-error: true + with: + max_attempts: 3 + timeout_minutes: 15 + retry_on: error + command: cargo local-registry --sync ./Cargo.lock /opt/rust-registry + - name: Restore vcpkg files uses: actions/download-artifact@master with: name: vcpkg-artifact-${{ matrix.job.arch }} path: /opt/artifacts/vcpkg/installed - - name: Install cross tool - run: | - wget https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-gnu.tar.gz - tar -zxvf cross-x86_64-unknown-linux-gnu.tar.gz - mv cross* /usr/local/bin/ + - uses: Kingtous/run-on-arch-action@amd64-support + name: Build rustdesk sciter binary for ${{ matrix.job.arch }} + id: vcpkg + with: + arch: ${{ matrix.job.arch }} + distro: ubuntu18.04-rustdesk + githubToken: ${{ github.token }} + setup: | + ls -l "${PWD}" + dockerRunArgs: | + --volume "${PWD}:/workspace" + --volume "/opt/artifacts:/opt/artifacts" + --volume "/opt/rust-registry:/opt/rust-registry" + shell: /bin/bash + install: | + apt update -y + apt-get -qq install -y git cmake g++ gcc build-essential nasm yasm curl unzip xz-utils python3 wget pkg-config ninja-build pkg-config libgtk-3-dev liblzma-dev clang libappindicator3-dev rpm libclang-dev + apt-get -qq install -y libdbus-1-dev pkg-config nasm yasm libglib2.0-dev libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev + apt-get -qq install -y libpulse-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvpx-dev libvdpau-dev libva-dev + run: | + # disable git safe.directory + git config --global --add safe.directory "*" + # rust + pushd /opt + wget -O rust.tar.gz https://static.rust-lang.org/dist/rust-1.64.0-${{ matrix.job.target }}.tar.gz + tar -zxvf rust.tar.gz > /dev/null && rm rust.tar.gz + cd rust-1.64.0-${{ matrix.job.target }} && ./install.sh + rm -rf rust-1.64.0-${{ matrix.job.target }} + # edit config + mkdir -p ~/.cargo/ + echo """ + [source.crates-io] + registry = 'https://github.com/rust-lang/crates.io-index' + replace-with = 'local-registry' - - name: Build RustDesk - env: - ARCH: ${{ matrix.job.deb-arch }} - VCPKG_ROOT: /opt/artifacts/vcpkg - run: | - python3 ./res/inline-sciter.py - cross build --target ${{ matrix.job.target }} --features inline --release - wget -O ./target/${{ matrix.job.target }}/release/libsciter-gtk.so https://github.com/c-smile/sciter-sdk/blob/master/bin.lnx/arm32/libsciter-gtk.so - ./build.py --package ./target/${{ matrix.job.target }}/release + [source.local-registry] + local-registry = '/opt/rust-registry/' + """ > ~/.cargo/config + cat ~/.cargo/config + + # build + pushd /workspace + python3 ./res/inline-sciter.py + export VCPKG_ROOT=/opt/artifacts/vcpkg + export ARCH=armhf + cargo build --features inline --release --bins + # package + mkdir -p ./Release + mv ./target/release/rustdesk ./Release/rustdesk + wget -O ./Release/libsciter-gtk.so https://github.com/c-smile/sciter-sdk/raw/master/bin.lnx/arm32/libsciter-gtk.so + ./build.py --package ./Release - name: Rename rustdesk shell: bash @@ -976,8 +1022,8 @@ jobs: # use-cross: true, # extra-build-features: "flatpak", # } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "" } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } + # - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "" } + # - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } steps: - name: Checkout source code From fffeda30a30a6f34cb8ddce6286c580f2a22b4d8 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Tue, 28 Mar 2023 17:08:51 +0800 Subject: [PATCH 5/6] feat: reuse nightly --- .github/workflows/flutter-ci.yml | 898 +------------------------- .github/workflows/flutter-nightly.yml | 41 +- 2 files changed, 35 insertions(+), 904 deletions(-) diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml index 428d538bf..14027f9f8 100644 --- a/.github/workflows/flutter-ci.yml +++ b/.github/workflows/flutter-ci.yml @@ -16,897 +16,9 @@ on: - "docs/**" - "README.md" -env: - LLVM_VERSION: "15.0.6" - FLUTTER_VERSION: "3.7.5" - # vcpkg version: 2022.05.10 - # for multiarch gcc compatibility - VCPKG_COMMIT_ID: "14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44" - VERSION: "1.2.0" - NDK_VERSION: "r23" - jobs: - build-for-windows-flutter: - name: ${{ matrix.job.target }} (${{ matrix.job.os }}) - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: true - matrix: - job: - # - { target: i686-pc-windows-msvc , os: windows-2019 } - # - { target: x86_64-pc-windows-gnu , os: windows-2019 } - - { target: x86_64-pc-windows-msvc, os: windows-2019 } - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v1 - with: - version: ${{ env.LLVM_VERSION }} - - - name: Install flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - flutter-version: ${{ env.FLUTTER_VERSION }} - cache: true - - - name: Replace engine with rustdesk custom flutter engine - run: | - flutter doctor -v - flutter precache --windows - Invoke-WebRequest -Uri https://github.com/Kingtous/engine/releases/download/v3.7.0-rustdesk/windows-x64-release-flutter.zip -OutFile windows-x64-flutter-release.zip - Expand-Archive windows-x64-flutter-release.zip -DestinationPath engine - mv -Force engine/* C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/ - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.job.target }} - override: true - components: rustfmt - profile: minimal # minimal component installation (ie, no documentation) - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: ${{ matrix.job.os }} - - - name: Install flutter rust bridge deps - run: | - cargo install flutter_rust_bridge_codegen - Push-Location flutter ; flutter pub get ; Pop-Location - ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart - - - name: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 - with: - setupOnly: true - vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - - - name: Install vcpkg dependencies - run: | - $VCPKG_ROOT/vcpkg install libvpx:x64-windows-static libyuv:x64-windows-static opus:x64-windows-static - shell: bash - - - name: Build rustdesk - run: python3 .\build.py --portable --hwcodec --flutter - - # The fallback for the flutter version, we use Sciter for 32bit Windows. - build-for-windows-sciter: - name: ${{ matrix.job.target }} (${{ matrix.job.os }}) - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: false - matrix: - job: - # - { target: i686-pc-windows-msvc , os: windows-2019 } - # - { target: x86_64-pc-windows-gnu , os: windows-2019 } - - { target: i686-pc-windows-msvc, os: windows-2019 } - # - { target: aarch64-pc-windows-msvc, os: windows-2019 } - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.job.target }} - override: true - profile: minimal # minimal component installation (ie, no documentation) - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: ${{ matrix.job.os }}-sciter - - - name: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 - with: - setupOnly: true - vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - - - name: Install vcpkg dependencies - run: | - $VCPKG_ROOT/vcpkg install libvpx:x86-windows-static libyuv:x86-windows-static opus:x86-windows-static - shell: bash - - - name: Build rustdesk - id: build - shell: bash - run: | - python3 res/inline-sciter.py - # Replace the link for the ico. - rm res/icon.ico && cp flutter/windows/runner/resources/app_icon.ico res/icon.ico - cargo build --features inline --target=${{ matrix.job.target }} --release - mkdir -p ./Release - mv ./target/release/rustdesk.exe ./Release/rustdesk.exe - wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll - echo "output_folder=./Release" >> $GITHUB_OUTPUT - - - name: Sign rustdesk files - uses: GermanBluefox/code-sign-action@v7 - with: - certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' - password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' - certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' - # certificatename: '${{ secrets.CERTNAME }}' - folder: './Release/' - recursive: true - - - name: Build self-extracted executable - shell: bash - run: | - pushd ./libs/portable - python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe - popd - mkdir -p ./SignOutput - mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}.exe - - - name: Sign rustdesk self-extracted file - uses: GermanBluefox/code-sign-action@v7 - with: - certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' - password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' - certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' - # certificatename: '${{ secrets.WINDOWS_PFX_NAME }}' - folder: './SignOutput' - recursive: false - - - name: Publish Release - uses: softprops/action-gh-release@v1 - with: - prerelease: true - tag_name: ${{ env.TAG_NAME }} - files: | - ./SignOutput/rustdesk-*.exe - - build-for-macOS: - name: ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-args }}] - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: true - matrix: - job: - - { - target: x86_64-apple-darwin, - os: macos-latest, - extra-build-args: "", - } - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Install build runtime - run: | - brew install llvm create-dmg nasm yasm cmake gcc wget ninja pkg-config - - - name: Install flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - flutter-version: ${{ env.FLUTTER_VERSION }} - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.job.target }} - override: true - profile: minimal # minimal component installation (ie, no documentation) - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: ${{ matrix.job.os }} - - - name: Install flutter rust bridge deps - shell: bash - run: | - cargo install flutter_rust_bridge_codegen - pushd flutter && flutter pub get && popd - ~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart - - - name: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 - with: - setupOnly: true - vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - - - name: Install vcpkg dependencies - run: | - $VCPKG_ROOT/vcpkg install libvpx libyuv opus - - - name: Show version information (Rust, cargo, Clang) - shell: bash - run: | - clang --version || true - rustup -V - rustup toolchain list - rustup default - cargo -V - rustc -V - - - name: Build rustdesk - run: | - # --hwcodec not supported on macos yet - ./build.py --flutter ${{ matrix.job.extra-build-args }} - - build-vcpkg-deps-linux: - uses: ./.github/workflows/vcpkg-deps-linux.yml - - generate-bridge-linux: - uses: ./.github/workflows/bridge.yml - - build-rustdesk-android: - needs: [generate-bridge-linux] - name: build rustdesk android apk ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: true - matrix: - job: - - { - arch: x86_64, - target: aarch64-linux-android, - os: ubuntu-20.04, - extra-build-features: "", - openssl-arch: android-arm64 - } - - { - arch: x86_64, - target: armv7-linux-androideabi, - os: ubuntu-18.04, - extra-build-features: "", - openssl-arch: android-arm - } - steps: - - name: Install dependencies - run: | - sudo apt update - sudo apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config tree g++ libc6-dev gcc-multilib g++-multilib openjdk-11-jdk-headless - - name: Checkout source code - uses: actions/checkout@v3 - - name: Install flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - flutter-version: ${{ env.FLUTTER_VERSION }} - - uses: nttld/setup-ndk@v1 - id: setup-ndk - with: - ndk-version: ${{ env.NDK_VERSION }} - add-to-path: true - - - name: Clone deps - shell: bash - run: | - pushd /opt - git clone https://github.com/Kingtous/rustdesk_thirdparty_lib.git --depth=1 - - - name: Restore bridge files - uses: actions/download-artifact@master - with: - name: bridge-artifact - path: ./ - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - profile: minimal # minimal component installation (ie, no documentation) - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rustdesk-lib-cache - key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} - - - name: Disable rust bridge build - run: | - sed -i "s/gen_flutter_rust_bridge();/\/\//g" build.rs - - - name: Build rustdesk lib - env: - ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} - VCPKG_ROOT: /opt/rustdesk_thirdparty_lib/vcpkg - run: | - rustup target add ${{ matrix.job.target }} - cargo install cargo-ndk - case ${{ matrix.job.target }} in - aarch64-linux-android) - ./flutter/ndk_arm64.sh - mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a - cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so - ;; - armv7-linux-androideabi) - ./flutter/ndk_arm.sh - mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a - cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so - ;; - esac - - - name: Build rustdesk - shell: bash - env: - JAVA_HOME: /usr/lib/jvm/java-11-openjdk-amd64 - run: | - export PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH - # temporary use debug sign config - sed -i "s/signingConfigs.release/signingConfigs.debug/g" ./flutter/android/app/build.gradle - case ${{ matrix.job.target }} in - aarch64-linux-android) - mkdir -p ./flutter/android/app/src/main/jniLibs/arm64-v8a - cp /opt/rustdesk_thirdparty_lib/android/app/src/main/jniLibs/arm64-v8a/*.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/ - cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/arm64-v8a/librustdesk.so - # build flutter - pushd flutter - flutter build apk --release --target-platform android-arm64 --split-per-abi - mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release.apk - ;; - armv7-linux-androideabi) - mkdir -p ./flutter/android/app/src/main/jniLibs/armeabi-v7a - cp /opt/rustdesk_thirdparty_lib/android/app/src/main/jniLibs/armeabi-v7a/*.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/ - cp ./target/${{ matrix.job.target }}/release/liblibrustdesk.so ./flutter/android/app/src/main/jniLibs/armeabi-v7a/librustdesk.so - # build flutter - pushd flutter - flutter build apk --release --target-platform android-arm --split-per-abi - mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ../rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release.apk - ;; - esac - popd - mkdir -p signed-apk; pushd signed-apk - mv ../rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release.apk . - - build-rustdesk-lib-linux-amd64: - needs: [generate-bridge-linux, build-vcpkg-deps-linux] - name: build-rust-lib ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: true - matrix: - # use a high level qemu-user-static - job: - # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } - - { - arch: x86_64, - target: x86_64-unknown-linux-gnu, - os: ubuntu-20.04, - extra-build-features: "", - } - - { - arch: x86_64, - target: x86_64-unknown-linux-gnu, - 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 - run: | - sudo rm -rf /opt/ghc - sudo rm -rf /usr/local/lib/android - sudo rm -rf /usr/share/dotnet - sudo apt update -y - sudo apt install qemu-user-static - - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 12 - - - name: Free Space - run: | - df - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.job.target }} - override: true - profile: minimal # minimal component installation (ie, no documentation) - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rustdesk-lib-cache - key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} - cache-directories: "/opt/rust-registry" - - - name: Install local registry - run: | - mkdir -p /opt/rust-registry - cargo install cargo-local-registry - - - name: Build local registry - uses: nick-fields/retry@v2 - id: build-local-registry - continue-on-error: true - with: - max_attempts: 3 - timeout_minutes: 15 - retry_on: error - command: cargo local-registry --sync ./Cargo.lock /opt/rust-registry - - - name: Disable rust bridge build - run: | - sed -i "s/gen_flutter_rust_bridge();/\/\//g" build.rs - # only build cdylib - sed -i "s/\[\"cdylib\", \"staticlib\", \"rlib\"\]/\[\"cdylib\"\]/g" Cargo.toml - - - name: Restore bridge files - uses: actions/download-artifact@master - with: - name: bridge-artifact - path: ./ - - - name: Restore vcpkg files - uses: actions/download-artifact@master - with: - name: vcpkg-artifact-${{ matrix.job.arch }} - path: /opt/artifacts/vcpkg/installed - - - uses: Kingtous/run-on-arch-action@amd64-support - name: Build rustdesk library for ${{ matrix.job.arch }} - id: vcpkg - with: - arch: ${{ matrix.job.arch }} - distro: ubuntu18.04 - # not ready yet - # distro: ubuntu18.04-rustdesk - githubToken: ${{ github.token }} - setup: | - ls -l "${PWD}" - ls -l /opt/artifacts/vcpkg/installed - dockerRunArgs: | - --volume "${PWD}:/workspace" - --volume "/opt/artifacts:/opt/artifacts" - --volume "/opt/rust-registry:/opt/rust-registry" - shell: /bin/bash - install: | - apt update -y - echo -e "installing deps" - apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config tree g++ gcc libvpx-dev tree > /dev/null - # we have libopus compiled by us. - apt remove -y libopus-dev || true - # output devs - ls -l ./ - tree -L 3 /opt/artifacts/vcpkg/installed - run: | - # disable git safe.directory - git config --global --add safe.directory "*" - # rust - pushd /opt - wget -O rust.tar.gz https://static.rust-lang.org/dist/rust-1.64.0-${{ matrix.job.target }}.tar.gz - tar -zxvf rust.tar.gz > /dev/null && rm rust.tar.gz - cd rust-1.64.0-${{ matrix.job.target }} && ./install.sh - rm -rf rust-1.64.0-${{ matrix.job.target }} - # edit config - mkdir -p ~/.cargo/ - echo """ - [source.crates-io] - registry = 'https://github.com/rust-lang/crates.io-index' - replace-with = 'local-registry' - - [source.local-registry] - local-registry = '/opt/rust-registry/' - """ > ~/.cargo/config - cat ~/.cargo/config - # start build - pushd /workspace - # mock - case "${{ matrix.job.arch }}" in - x86_64) - # no need mock on x86_64 - export VCPKG_ROOT=/opt/artifacts/vcpkg - cargo build --lib --features hwcodec,flutter,flutter_texture_render,${{ matrix.job.extra-build-features }} --release - ;; - esac - - - name: Upload Artifacts - uses: actions/upload-artifact@master - with: - name: librustdesk-${{ matrix.job.arch }}-${{ matrix.job.extra-build-features }}.so - path: target/release/liblibrustdesk.so - - build-rustdesk-lib-linux-arm: - needs: [generate-bridge-linux, build-vcpkg-deps-linux] - name: build-rust-lib ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] - runs-on: ${{ matrix.job.os }} - strategy: - fail-fast: true - matrix: - # use a high level qemu-user-static - job: - - { - arch: aarch64, - target: aarch64-unknown-linux-gnu, - os: ubuntu-20.04, - use-cross: true, - extra-build-features: "", - } - - { - arch: aarch64, - target: aarch64-unknown-linux-gnu, - os: ubuntu-18.04, # just for naming package, not running host - use-cross: true, - extra-build-features: "appimage", - } - # - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" } - # - { - # arch: armv7, - # target: arm-unknown-linux-gnueabihf, - # os: ubuntu-20.04, - # use-cross: true, - # extra-build-features: "", - # } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" } - # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } - steps: - - name: Maximize build space - run: | - sudo rm -rf /opt/ghc - sudo rm -rf /usr/local/lib/android - sudo rm -rf /usr/share/dotnet - sudo apt update -y - sudo apt install qemu-user-static - - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 12 - - - name: Free Space - run: | - df - - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ matrix.job.target }} - override: true - profile: minimal # minimal component installation (ie, no documentation) - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: rustdesk-lib-cache - key: ${{ matrix.job.target }}-${{ matrix.job.extra-build-features }} - cache-directories: "/opt/rust-registry" - - - name: Install local registry - run: | - mkdir -p /opt/rust-registry - cargo install cargo-local-registry - - - name: Build local registry - uses: nick-fields/retry@v2 - id: build-local-registry - continue-on-error: true - with: - max_attempts: 3 - timeout_minutes: 15 - retry_on: error - command: cargo local-registry --sync ./Cargo.lock /opt/rust-registry - - - name: Disable rust bridge build - run: | - sed -i "s/gen_flutter_rust_bridge();/\/\//g" build.rs - # only build cdylib - sed -i "s/\[\"cdylib\", \"staticlib\", \"rlib\"\]/\[\"cdylib\"\]/g" Cargo.toml - - - name: Restore bridge files - uses: actions/download-artifact@master - with: - name: bridge-artifact - path: ./ - - - name: Restore vcpkg files - uses: actions/download-artifact@master - with: - name: vcpkg-artifact-${{ matrix.job.arch }} - path: /opt/artifacts/vcpkg/installed - - - uses: Kingtous/run-on-arch-action@amd64-support - name: Build rustdesk library for ${{ matrix.job.arch }} - id: vcpkg - with: - arch: ${{ matrix.job.arch }} - distro: ubuntu18.04-rustdesk - githubToken: ${{ github.token }} - setup: | - ls -l "${PWD}" - ls -l /opt/artifacts/vcpkg/installed - dockerRunArgs: | - --volume "${PWD}:/workspace" - --volume "/opt/artifacts:/opt/artifacts" - --volume "/opt/rust-registry:/opt/rust-registry" - shell: /bin/bash - install: | - apt update -y - echo -e "installing deps" - apt-get -qq install -y git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libclang-dev llvm-dev libclang-10-dev llvm-10-dev pkg-config tree g++ gcc libvpx-dev tree > /dev/null - # we have libopus compiled by us. - apt remove -y libopus-dev || true - # output devs - ls -l ./ - tree -L 3 /opt/artifacts/vcpkg/installed - run: | - # disable git safe.directory - git config --global --add safe.directory "*" - # rust - pushd /opt - wget -O rust.tar.gz https://static.rust-lang.org/dist/rust-1.64.0-${{ matrix.job.target }}.tar.gz - tar -zxvf rust.tar.gz > /dev/null && rm rust.tar.gz - cd rust-1.64.0-${{ matrix.job.target }} && ./install.sh - rm -rf rust-1.64.0-${{ matrix.job.target }} - # edit config - mkdir -p ~/.cargo/ - echo """ - [source.crates-io] - registry = 'https://github.com/rust-lang/crates.io-index' - replace-with = 'local-registry' - - [source.local-registry] - local-registry = '/opt/rust-registry/' - """ > ~/.cargo/config - cat ~/.cargo/config - # start build - pushd /workspace - # mock - case "${{ matrix.job.arch }}" in - aarch64) - cp -r /opt/artifacts/vcpkg/installed/lib/* /usr/lib/aarch64-linux-gnu/ - cp -r /opt/artifacts/vcpkg/installed/include/* /usr/include/ - ls -l /opt/artifacts/vcpkg/installed/lib/ - mkdir -p /vcpkg/installed/arm64-linux - ln -s /usr/lib/aarch64-linux-gnu /vcpkg/installed/arm64-linux/lib - ln -s /usr/include /vcpkg/installed/arm64-linux/include - export VCPKG_ROOT=/vcpkg - # disable hwcodec for compilation - cargo build --lib --features flutter,flutter_texture_render,${{ matrix.job.extra-build-features }} --release - ;; - armv7) - cp -r /opt/artifacts/vcpkg/installed/lib/* /usr/lib/arm-linux-gnueabihf/ - cp -r /opt/artifacts/vcpkg/installed/include/* /usr/include/ - mkdir -p /vcpkg/installed/arm-linux - ln -s /usr/lib/arm-linux-gnueabihf /vcpkg/installed/arm-linux/lib - ln -s /usr/include /vcpkg/installed/arm-linux/include - export VCPKG_ROOT=/vcpkg - # disable hwcodec for compilation - cargo build --lib --features flutter,flutter_texture_render,${{ matrix.job.extra-build-features }} --release - ;; - esac - - - name: Upload Artifacts - uses: actions/upload-artifact@master - with: - name: librustdesk-${{ matrix.job.arch }}-${{ matrix.job.extra-build-features }}.so - path: target/release/liblibrustdesk.so - - build-rustdesk-linux-arm: - needs: [build-rustdesk-lib-linux-arm] - name: build-rustdesk ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] - runs-on: ubuntu-20.04 # 20.04 has more performance on arm build - strategy: - fail-fast: true - matrix: - job: - - { - arch: aarch64, - target: aarch64-unknown-linux-gnu, - os: ubuntu-18.04, # just for naming package, not running host - use-cross: true, - extra-build-features: "", - } - - { - arch: aarch64, - target: aarch64-unknown-linux-gnu, - os: ubuntu-18.04, # just for naming package, not running host - use-cross: true, - extra-build-features: "appimage", - } - # - { - # arch: aarch64, - # target: aarch64-unknown-linux-gnu, - # os: ubuntu-18.04, # just for naming package, not running host - # use-cross: true, - # extra-build-features: "flatpak", - # } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "" } - # - { arch: armv7, target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" } - # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - - name: Restore bridge files - uses: actions/download-artifact@master - with: - name: bridge-artifact - path: ./ - - - name: Prepare env - run: | - sudo apt update -y - 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 - uses: actions/download-artifact@master - with: - name: librustdesk-${{ matrix.job.arch }}-${{ matrix.job.extra-build-features }}.so - path: ./target/release/ - - - name: Download Flutter - shell: bash - run: | - # disable git safe.directory - git config --global --add safe.directory "*" - pushd /opt - # clone repo and reset to flutter 3.7.0 - git clone https://github.com/sony/flutter-elinux.git || true - pushd flutter-elinux - # reset to flutter 3.7.0 - git fetch - git reset --hard 51a1d685901f79fbac51665a967c3a1a789ecee5 - popd - - - uses: Kingtous/run-on-arch-action@amd64-support - name: Build rustdesk binary for ${{ matrix.job.arch }} - id: vcpkg - with: - arch: ${{ matrix.job.arch }} - distro: ubuntu18.04-rustdesk - githubToken: ${{ github.token }} - setup: | - ls -l "${PWD}" - dockerRunArgs: | - --volume "${PWD}:/workspace" - --volume "/opt/artifacts:/opt/artifacts" - --volume "/opt/flutter-elinux:/opt/flutter-elinux" - shell: /bin/bash - install: | - apt update -y - apt-get -qq install -y git cmake g++ gcc build-essential nasm yasm curl unzip xz-utils python3 wget pkg-config ninja-build pkg-config libgtk-3-dev liblzma-dev clang libappindicator3-dev rpm - run: | - # disable git safe.directory - git config --global --add safe.directory "*" - pushd /workspace - # we use flutter-elinux to build our rustdesk - export PATH=/opt/flutter-elinux/bin:$PATH - sed -i "s/flutter build linux --release/flutter-elinux build linux/g" ./build.py - # Setup flutter-elinux. Run doctor to check if issues here. - flutter-elinux doctor -v - # Patch arm64 engine for flutter 3.6.0+ - flutter-elinux precache --linux - pushd /tmp - curl -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.7.0-stable.tar.xz - tar -xvf flutter_linux_3.7.0-stable.tar.xz flutter/bin/cache/artifacts/engine/linux-x64/shader_lib - cp -R flutter/bin/cache/artifacts/engine/linux-x64/shader_lib /opt/flutter-elinux/flutter/bin/cache/artifacts/engine/linux-arm64 - popd - case ${{ matrix.job.arch }} in - aarch64) - sed -i "s/Architecture: amd64/Architecture: arm64/g" ./build.py - sed -i "s/x64\/release/arm64\/release/g" ./build.py - ;; - armv7) - sed -i "s/Architecture: amd64/Architecture: arm/g" ./build.py - sed -i "s/x64\/release/arm\/release/g" ./build.py - ;; - esac - python3 ./build.py --flutter --hwcodec --skip-cargo - - build-rustdesk-linux-amd64: - needs: [build-rustdesk-lib-linux-amd64] - name: build-rustdesk ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-features }}] - runs-on: ubuntu-20.04 - strategy: - fail-fast: true - matrix: - job: - # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } - - { - arch: x86_64, - target: x86_64-unknown-linux-gnu, - os: ubuntu-20.04, - extra-build-features: "", - } - - { - arch: x86_64, - target: x86_64-unknown-linux-gnu, - 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: Checkout source code - uses: actions/checkout@v3 - - - name: Restore bridge files - uses: actions/download-artifact@master - with: - name: bridge-artifact - path: ./ - - - name: Prepare env - run: | - sudo apt update -y - 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 - uses: actions/download-artifact@master - with: - name: librustdesk-${{ matrix.job.arch }}-${{ matrix.job.extra-build-features }}.so - path: ./target/release/ - - - uses: Kingtous/run-on-arch-action@amd64-support - name: Build rustdesk binary for ${{ matrix.job.arch }} - id: vcpkg - with: - arch: ${{ matrix.job.arch }} - distro: ubuntu18.04 - githubToken: ${{ github.token }} - setup: | - ls -l "${PWD}" - dockerRunArgs: | - --volume "${PWD}:/workspace" - --volume "/opt/artifacts:/opt/artifacts" - shell: /bin/bash - install: | - apt update -y - apt-get -qq install -y git cmake g++ gcc build-essential nasm yasm curl unzip xz-utils python3 wget pkg-config ninja-build pkg-config libgtk-3-dev liblzma-dev clang libappindicator3-dev rpm - run: | - # disable git safe.directory - git config --global --add safe.directory "*" - # Setup Flutter - pushd /opt - wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz - tar xf flutter_linux_${{ env.FLUTTER_VERSION }}-stable.tar.xz - ls -l . - export PATH=/opt/flutter/bin:$PATH - flutter doctor -v - pushd /workspace - python3 ./build.py --flutter --hwcodec --skip-cargo + run-ci: + uses: ./.github/workflows/flutter-nightly.yml + with: + upload-artifact: false + \ No newline at end of file diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 642869da1..08dd6bb4d 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -5,6 +5,16 @@ on: # schedule build every night - cron: "0 0 * * *" workflow_dispatch: + inputs: + upload-artifact: + description: "Upload the artifact produced by this workflow to the Release page." + type: boolean + default: true + workflow_call: + inputs: + upload-artifact: + type: boolean + default: true env: LLVM_VERSION: "15.0.6" @@ -21,6 +31,7 @@ env: # To make a custom build with your own servers set the below secret values RS_PUB_KEY: '${{ secrets.RS_PUB_KEY }}' RENDEZVOUS_SERVER: '${{ secrets.RENDEZVOUS_SERVER }}' + UPLOAD_ARTIFACT: '${{ inputs.upload-artifact }}' jobs: build-for-windows-flutter: @@ -92,6 +103,7 @@ jobs: - name: Sign rustdesk files uses: GermanBluefox/code-sign-action@v7 + if: env.UPLOAD_ARTIFACT == 'true' with: certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' @@ -102,6 +114,7 @@ jobs: - name: Build self-extracted executable shell: bash + if: env.UPLOAD_ARTIFACT == 'true' run: | pushd ./libs/portable python3 ./generate.py -f ../../flutter/build/windows/runner/Release/ -o . -e ../../flutter/build/windows/runner/Release/rustdesk.exe @@ -118,6 +131,7 @@ jobs: - name: Sign rustdesk self-extracted file uses: GermanBluefox/code-sign-action@v7 + if: env.UPLOAD_ARTIFACT == 'true' with: certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' @@ -128,6 +142,7 @@ jobs: - name: Publish Release uses: softprops/action-gh-release@v1 + if: env.UPLOAD_ARTIFACT == 'true' with: prerelease: true tag_name: ${{ env.TAG_NAME }} @@ -188,6 +203,7 @@ jobs: - name: Sign rustdesk files uses: GermanBluefox/code-sign-action@v7 + if: env.UPLOAD_ARTIFACT == 'true' with: certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' @@ -217,6 +233,7 @@ jobs: - name: Publish Release uses: softprops/action-gh-release@v1 + if: env.UPLOAD_ARTIFACT == 'true' with: prerelease: true tag_name: ${{ env.TAG_NAME }} @@ -351,6 +368,7 @@ jobs: done - name: Publish DMG package + if: env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -500,14 +518,14 @@ jobs: BUILD_TOOLS_VERSION: "30.0.2" - name: Upload Artifacts - if: env.ANDROID_SIGNING_KEY != null + if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true' uses: actions/upload-artifact@master with: name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-release-signed.apk path: ${{steps.sign-rustdesk.outputs.signedReleaseFile}} - name: Publish signed apk package - if: env.ANDROID_SIGNING_KEY != null + if: env.ANDROID_SIGNING_KEY != null && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -516,7 +534,7 @@ jobs: ${{steps.sign-rustdesk.outputs.signedReleaseFile}} - name: Publish unsigned apk package - if: env.ANDROID_SIGNING_KEY == null + if: env.ANDROID_SIGNING_KEY == null && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -978,7 +996,7 @@ jobs: done - name: Publish debian package - if: ${{ matrix.job.extra-build-features == '' }} + if: ${{ matrix.job.extra-build-features == '' }} && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -1151,7 +1169,7 @@ jobs: done - name: Publish debian package - if: ${{ matrix.job.extra-build-features == '' }} + if: ${{ matrix.job.extra-build-features == '' }} && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -1174,7 +1192,7 @@ jobs: sudo appimage-builder --skip-tests --recipe ./AppImageBuilder-${{ matrix.job.arch }}.yml - name: Publish appimage package - if: ${{ matrix.job.extra-build-features == 'appimage' }} + if: ${{ matrix.job.extra-build-features == 'appimage' }} && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -1248,7 +1266,7 @@ jobs: # res/rustdesk*.zst - name: Publish fedora28/centos8 package - if: ${{ matrix.job.extra-build-features == '' }} + if: ${{ matrix.job.extra-build-features == '' }} && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -1371,7 +1389,7 @@ jobs: done - name: Publish debian package - if: ${{ matrix.job.extra-build-features == '' }} + if: ${{ matrix.job.extra-build-features == '' }} && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -1427,7 +1445,7 @@ jobs: cd res && HBB=`pwd`/.. FLUTTER=1 makepkg -f - name: Publish archlinux package - if: ${{ matrix.job.extra-build-features == '' }} + if: ${{ matrix.job.extra-build-features == '' }} && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -1450,7 +1468,7 @@ jobs: sudo appimage-builder --skip-tests --recipe ./AppImageBuilder-x86_64.yml - name: Publish appimage package - if: ${{ matrix.job.extra-build-features == 'appimage' }} + if: ${{ matrix.job.extra-build-features == 'appimage' }} && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -1459,7 +1477,7 @@ jobs: ./appimage/rustdesk-${{ env.VERSION }}-*.AppImage - name: Publish fedora28/centos8 package - if: ${{ matrix.job.extra-build-features == '' }} + if: ${{ matrix.job.extra-build-features == '' }} && env.UPLOAD_ARTIFACT == 'true' uses: softprops/action-gh-release@v1 with: prerelease: true @@ -1588,6 +1606,7 @@ jobs: - name: Publish flatpak package uses: softprops/action-gh-release@v1 + if: env.UPLOAD_ARTIFACT == 'true' with: prerelease: true tag_name: ${{ env.TAG_NAME }} From d2b71b96c1548c0cb6feb4da83648c6c9feeedac Mon Sep 17 00:00:00 2001 From: Kingtous Date: Wed, 29 Mar 2023 09:38:24 +0800 Subject: [PATCH 6/6] feat: add llvm 32bit for sciter --- .github/workflows/flutter-nightly.yml | 30 +++++++++++++++++++-------- Cross.toml | 21 ------------------- res/install-rust-deps-arm.sh | 11 ---------- src/ui.rs | 2 +- 4 files changed, 22 insertions(+), 42 deletions(-) delete mode 100644 Cross.toml delete mode 100644 res/install-rust-deps-arm.sh diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 08dd6bb4d..4b2ccfc69 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -153,6 +153,8 @@ jobs: build-for-windows-sciter: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} + # Temporarily disable this action due to additional test is needed. + if: false strategy: fail-fast: false matrix: @@ -165,13 +167,22 @@ jobs: - name: Checkout source code uses: actions/checkout@v3 + - name: Install LLVM and Clang + uses: Kingtous/install-llvm-action-32bit@master + with: + version: ${{ env.LLVM_VERSION }} + - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: stable-${{ matrix.job.target }} target: ${{ matrix.job.target }} override: true profile: minimal # minimal component installation (ie, no documentation) + + - name: Set Rust toolchain to the target + run: | + rustup default stable-${{ matrix.job.target }} - uses: Swatinem/rust-cache@v2 with: @@ -195,10 +206,10 @@ jobs: python3 res/inline-sciter.py # Replace the link for the ico. rm res/icon.ico && cp flutter/windows/runner/resources/app_icon.ico res/icon.ico - cargo build --features inline --target=${{ matrix.job.target }} --release --bins + cargo build --features inline --release --bins mkdir -p ./Release - mv ./target/${{ matrix.job.target }}/release/rustdesk.exe ./Release/rustdesk.exe - wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll + mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll echo "output_folder=./Release" >> $GITHUB_OUTPUT - name: Sign rustdesk files @@ -216,10 +227,11 @@ jobs: shell: bash run: | pushd ./libs/portable + pip3 install -r requirements.txt python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe popd mkdir -p ./SignOutput - mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}.exe + mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-sciter.exe - name: Sign rustdesk self-extracted file uses: GermanBluefox/code-sign-action@v7 @@ -992,7 +1004,7 @@ jobs: run: | for name in rustdesk*??.deb; do # use cp to duplicate deb files to fit other packages. - cp "$name" "${name%%.deb}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb" + cp "$name" "${name%%.deb}-${{ matrix.job.target }}-${{ matrix.job.os }}-sciter.deb" done - name: Publish debian package @@ -1002,14 +1014,14 @@ jobs: prerelease: true tag_name: ${{ env.TAG_NAME }} files: | - rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}-sciter.deb - name: Upload Artifact uses: actions/upload-artifact@master if: ${{ contains(matrix.job.extra-build-features, 'flatpak') }} with: - name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb - path: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}-sciter.deb + path: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}-sciter.deb build-rustdesk-linux-arm: needs: [build-rustdesk-lib-linux-arm] diff --git a/Cross.toml b/Cross.toml deleted file mode 100644 index 952e753a2..000000000 --- a/Cross.toml +++ /dev/null @@ -1,21 +0,0 @@ -[build] -build-std = false # do not build the std library. has precedence over xargo -xargo = true # enable the use of xargo by default -# zig = false # do not use zig cc for the builds -default-target = "x86_64-unknown-linux-gnu" # use this target if none is explicitly provided - -[build.env] -volumes = ["VCPKG_ROOT"] # "VOL2_ARG=/path/to/volume" -passthrough = ["VCPKG_ROOT"] - -[target.aarch64-unknown-linux-gnu] -# pre-build = ["env ARCH=arm64 ./res/install-rust-deps.sh"] -# build-std = false # always build the std library. has precedence over xargo -# xargo = false # disable the use of xargo -# image = "test-image" # use a different image for the target -# runner = "qemu-user" # wrapper to run the binary (must be `qemu-system`, `qemu-user`, or `native`). - -[target.arm-unknown-linux-gnueabihf] -pre-build = "./res/install-rust-deps-arm.sh" -# volumes = ["VCPKG_ROOT"] # "VOL2_ARG=/path/to/volume" -# passthrough = ["VCPKG_ROOT"] \ No newline at end of file diff --git a/res/install-rust-deps-arm.sh b/res/install-rust-deps-arm.sh deleted file mode 100644 index 14cf772fd..000000000 --- a/res/install-rust-deps-arm.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -# apt-get install -y git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libvdpau-dev libva-dev libclang-dev llvm-dev pkg-config g++ gcc libvpx-dev - -# For developers in China, we use sources from ustc. -# sed -i 's/archive.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list -# sed -i 's/security.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list - -dpkg --add-architecture armhf - -apt update -y -apt install -y libdbus-1-dev:armhf pkg-config nasm yasm libglib2.0-dev:armhf libxcb-randr0-dev:armhf libxdo-dev:armhf libxfixes-dev:armhf libxcb-shape0-dev:armhf libxcb-xfixes0-dev:armhf libasound2-dev:armhf libpulse-dev:armhf libgstreamer1.0-dev:armhf libgstreamer-plugins-base1.0-dev:armhf libappindicator3-dev:armhf libvpx-dev:armhf libvdpau-dev:armhf libva-dev:armhf libgtk-3-dev:armhf clang gcc libclang-dev diff --git a/src/ui.rs b/src/ui.rs index 8f9d14c54..ca50fbf9d 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -62,7 +62,7 @@ pub fn start(args: &mut [String]) { if sciter_dll_path.exists() { // Try to set the sciter dll. let p = sciter_dll_path.to_string_lossy().to_string(); - println!("Found dll:{}, \n {:?}", p, sciter::set_library(&p)); + log::debug!("Found dll:{}, \n {:?}", p, sciter::set_library(&p)); } } }