File scrcpy.spec of Package scrcpy
#
# spec file for package scrcpy
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define srv_sha256 %(sed -n -e 's/^\\([0-9a-z]\\{64\\}\\) scrcpy-server-v.*/\\1/p' %{SOURCE1})
%define srv_info Use %{_bindir}/%{name}-update-server (root/sudo) to download/update\
the required pre-build %{_datadir}/%{name}/%{name}-server binary.
Name: scrcpy
Version: 3.3.2
Release: 0
Summary: Display and control your Android device
License: Apache-2.0
URL: https://github.com/Genymobile/scrcpy
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: %{url}/releases/download/v%{version}/SHA256SUMS.txt
Source2: %{url}/releases/download/v%{version}/SHA256SUMS.txt.asc
Source3: https://blog.rom1v.com/keys/rom1v.asc#/%{name}.keyring
# based on https://salsa.debian.org/yangfl-guest/scrcpy/-/blob/master/debian/scrcpy-update-server
# Copyright: 2019-2025 Yangfl <mmyangfl@gmail.com>
# License: Apache-2
Source4: %{name}-update-server
BuildRequires: desktop-file-utils
BuildRequires: hicolor-icon-theme
BuildRequires: meson >= 0.48
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavdevice)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libusb-1.0)
BuildRequires: pkgconfig(sdl2)
Requires: (curl or wget)
Requires: android-tools
Provides: %{name}-bash-completion = %{version}
Obsoletes: %{name}-bash-completion < %{version}
Provides: %{name}-zsh-completion = %{version}
Obsoletes: %{name}-zsh-completion < %{version}
%if 0%{?suse_version} < 1600
BuildRequires: gcc11
BuildRequires: gcc11-PIE
%else
BuildRequires: gcc
%endif
%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.
%{srv_info}
%prep
%autosetup -p1
sed -e 's|@VERSION@|%{version}|;s|@SHA256@|%{srv_sha256}|' \
%{SOURCE4} > %{name}-update-server
%build
%if 0%{?suse_version} < 1600
export CC=gcc-11
%endif
%meson -Dcompile_server=false
%meson_build
%install
%meson_install
install -m 0755 -t %{buildroot}%{_bindir} %{name}-update-server
install -d -m 0755 %{buildroot}%{_datadir}/%{name}
touch %{buildroot}%{_datadir}/%{name}/%{name}-server
%check
export PATH=%{buildroot}%{_bindir}:$PATH
desktop-file-validate \
%{buildroot}%{_datadir}/applications/%{name}{,-console}.desktop
%{name} --version
if [ -z "%{srv_sha256}" ] ; then
echo "SHA256 checksum for %{name}-server is missing."
exit 1
fi
%post
if ! echo "%{srv_sha256} %{_datadir}/%{name}/%{name}-server" | sha256sum --check >/dev/null 2>&1 ; then
echo "-------------------------------------------------------------------"
echo "%{srv_info}"
echo "-------------------------------------------------------------------"
fi
exit 0
%files
%license LICENSE
%doc README.md FAQ.md doc/*.md
%{_bindir}/%{name}
%{_bindir}/%{name}-update-server
%dir %{_datadir}/%{name}
%ghost %{_datadir}/%{name}/%{name}-server
%{_datadir}/applications/%{name}{,-console}.desktop
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/%{name}
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_%{name}
%{_mandir}/man1/%{name}.1%{?ext_man}
%changelog