diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 639804d..8a1f926 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,9 +15,9 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - # Linux - build-linux: - name: Build on Ubuntu + # Linux x86_64 + build-linux-x86_64: + name: Build on Ubuntu 22.04 x86_64 runs-on: ubuntu-22.04 container: image: crossdesk/ubuntu22.04:latest @@ -71,6 +71,67 @@ jobs: name: crossdesk-linux-x86_64-${{ env.LEGAL_VERSION }} path: ${{ github.workspace }}/crossdesk-linux-x86_64-${{ env.LEGAL_VERSION }}.deb + # Linux arm64 + build-linux-arm64: + name: Build on Ubuntu 22.04 arm64 + runs-on: ubuntu-22.04-arm + strategy: + matrix: + include: + - arch: arm64 + image: crossdesk/ubuntu20.04-arm64v8:latest + package_script: ./scripts/linux/pkg_arm64.sh + container: + image: ${{ matrix.image }} + options: --user root + steps: + - name: Extract version number + id: version + run: | + VERSION="${GITHUB_REF##*/}" + VERSION_NUM="${VERSION#v}" + echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV + + - name: Set legal Debian version + shell: bash + id: set_deb_version + run: | + if [[ ! "${VERSION_NUM}" =~ ^[0-9] ]]; then + LEGAL_VERSION="0.0.0-${VERSION_NUM}" + else + LEGAL_VERSION="${VERSION_NUM}" + fi + echo "LEGAL_VERSION=${LEGAL_VERSION}" >> $GITHUB_ENV + + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Build CrossDesk + env: + CUDA_PATH: /usr/local/cuda + XMAKE_GLOBALDIR: /data + run: | + xmake b -vy --root crossdesk + + - name: Decode and save certificate + shell: bash + run: | + mkdir -p certs + echo "${{ secrets.CROSSDESK_CERT_BASE64 }}" | base64 --decode > certs/crossdesk.cn_root.crt + + - name: Package + run: | + chmod +x ${{ matrix.package_script }} + ${{ matrix.package_script }} ${LEGAL_VERSION} + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: crossdesk-linux-${{ matrix.arch }}-${{ env.LEGAL_VERSION }} + path: ${{ github.workspace }}/crossdesk-linux-${{ matrix.arch }}-${{ env.LEGAL_VERSION }}.deb + # macOS build-macos: name: Build on macOS @@ -224,7 +285,7 @@ jobs: release: name: Publish Release if: startsWith(github.ref, 'refs/tags/v') - needs: [build-linux, build-macos, build-windows] + needs: [build-linux-x86_64, build-linux-arm64, build-macos, build-windows] runs-on: ubuntu-latest steps: @@ -249,6 +310,7 @@ jobs: cp artifacts/crossdesk-macos-x86_64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-macos-x86_64-${{ steps.version.outputs.VERSION_NUM }}.pkg cp artifacts/crossdesk-macos-arm64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-macos-arm64-${{ steps.version.outputs.VERSION_NUM }}.pkg cp artifacts/crossdesk-linux-x86_64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-linux-x86_64-${{ steps.version.outputs.VERSION_NUM }}.deb + cp artifacts/crossdesk-linux-arm64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-linux-arm64-${{ steps.version.outputs.VERSION_NUM }}.deb cp artifacts/crossdesk-win-x86_64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-win-x86_64-${{ steps.version.outputs.VERSION_NUM }}.exe - name: Upload to Versioned GitHub Release diff --git a/.github/workflows/update-pages.yaml b/.github/workflows/update-pages.yaml index 7289449..2332846 100644 --- a/.github/workflows/update-pages.yaml +++ b/.github/workflows/update-pages.yaml @@ -34,6 +34,7 @@ jobs: sed -E -i "s/crossdesk-macos-x86_64-[0-9]+\.[0-9]+\.[0-9]+\.pkg/crossdesk-macos-x86_64-${VERSION_NUM}.pkg/g" index.html sed -E -i "s/crossdesk-macos-arm64-[0-9]+\.[0-9]+\.[0-9]+\.pkg/crossdesk-macos-arm64-${VERSION_NUM}.pkg/g" index.html sed -E -i "s/crossdesk-linux-x86_64-[0-9]+\.[0-9]+\.[0-9]+\.deb/crossdesk-linux-x86_64-${VERSION_NUM}.deb/g" index.html + sed -E -i "s/crossdesk-linux-arm64-[0-9]+\.[0-9]+\.[0-9]+\.deb/crossdesk-linux-arm64-${VERSION_NUM}.deb/g" index.html - name: Commit & Push changes run: | diff --git a/scripts/linux/pkg_arm64.sh b/scripts/linux/pkg_arm64.sh new file mode 100644 index 0000000..94c3b18 --- /dev/null +++ b/scripts/linux/pkg_arm64.sh @@ -0,0 +1,111 @@ +#!/bin/bash +set -e + +APP_NAME="CrossDesk" +APP_VERSION="$1" +ARCHITECTURE="arm64" # 改为 arm64 +MAINTAINER="Junkun Di " +DESCRIPTION="A simple cross-platform remote desktop client." + +DEB_DIR="$APP_NAME-$APP_VERSION" +DEBIAN_DIR="$DEB_DIR/DEBIAN" +BIN_DIR="$DEB_DIR/usr/local/bin" +CERT_SRC_DIR="$DEB_DIR/opt/$APP_NAME/certs" +ICON_DIR="$DEB_DIR/usr/share/icons/hicolor/256x256/apps" +DESKTOP_DIR="$DEB_DIR/usr/share/applications" + +rm -rf "$DEB_DIR" + +mkdir -p "$DEBIAN_DIR" "$BIN_DIR" "$CERT_SRC_DIR" "$ICON_DIR" "$DESKTOP_DIR" + +cp build/linux/arm64/release/crossdesk "$BIN_DIR" +cp certs/crossdesk.cn_root.crt "$CERT_SRC_DIR/crossdesk.cn_root.crt" +cp icons/crossdesk.png "$ICON_DIR/crossdesk.png" + +chmod +x "$BIN_DIR/crossdesk" + +cat > "$DEBIAN_DIR/control" << EOF +Package: $APP_NAME +Version: $APP_VERSION +Architecture: $ARCHITECTURE +Maintainer: $MAINTAINER +Description: $DESCRIPTION +Depends: libc6 (>= 2.29), libstdc++6 (>= 9), libx11-6, libxcb1, + libxcb-randr0, libxcb-xtest0, libxcb-xinerama0, libxcb-shape0, + libxcb-xkb1, libxcb-xfixes0, libxv1, libxtst6, libasound2, + libsndio7.0, libxcb-shm0, libpulse0 +Priority: optional +Section: utils +EOF + +cat > "$DESKTOP_DIR/$APP_NAME.desktop" << EOF +[Desktop Entry] +Version=$APP_VERSION +Name=$APP_NAME +Comment=$DESCRIPTION +Exec=/usr/local/bin/crossdesk +Icon=crossdesk +Terminal=false +Type=Application +Categories=Utility; +EOF + +cat > "$DEBIAN_DIR/postrm" << EOF +#!/bin/bash +# post-removal script for $APP_NAME + +set -e + +if [ "\$1" = "remove" ] || [ "\$1" = "purge" ]; then + rm -f /usr/local/bin/crossdesk + rm -f /usr/share/icons/hicolor/256x256/apps/crossdesk.png + rm -f /usr/share/applications/$APP_NAME.desktop + rm -rf /opt/$APP_NAME +fi + +exit 0 +EOF + +chmod +x "$DEBIAN_DIR/postrm" + +cat > "$DEBIAN_DIR/postinst" << 'EOF' +#!/bin/bash +set -e + +CERT_SRC="/opt/CrossDesk/certs" +CERT_FILE="crossdesk.cn_root.crt" + +for user_home in /home/*; do + [ -d "$user_home" ] || continue + username=$(basename "$user_home") + config_dir="$user_home/.config/CrossDesk/certs" + target="$config_dir/$CERT_FILE" + + if [ ! -f "$target" ]; then + mkdir -p "$config_dir" + cp "$CERT_SRC/$CERT_FILE" "$target" + chown -R "$username:$username" "$user_home/.config/CrossDesk" + echo "✔ Installed cert for $username at $target" + fi +done + +if [ -d "/root" ]; then + config_dir="/root/.config/CrossDesk/certs" + mkdir -p "$config_dir" + cp "$CERT_SRC/$CERT_FILE" "$config_dir/$CERT_FILE" + chown -R root:root /root/.config/CrossDesk +fi + +exit 0 +EOF + +chmod +x "$DEBIAN_DIR/postinst" + +dpkg-deb --build "$DEB_DIR" + +OUTPUT_FILE="crossdesk-linux-arm64-$APP_VERSION.deb" +mv "$DEB_DIR.deb" "$OUTPUT_FILE" + +rm -rf "$DEB_DIR" + +echo "✅ Deb package for $APP_NAME (ARM64) created successfully." \ No newline at end of file diff --git a/scripts/linux/pkg_x86_64.sh b/scripts/linux/pkg_x86_64.sh index 17130a0..f055bfa 100644 --- a/scripts/linux/pkg_x86_64.sh +++ b/scripts/linux/pkg_x86_64.sh @@ -1,14 +1,12 @@ #!/bin/bash set -e -# 配置变量 APP_NAME="CrossDesk" APP_VERSION="$1" ARCHITECTURE="amd64" MAINTAINER="Junkun Di " DESCRIPTION="A simple cross-platform remote desktop client." -# 目录结构 DEB_DIR="$APP_NAME-$APP_VERSION" DEBIAN_DIR="$DEB_DIR/DEBIAN" BIN_DIR="$DEB_DIR/usr/local/bin" @@ -16,25 +14,16 @@ CERT_SRC_DIR="$DEB_DIR/opt/$APP_NAME/certs" # 用于中转安装时分发 ICON_DIR="$DEB_DIR/usr/share/icons/hicolor/256x256/apps" DESKTOP_DIR="$DEB_DIR/usr/share/applications" -# 清理已有的打包文件夹 rm -rf "$DEB_DIR" -# 创建目录结构 mkdir -p "$DEBIAN_DIR" "$BIN_DIR" "$CERT_SRC_DIR" "$ICON_DIR" "$DESKTOP_DIR" -# 复制二进制文件 cp build/linux/x86_64/release/crossdesk "$BIN_DIR" - -# 复制证书文件(将来通过 postinst 拷贝到每个用户 XDG_CONFIG_HOME) cp certs/crossdesk.cn_root.crt "$CERT_SRC_DIR/crossdesk.cn_root.crt" - -# 复制图标文件 cp icons/crossdesk.png "$ICON_DIR/crossdesk.png" -# 设置可执行权限 chmod +x "$BIN_DIR/crossdesk" -# 创建 control 文件 cat > "$DEBIAN_DIR/control" << EOF Package: $APP_NAME Version: $APP_VERSION @@ -49,7 +38,6 @@ Priority: optional Section: utils EOF -# 创建 desktop 文件 cat > "$DESKTOP_DIR/$APP_NAME.desktop" << EOF [Desktop Entry] Version=$APP_VERSION @@ -62,7 +50,6 @@ Type=Application Categories=Utility; EOF -# 创建卸载脚本 postrm cat > "$DEBIAN_DIR/postrm" << EOF #!/bin/bash # post-removal script for $APP_NAME @@ -81,7 +68,6 @@ EOF chmod +x "$DEBIAN_DIR/postrm" -# 创建安装后脚本 postinst(拷贝证书到每个用户 XDG_CONFIG_HOME) cat > "$DEBIAN_DIR/postinst" << 'EOF' #!/bin/bash set -e @@ -89,7 +75,6 @@ set -e CERT_SRC="/opt/CrossDesk/certs" CERT_FILE="crossdesk.cn_root.crt" -# 处理每个普通用户的配置目录 for user_home in /home/*; do [ -d "$user_home" ] || continue username=$(basename "$user_home") @@ -104,7 +89,6 @@ for user_home in /home/*; do fi done -# 处理 root 用户(可选) if [ -d "/root" ]; then config_dir="/root/.config/CrossDesk/certs" mkdir -p "$config_dir" @@ -117,13 +101,11 @@ EOF chmod +x "$DEBIAN_DIR/postinst" -# 构建 .deb 包 dpkg-deb --build "$DEB_DIR" OUTPUT_FILE="crossdesk-linux-x86_64-$APP_VERSION.deb" mv "$DEB_DIR.deb" "$OUTPUT_FILE" -# 清理构建目录 rm -rf "$DEB_DIR" -echo "✅ Deb package for $APP_NAME created successfully." +echo "✅ Deb package for $APP_NAME created successfully." \ No newline at end of file diff --git a/thirdparty/minirtc b/thirdparty/minirtc index 0c2884c..a994632 160000 --- a/thirdparty/minirtc +++ b/thirdparty/minirtc @@ -1 +1 @@ -Subproject commit 0c2884cc1d9f86922cedd0de248d60e730c2e9ca +Subproject commit a994632740d809a473a2bfa115e9564d668eedac