From 6ec0b61c9a30f48084237a9a359c6090dcc3a441 Mon Sep 17 00:00:00 2001 From: Srevin Saju Date: Wed, 26 Aug 2020 16:06:00 +0300 Subject: [PATCH] :tada: Initial commit --- .github/workflows/continuous.yml | 110 +++++++++++++++++++++++++++++++ AppRun | 11 ++++ scrcpy.desktop | 9 +++ scrcpy.sh | 16 +++++ 4 files changed, 146 insertions(+) create mode 100644 .github/workflows/continuous.yml create mode 100755 AppRun create mode 100644 scrcpy.desktop create mode 100755 scrcpy.sh diff --git a/.github/workflows/continuous.yml b/.github/workflows/continuous.yml new file mode 100644 index 0000000..7e0b31b --- /dev/null +++ b/.github/workflows/continuous.yml @@ -0,0 +1,110 @@ +# +##MIT License +# +#Copyright (c) 2020 Srevin Saju +# +#Permission is hereby granted, free of charge, to any person obtaining a copy +#of this software and associated documentation files (the "Software"), to deal +#in the Software without restriction, including without limitation the rights +#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +#copies of the Software, and to permit persons to whom the Software is +#furnished to do so, subject to the following conditions: +# +#The above copyright notice and this permission notice shall be included in all +#copies or substantial portions of the Software. +# +#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +#SOFTWARE. +# +#----------------------------- +#This file is part of Zap AppImage Package Manager + +name: Continuous +on: + - push + +jobs: + centos: + runs-on: ubuntu-latest + container: + image: archlinux:latest + steps: + - uses: actions/checkout@v2 + - name: Set up User + run: | + pacman -Syu + pacman -S sudo + sed -i 's,# %wheel ALL=(ALL) ALL,%wheel\tALL=(ALL)\tNOPASSWD:ALL,g' /etc/sudoers + useradd -m github + usermod -aG wheel github + su - github + + - name: Install git + run: | + sudo pacman -S git wget curl jq unzip + sudo pacman -S gcc cmake pkgconf + sudo pacman -S meson sdl2 ffmpeg android-tools + + - name: Clone scrcpy + run: | + git clone https://github.com/Genymobile/scrcpy + cd scrcpy + wget $(curl https://api.github.com/repos/Genymobile/scrcpy/releases/latest | jq -r '.assets[].browser_download_url' | grep server) -O scrcpy_server + + + - name: Download adb + run: | + wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip + unzip platform-tools-latest-linux.zip + + - name: Build scrcpy + run: | + export SRC_ROOT=$(realpath .) + export ADB_DIR=$(realpath platform-tools) + cd scrcpy + meson x --buildtype release --strip -Db_lto=true -Dprebuilt_server=scrcpy_server + ninja -Cx + sudo ninja -Cx install + wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2) + https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage + chmod +x appimagetool-*.AppImage + chmod +x linuxdeploy-x86_64.AppImage + export APPIMAGE_EXTRACT_AND_RUN=1 + export BUILD_DIR=$(realpath x) + cp $SRC_ROOT/build.sh . + chmod +x build.sh + ./build.sh + mkdir -p dist + mv scrcpy*.AppImage dist/. + + - name: Upload Appimage + uses: actions/upload-artifact@v1.0.0 + with: + name: scrcpy-continuous-x86_64.AppImage + path: 'scrcpy/dist/' + + Release: + needs: [centos] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v1 + with: + name: scrcpy-continuous-x86_64.AppImage + + - name: Release + uses: marvinpinto/action-automatic-releases@latest + if: github.ref == 'refs/heads/master' + with: + automatic_release_tag: continuous + title: Scrcpy AppImage Release + prerelease: false + files: | + scrcpy-continuous-x86_64.AppImage + repo_token: ${{ secrets.GITHUB_TOKEN }} + + diff --git a/AppRun b/AppRun new file mode 100755 index 0000000..a6418fa --- /dev/null +++ b/AppRun @@ -0,0 +1,11 @@ +#!/bin/sh +# Export APPRUN if running from an extracted image +self="$(readlink -f -- $0)" +here="${self%/*}" +APPDIR="${APPDIR:-${here}}" + +export ADB="${APPDIR}/usr/bin/adb" +export SCRCPY_SERVER_PATH="${APPDIR}/usr/local/share/scrcpy/scrcpy-server" +export PATH="${APPDIR}/usr/bin:${PATH}" + +${APPDIR}/usr/bin/scrcpy diff --git a/scrcpy.desktop b/scrcpy.desktop new file mode 100644 index 0000000..a6567d8 --- /dev/null +++ b/scrcpy.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=scrcpy +Exec=scrcpy +Type=Application +Icon=scrcpy +Terminal=true +Categories=Development; +Keywords=Python;Screen;Mirroring;Android; +StartupWMClass=scrcpy diff --git a/scrcpy.sh b/scrcpy.sh new file mode 100755 index 0000000..07099de --- /dev/null +++ b/scrcpy.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -eu + +rm -rf AppDir +mkdir AppDir +export APPIMAGE_EXTRACT_AND_RUN=1 +./linuxdeploy*.AppImage -e /usr/local/bin/scrcpy --desktop-file $SRC_ROOT/scrcpy.desktop --icon-file $SRC_ROOT/scrcpy.png --appdir=AppDir --library=/usr/lib/libc.so.6 --library=/usr/lib64/ld-linux-x86-64.so.2 --custom-apprun=$SRC_ROOT/AppRun + +cp $BUILD_DIR/app/scrcpy AppDir/usr/bin/. +cp $ADB_DIR/adb AppDir/usr/bin/. + +mkdir -p AppDir/usr/local/share/scrcpy +cp $BUILD_DIR/../scrcpy_server AppDir/usr/local/share/scrcpy/scrcpy-server + +./appimage*.AppImage AppDir -s AppDir/usr/share/applications/scrcpy.desktop -l -o