mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-19 19:15:08 +00:00
Add script to release Linux static binary
Provide a prebuilt binary for Linux. Fixes #5327 <https://github.com/Genymobile/scrcpy/issues/5327> PR #5515 <https://github.com/Genymobile/scrcpy/pull/5515>
This commit is contained in:
parent
93da693e8c
commit
cb19686d79
8 changed files with 162 additions and 1 deletions
73
.github/workflows/release.yml
vendored
73
.github/workflows/release.yml
vendored
|
@ -67,6 +67,36 @@ jobs:
|
|||
- name: Test
|
||||
run: release/test_client.sh
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
|
||||
|
||||
- name: Build linux
|
||||
run: release/build_linux.sh
|
||||
|
||||
# upload-artifact does not preserve permissions
|
||||
- name: Tar
|
||||
run: |
|
||||
cd release/work/build-linux
|
||||
mkdir dist-tar
|
||||
cd dist-tar
|
||||
tar -C .. -cvf dist.tar.gz dist/
|
||||
|
||||
- name: Upload build-linux artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-linux-intermediate
|
||||
path: release/work/build-linux/dist-tar/
|
||||
|
||||
build-win32:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -135,6 +165,42 @@ jobs:
|
|||
name: build-win64-intermediate
|
||||
path: release/work/build-win64/dist-tar/
|
||||
|
||||
package-linux:
|
||||
needs:
|
||||
- build-scrcpy-server
|
||||
- build-linux
|
||||
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-linux
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: build-linux-intermediate
|
||||
path: release/work/build-linux/dist-tar/
|
||||
|
||||
# upload-artifact does not preserve permissions
|
||||
- name: Detar
|
||||
run: |
|
||||
cd release/work/build-linux
|
||||
tar xf dist-tar/dist.tar.gz
|
||||
|
||||
- name: Package linux
|
||||
run: release/package_client.sh linux tar.gz
|
||||
|
||||
- name: Upload linux release
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-linux
|
||||
path: release/output/
|
||||
|
||||
package-win32:
|
||||
needs:
|
||||
- build-scrcpy-server
|
||||
|
@ -210,6 +276,7 @@ jobs:
|
|||
release:
|
||||
needs:
|
||||
- build-scrcpy-server
|
||||
- package-linux
|
||||
- package-win32
|
||||
- package-win64
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -223,6 +290,12 @@ jobs:
|
|||
name: scrcpy-server
|
||||
path: release/work/build-server/server/
|
||||
|
||||
- name: Download release-linux
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: release-linux
|
||||
path: release/output/
|
||||
|
||||
- name: Download release-win32
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
|
|
6
app/data/scrcpy_static_wrapper.sh
Executable file
6
app/data/scrcpy_static_wrapper.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
cd "$(dirname ${BASH_SOURCE[0]})"
|
||||
export ADB="${ADB:-./adb}"
|
||||
export SCRCPY_SERVER_PATH="${SCRCPY_SERVER_PATH:-./scrcpy-server}"
|
||||
export SCRCPY_ICON_PATH="${SCRCPY_ICON_PATH:-./icon.png}"
|
||||
./scrcpy_bin "$@"
|
29
app/deps/adb_linux.sh
Executable file
29
app/deps/adb_linux.sh
Executable file
|
@ -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-linux.zip
|
||||
PROJECT_DIR=platform-tools-$VERSION-linux
|
||||
SHA256SUM=acfdcccb123a8718c46c46c059b2f621140194e5ec1ac9d81715be3d6ab6cd0a
|
||||
|
||||
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-linux"
|
||||
cd "$INSTALL_DIR/adb-linux"
|
||||
cp -r "$SOURCES_DIR/$PROJECT_DIR"/. "$INSTALL_DIR/adb-linux/"
|
|
@ -48,7 +48,6 @@ else
|
|||
--disable-swscale
|
||||
--disable-postproc
|
||||
--disable-avfilter
|
||||
--disable-avdevice
|
||||
--disable-network
|
||||
--disable-everything
|
||||
--disable-vulkan
|
||||
|
@ -74,6 +73,14 @@ else
|
|||
--enable-muxer=wav
|
||||
)
|
||||
|
||||
if [[ "$HOST" != linux ]]
|
||||
then
|
||||
# libavdevice is only used for V4L2 on Linux
|
||||
conf+=(
|
||||
--disable-avdevice
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ "$LINK_TYPE" == static ]]
|
||||
then
|
||||
conf+=(
|
||||
|
|
|
@ -38,6 +38,14 @@ else
|
|||
--prefix="$INSTALL_DIR/$DIRNAME"
|
||||
)
|
||||
|
||||
if [[ "$HOST" == linux ]]
|
||||
then
|
||||
conf+=(
|
||||
--enable-video-wayland
|
||||
--enable-video-x11
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ "$LINK_TYPE" == static ]]
|
||||
then
|
||||
conf+=(
|
||||
|
|
35
release/build_linux.sh
Executable file
35
release/build_linux.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
cd "$(dirname ${BASH_SOURCE[0]})"
|
||||
. build_common
|
||||
cd .. # root project dir
|
||||
|
||||
LINUX_BUILD_DIR="$WORK_DIR/build-linux"
|
||||
|
||||
app/deps/adb_linux.sh
|
||||
app/deps/sdl.sh linux native static
|
||||
app/deps/ffmpeg.sh linux native static
|
||||
app/deps/libusb.sh linux native static
|
||||
|
||||
DEPS_INSTALL_DIR="$PWD/app/deps/work/install/linux-native-static"
|
||||
ADB_INSTALL_DIR="$PWD/app/deps/work/install/adb-linux"
|
||||
|
||||
rm -rf "$LINUX_BUILD_DIR"
|
||||
meson setup "$LINUX_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 "$LINUX_BUILD_DIR"
|
||||
|
||||
# Group intermediate outputs into a 'dist' directory
|
||||
mkdir -p "$LINUX_BUILD_DIR/dist"
|
||||
cp "$LINUX_BUILD_DIR"/app/scrcpy "$LINUX_BUILD_DIR/dist/scrcpy_bin"
|
||||
cp app/data/icon.png "$LINUX_BUILD_DIR/dist/"
|
||||
cp app/data/scrcpy_static_wrapper.sh "$LINUX_BUILD_DIR/dist/scrcpy"
|
||||
cp -r "$ADB_INSTALL_DIR"/. "$LINUX_BUILD_DIR/dist/"
|
|
@ -5,6 +5,7 @@ cd "$(dirname ${BASH_SOURCE[0]})"
|
|||
|
||||
cd "$OUTPUT_DIR"
|
||||
sha256sum "scrcpy-server-$VERSION" \
|
||||
"scrcpy-linux-$VERSION.tar.gz" \
|
||||
"scrcpy-win32-$VERSION.zip" \
|
||||
"scrcpy-win64-$VERSION.zip" \
|
||||
| tee SHA256SUMS.txt
|
||||
|
|
|
@ -12,10 +12,12 @@ rm -rf output
|
|||
./build_server.sh
|
||||
./build_windows.sh 32
|
||||
./build_windows.sh 64
|
||||
./build_linux.sh
|
||||
|
||||
./package_server.sh
|
||||
./package_client.sh win32 zip
|
||||
./package_client.sh win64 zip
|
||||
./package_client.sh linux tar.gz
|
||||
|
||||
./generate_checksums.sh
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue