opt: use cross to build armv7

This commit is contained in:
Kingtous
2023-03-27 15:26:20 +08:00
parent 260694fdaa
commit b8d8bf0a09
6 changed files with 190 additions and 33 deletions

View File

@@ -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

View File

@@ -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