cross-arch scrcpy (#7647) (#7650)

* Start to fix scrcpy



* works on my machine

* Bump release

* cross-arch scrcpy

Branch of #6671, experimenting with cross-arch dependencies

* oop

* wtf

* add prebuilt bin option for now

see https://github.com/gradle/gradle/issues/35111

* Don't build the server package on x86

This is so we won't have conflicts since the server binary is noarch

* fix logic

* add appstream data

* add android sdk license to server subpackage

* classify as desktop app

---------





(cherry picked from commit 2302b73024)

Signed-off-by: Owen <owen@fyralabs.com>
Co-authored-by: Pornpipat Popum <cappy@cappuchino.xyz>
Co-authored-by: Owen <owen@fyralabs.com>
Co-authored-by: Owen Zimmerman <123591347+Owen-sz@users.noreply.github.com>
Co-authored-by: june-fish <git@june.fish>
This commit is contained in:
Raboneko
2025-11-24 05:04:29 -08:00
committed by GitHub
parent 156e5b0e73
commit 41d451eca6
+92 -7
View File
@@ -1,10 +1,34 @@
%global __requires_exclude_from %{_datadir}/%{name}/.*
%bcond_without server_prebuilt
%global appid com.genymobile.scrcpy
%global org com.genymobile
%global appstream_component desktop-application
# NOTE: We only do this on aarch64 to avoid
# duplicate build artifacts on x86_64
#
# If you are building this package locally,
# set --with server to cross-compile/bundle the server APK subpackage.
#
# The server APK is architecture independent.
%ifarch aarch64
%bcond_without server
%else
%bcond_with server
%endif
Name: scrcpy
Version: 3.3.3
Release: 1%?dist
Release: 2%?dist
Summary: Display and control your Android device
License: Apache-2.0
License: Apache-2.0 AND Proprietary
URL: https://github.com/Genymobile/scrcpy
Source0: %url/archive/refs/tags/v%version.tar.gz
Source1: https://developer.android.com/studio/terms.html
%if %{with server_prebuilt}
Source10: https://github.com/Genymobile/scrcpy/releases/download/v%{version}/scrcpy-server-v%{version}
%endif
Packager: madonuko <mado@fyralabs.com>
BuildRequires: meson ninja-build cmake nasm gcc
BuildRequires: pkgconfig(sdl2)
@@ -18,29 +42,78 @@ BuildRequires: pkgconfig(libv4l2)
BuildRequires: cmake(VulkanHeaders)
BuildRequires: vulkan-loader
BuildRequires: OpenCL-ICD-Loader
BuildRequires: python3-sdkmanager
Requires: %{name}-server
# Gradle here really wants Java 21-23 to work properly
# Java 25 breaks the build
BuildRequires: java-21-openjdk-devel
BuildConflicts: dkms-nvidia akmod-nvidia
Requires: android-tools
%description
This application mirrors Android devices (video and audio) connected via USB or TCP/IP and allows control using the computer's keyboard and mouse. It does not require root access or an app installed on the device. It works on Linux, Windows, and macOS.
%if %{with server}
%package server
# This package is architecture independent, it's
# an Android APK file.
Summary: Android server for %{name}
BuildArch: noarch
%description server
Android server for %{name}
%endif
%pkg_completion -Bz
%prep
%autosetup
mkdir -p /tmp/android_sdk
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk
export PATH=$JAVA_HOME/bin:$PATH
export ANDROID_SDK_ROOT=/tmp/android_sdk
sdkmanager --install tools --sdk_root /tmp/android_sdk
echo y | sdkmanager --license
%build
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk
export PATH=$JAVA_HOME/bin:$PATH
export WORK_DIR=$PWD/work
export OUTPUT_DIR=$PWD/output
%dnl #export CFLAGS="$(echo $CFLAGS | sed 's/-D_GNU_SOURCE[=1]*//g')"
%dnl #export CPPFLAGS="$(echo $CPPFLAGS | sed 's/-D_GNU_SOURCE[=1]*//g')"
export VERSION=v%version
export ANDROID_SDK_ROOT=/tmp/android_sdk
# TODO: Gradle 8.9 seems to have problems with Java
# 21-25, so we can't build the APK here at all
# For now, let's use the prebuilt server
# https://github.com/gradle/gradle/issues/35111
%if %{with server}
%if %{with server_prebuilt}
%meson -Dprebuilt_server=%{SOURCE10}
%else
%meson -Dcompile_server=true
%endif
%else
%meson -Dcompile_server=false
%endif
%meson \
-Dcompile_server=false \
-Dportable=false \
-Dstatic=false
%meson_build
rm -rf /tmp/android_sdk
%install
%meson_install
pushd "%_vpath_builddir"
%ninja_install
popd
ls -la
%if %{with server}
install -Dm 644 %{SOURCE1} %{buildroot}%{_datadir}/licenses/LICENSE.android-sdk-license
%endif
%terra_appstream
%files
%doc README.md
@@ -48,5 +121,17 @@ export VERSION=v%version
%_bindir/scrcpy
%_datadir/applications/scrcpy-console.desktop
%_datadir/applications/scrcpy.desktop
%_datadir/bash-completion/completions/scrcpy
%_iconsdir/hicolor/*/apps/scrcpy.png
%_metainfodir/%{appid}.metainfo.xml
%_mandir/man1/scrcpy.1.*
%if %{with server}
%files server
%license %{_datadir}/licenses/LICENSE.android-sdk-license
%_datadir/scrcpy/scrcpy-server
%endif
%changelog
* Thu Oct 02 2025 june-fish <june@fyralabs.com>
- fix android sdk bug