Display and control your Android device
Build Windows ARM64 release
jgershgorin5d7f80b4c911
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 25575ba9..4edb2ec0 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -201,6 +201,80 @@ jobs:name: build-win64-intermediatepath: release/work/build-win64/dist-tar/+ build-winarm64:+ runs-on: windows-11-arm+ defaults:+ run:+ shell: 'msys2 {0}'+ steps:+ - name: Checkout code+ uses: actions/checkout@v6++ - name: Setup MSYS2+ uses: msys2/setup-msys2@v2+ with:+ msystem: CLANGARM64+ update: true+ install: >-+ base-devel+ unzip+ wget+ autoconf+ automake+ libtool+ mingw-w64-clang-aarch64-toolchain+ mingw-w64-clang-aarch64-gcc-compat+ mingw-w64-clang-aarch64-meson+ mingw-w64-clang-aarch64-ninja+ mingw-w64-clang-aarch64-cmake+ mingw-w64-clang-aarch64-zlib++ - name: Check architecture+ run: |+ # The MSYS2 tools run under x64 emulation on Windows ARM64, so+ # "uname -m" reports x86_64, but "uname -s" is suffixed with the+ # host machine+ sysname=$(uname -s)+ if [[ "$sysname" != *-ARM64 ]]+ then+ echo "Unexpected architecture: $sysname" >&2+ exit 1+ fi++ - name: Build+ run: release/build_windows.sh arm64++ - name: Check DLL dependencies+ run: |+ cd release/work/build-winarm64/dist+ imports=$(llvm-objdump -p scrcpy.exe *.dll | sed -n 's/^ *DLL Name: //p' | sort -u)+ echo "$imports"+ # The binaries must not depend on DLLs provided by the MSYS2+ # toolchain, which are not part of the release+ for dll in "$MINGW_PREFIX"/bin/*.dll+ do+ name=$(basename "$dll")+ if grep -qix "$name" <<< "$imports"+ then+ echo "Unexpected dependency on toolchain DLL: $name" >&2+ exit 1+ fi+ done++ # upload-artifact does not preserve permissions+ - name: Tar+ run: |+ cd release/work/build-winarm64+ mkdir dist-tar+ cd dist-tar+ tar -C .. -cvf dist.tar.gz dist/++ - name: Upload artifact+ uses: actions/upload-artifact@v7+ with:+ name: build-winarm64-intermediate+ path: release/work/build-winarm64/dist-tar/+build-macos-aarch64:runs-on: macos-lateststeps:@@ -395,6 +469,42 @@ jobs:name: release-win64path: release/output+ package-winarm64:+ needs:+ - build-scrcpy-server+ - build-winarm64+ runs-on: ubuntu-latest+ steps:+ - name: Checkout code+ uses: actions/checkout@v6++ - name: Download scrcpy-server+ uses: actions/download-artifact@v8+ with:+ name: scrcpy-server+ path: release/work/build-server/server/++ - name: Download build-winarm64+ uses: actions/download-artifact@v8+ with:+ name: build-winarm64-intermediate+ path: release/work/build-winarm64/dist-tar/++ # upload-artifact does not preserve permissions+ - name: Detar+ run: |+ cd release/work/build-winarm64+ tar xf dist-tar/dist.tar.gz++ - name: Package+ run: release/package_client.sh winarm64 zip++ - name: Upload release+ uses: actions/upload-artifact@v7+ with:+ name: release-winarm64+ path: release/output+package-macos-aarch64:needs:- build-scrcpy-server@@ -473,6 +583,7 @@ jobs:- package-linux-x86_64- package-win32- package-win64+ - package-winarm64- package-macos-aarch64- package-macos-x86_64runs-on: ubuntu-latest@@ -504,6 +615,12 @@ jobs:name: release-win64path: release/output/+ - name: Download release-winarm64+ uses: actions/download-artifact@v8+ with:+ name: release-winarm64+ path: release/output/+- name: Download release-macos-aarch64uses: actions/download-artifact@v8with:diff --git a/app/deps/_init b/app/deps/_initindex 4612d9fe..cfe0bef6 100644--- a/app/deps/_init+++ b/app/deps/_init@@ -3,7 +3,7 @@process_args() {if [[ $# != 3 ]]then- # <host>: linux, macos, win32 or win64+ # <host>: linux, macos, win32, win64 or winarm64# <build_type>: native or cross# <link_type>: static or sharedecho "Syntax: $0 <host> <build_type> <link_type>" >&2diff --git a/app/deps/adb_windows.sh b/app/deps/adb_windows.shindex 96c93eb7..9258f62b 100755--- a/app/deps/adb_windows.sh+++ b/app/deps/adb_windows.sh@@ -2,6 +2,9 @@set -ex. $(dirname ${BASH_SOURCE[0]})/_init "$@"+# Google only provides x86 Windows platform-tools, so the same adb.exe is used+# for all Windows targets (on Windows ARM64, it runs via emulation).+VERSION=37.0.0URL="https://dl.google.com/android/repository/platform-tools_r$VERSION-win.zip"SHA256SUM=4fe305812db074cea32903a489d061eb4454cbc90a49e8fea677f4b7af764918diff --git a/app/deps/ffmpeg.sh b/app/deps/ffmpeg.shindex 2d4007a9..599baa92 100755--- a/app/deps/ffmpeg.sh+++ b/app/deps/ffmpeg.sh@@ -136,6 +136,13 @@ elseecho "Unsupported host: $HOST" >&2exit 1esac+ elif [[ "$HOST" == winarm64 ]]+ then+ # Native Windows ARM64 build (MSYS2 CLANGARM64)+ conf+=(+ --target-os=mingw32+ --arch=aarch64+ )fi"$SOURCES_DIR/$PROJECT_DIR"/configure "${conf[@]}"diff --git a/release/build_windows.sh b/release/build_windows.shindex cbc177f0..4de02682 100755--- a/release/build_windows.sh+++ b/release/build_windows.sh@@ -4,12 +4,23 @@ set -excase "$1" in32)WINXX=win32+ BUILD_TYPE=cross;;64)WINXX=win64+ BUILD_TYPE=cross+ ;;+ arm64)+ # Contrary to the Windows x86 builds, which are cross-compiled from+ # Linux, the Windows ARM64 release is built natively on Windows:+ # cross-building from Linux would require a separate LLVM-based+ # toolchain.+ # See <https://github.com/Genymobile/scrcpy/pull/6857>+ WINXX=winarm64+ BUILD_TYPE=native;;*)- echo "ERROR: $0 must be called with one argument: 32 or 64" >&2+ echo "ERROR: $0 must be called with one argument: 32, 64 or arm64" >&2exit 1;;esac@@ -21,28 +32,35 @@ cd .. # root project dirWINXX_BUILD_DIR="$WORK_DIR/build-$WINXX"app/deps/adb_windows.sh-app/deps/sdl.sh $WINXX cross shared-app/deps/dav1d.sh $WINXX cross shared-app/deps/ffmpeg.sh $WINXX cross shared-app/deps/libusb.sh $WINXX cross shared+app/deps/sdl.sh $WINXX $BUILD_TYPE shared+app/deps/dav1d.sh $WINXX $BUILD_TYPE shared+app/deps/ffmpeg.sh $WINXX $BUILD_TYPE shared+app/deps/libusb.sh $WINXX $BUILD_TYPE shared-DEPS_INSTALL_DIR="$PWD/app/deps/work/install/$WINXX-cross-shared"+DEPS_INSTALL_DIR="$PWD/app/deps/work/install/$WINXX-$BUILD_TYPE-shared"ADB_INSTALL_DIR="$PWD/app/deps/work/install/adb-windows"# Never fall back to system libsunset PKG_CONFIG_PATHexport PKG_CONFIG_LIBDIR="$DEPS_INSTALL_DIR/lib/pkgconfig"-rm -rf "$WINXX_BUILD_DIR"-meson setup "$WINXX_BUILD_DIR" \- -Dc_args="-I$DEPS_INSTALL_DIR/include" \- -Dc_link_args="-L$DEPS_INSTALL_DIR/lib" \- --cross-file=cross_$WINXX.txt \- --buildtype=release \- --strip \- -Db_lto=true \- -Dcompile_server=false \+meson_args=(+ -Dc_args="-I$DEPS_INSTALL_DIR/include"+ -Dc_link_args="-L$DEPS_INSTALL_DIR/lib"+ --buildtype=release+ --strip+ -Db_lto=true+ -Dcompile_server=false-Dportable=true+)++if [[ "$BUILD_TYPE" == cross ]]+then+ meson_args+=(--cross-file=cross_$WINXX.txt)+fi++rm -rf "$WINXX_BUILD_DIR"+meson setup "$WINXX_BUILD_DIR" "${meson_args[@]}"ninja -C "$WINXX_BUILD_DIR"# Group intermediate outputs into a 'dist' directorydiff --git a/release/generate_checksums.sh b/release/generate_checksums.shindex 2785c6c3..05dc8a03 100755--- a/release/generate_checksums.sh+++ b/release/generate_checksums.sh@@ -8,6 +8,7 @@ sha256sum "scrcpy-server-$VERSION" \"scrcpy-linux-x86_64-$VERSION.tar.gz" \"scrcpy-win32-$VERSION.zip" \"scrcpy-win64-$VERSION.zip" \+ "scrcpy-winarm64-$VERSION.zip" \"scrcpy-macos-aarch64-$VERSION.tar.gz" \"scrcpy-macos-x86_64-$VERSION.tar.gz" \| tee SHA256SUMS.txt