diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b2f9471f9..6b2b707854 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -163,6 +163,34 @@ jobs: name: build-win64-intermediate path: release/work/build-win64/dist-tar/ + build-macos: + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + brew install meson ninja nasm libiconv zlib automake autoconf \ + libtool + + - name: Build macOS + run: release/build_macos.sh + + # upload-artifact does not preserve permissions + - name: Tar + run: | + cd release/work/build-macos + mkdir dist-tar + cd dist-tar + tar -C .. -cvf dist.tar.gz dist/ + + - name: Upload build-macos artifact + uses: actions/upload-artifact@v4 + with: + name: build-macos-intermediate + path: release/work/build-macos/dist-tar/ + package-linux: needs: - build-scrcpy-server @@ -271,6 +299,42 @@ jobs: name: release-win64 path: release/output + package-macos: + needs: + - build-scrcpy-server + - build-macos + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download scrcpy-server + uses: actions/download-artifact@v4 + with: + name: scrcpy-server + path: release/work/build-server/server/ + + - name: Download build-macos + uses: actions/download-artifact@v4 + with: + name: build-macos-intermediate + path: release/work/build-macos/dist-tar/ + + # upload-artifact does not preserve permissions + - name: Detar + run: | + cd release/work/build-macos + tar xf dist-tar/dist.tar.gz + + - name: Package macos + run: release/package_client.sh macos tar.gz + + - name: Upload macos release + uses: actions/upload-artifact@v4 + with: + name: release-macos + path: release/output/ + release: needs: - build-scrcpy-server diff --git a/app/deps/adb_macos.sh b/app/deps/adb_macos.sh new file mode 100755 index 0000000000..8a25915ee9 --- /dev/null +++ b/app/deps/adb_macos.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -ex +DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) +cd "$DEPS_DIR" +. common + +VERSION=35.0.2 +FILENAME=platform-tools_r$VERSION-darwin.zip +PROJECT_DIR=platform-tools-$VERSION-darwin +SHA256SUM=1820078db90bf21628d257ff052528af1c61bb48f754b3555648f5652fa35d78 + +cd "$SOURCES_DIR" + +if [[ -d "$PROJECT_DIR" ]] +then + echo "$PWD/$PROJECT_DIR" found +else + get_file "https://dl.google.com/android/repository/$FILENAME" "$FILENAME" "$SHA256SUM" + mkdir -p "$PROJECT_DIR" + cd "$PROJECT_DIR" + ZIP_PREFIX=platform-tools + unzip "../$FILENAME" "$ZIP_PREFIX"/adb + mv "$ZIP_PREFIX"/* . + rmdir "$ZIP_PREFIX" +fi + +mkdir -p "$INSTALL_DIR/adb-macos" +cd "$INSTALL_DIR/adb-macos" +cp -r "$SOURCES_DIR/$PROJECT_DIR"/. "$INSTALL_DIR/adb-macos/" diff --git a/release/build_macos.sh b/release/build_macos.sh new file mode 100755 index 0000000000..a42c7e8887 --- /dev/null +++ b/release/build_macos.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -ex +cd "$(dirname ${BASH_SOURCE[0]})" +. build_common +cd .. # root project dir + +MACOS_BUILD_DIR="$WORK_DIR/build-macos" + +app/deps/adb_macos.sh +app/deps/sdl.sh macos native static +app/deps/ffmpeg.sh macos native static +app/deps/libusb.sh macos native static + +DEPS_INSTALL_DIR="$PWD/app/deps/work/install/macos-native-static" +ADB_INSTALL_DIR="$PWD/app/deps/work/install/adb-macos" + +rm -rf "$MACOS_BUILD_DIR" +meson setup "$MACOS_BUILD_DIR" \ + --pkg-config-path="$DEPS_INSTALL_DIR/lib/pkgconfig" \ + -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 \ + -Dstatic=true +ninja -C "$MACOS_BUILD_DIR" + +# Group intermediate outputs into a 'dist' directory +mkdir -p "$MACOS_BUILD_DIR/dist" +cp "$MACOS_BUILD_DIR"/app/scrcpy "$MACOS_BUILD_DIR/dist/scrcpy_bin" +cp app/data/icon.png "$MACOS_BUILD_DIR/dist/" +cp app/data/scrcpy_static_wrapper.sh "$MACOS_BUILD_DIR/dist/scrcpy" +cp -r "$ADB_INSTALL_DIR"/. "$MACOS_BUILD_DIR/dist/" diff --git a/release/generate_checksums.sh b/release/generate_checksums.sh index 9cdf1aca92..73914ebdf1 100755 --- a/release/generate_checksums.sh +++ b/release/generate_checksums.sh @@ -8,5 +8,6 @@ sha256sum "scrcpy-server-$VERSION" \ "scrcpy-linux-$VERSION.zip" \ "scrcpy-win32-$VERSION.zip" \ "scrcpy-win64-$VERSION.zip" \ + "scrcpy-macos-$VERSION.zip" \ | tee SHA256SUMS.txt echo "Release checksums generated in $PWD/SHA256SUMS.txt"