Subject: [PATCH] gnu: Add new variable scrcpy

From: 路辉 <[email-masked]>
Date: Thu, 27 Oct 2022 11:48:05 +0000

From 3adf47b102b0ddcbdee264e6b7f9a1371482adae Mon Sep 17 00:00:00 2001
From: LuHui <[email-masked]>
Date: Wed, 26 Oct 2022 15:57:09 +0800
Subject: [PATCH] gnu: Add new variable scrcpy

* gnu/packages/android.scm (scrcpy): Add new variable.
---
 gnu/packages/android.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/android.scm b/gnu/packages/android.scm
index 91aaba089f..fccf71a4cc 100644
--- a/gnu/packages/android.scm
+++ b/gnu/packages/android.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2020 Sergey Trofimov <[email-masked]>
 ;;; Copyright © 2021 Guillaume Le Vaillant <[email-masked]>
 ;;; Copyright © 2021 Petr Hodina <[email-masked]>
+;;; Copyright © 2022 LuHui <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,6 +38,7 @@ (define-module (gnu packages android)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
+  #:use-module (guix build-system meson)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
   #:use-module ((guix licenses) #:prefix license:)
@@ -49,14 +51,17 @@ (define-module (gnu packages android)
   #:use-module (gnu packages golang)
   #:use-module (gnu packages image)
   #:use-module (gnu packages java)
+  #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages pcre)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages sdl)
   #:use-module (gnu packages selinux)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sphinx)
@@ -64,6 +69,7 @@ (define-module (gnu packages android)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
+  #:use-module (gnu packages video)
   #:use-module (gnu packages virtualization)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml))
@@ -1298,3 +1304,35 @@ (define-public android-file-transfer
 with Android devices using MTP.  It also allows the Android device to be
 mounted via FUSE.")
     (license license:lgpl2.1+)))
+
+(define-public scrcpy
+  (package
+    (name "scrcpy")
+    (version "1.24")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/Genymobile/scrcpy")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "069139c66w7myrpx7jwy6xllp1l1r2gkw8mf385wfc0gjm4jbgcq"))))
+    (build-system meson-build-system)
+    (native-inputs
+     (list pkg-config))
+    (inputs
+     (list sdl2 libusb ffmpeg))
+    (arguments
+     `(#:tests? #f
+       #:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'disable-server-build
+                    ;; because server build need android ndk
+                    ;; you can use SCRCPY_SERVER_PATH to instead default server binary
+                    (lambda _
+                      (truncate-file "server/meson.build" 0))))))
+    (home-page "https://github.com/Genymobile/scrcpy")
+    (synopsis "Display and control your Android device")
+    (description "This application provides display and control
+of Android devices connected via USB or over TCP/IP.")
+    (license license:asl2.0)))
-- 
2.38.0