projects/guix·blob sysadmin-team · refs

1425 lines · 56.5 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Stefan Handschuh <[email protected]>
3;;; Copyright © 2015 Kai-Chung Yan <[email protected]>
4;;; Copyright © 2016, 2020 Marius Bakke <[email protected]>
5;;; Copyright © 2017 Julien Lepiller <[email protected]>
6;;; Copyright © 2017 Hartmut Goebel <[email protected]>
7;;; Copyright © 2017, 2020, 2021, 2022 Maxim Cournoyer <[email protected]>
8;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <[email protected]>
9;;; Copyright © 2018 Efraim Flashner <[email protected]>
10;;; Copyright © 2019, 2020, 2023 Andreas Enge <[email protected]>
11;;; Copyright © 2019 Ricardo Wurmus <[email protected]>
12;;; Copyright © 2020 Sergey Trofimov <[email protected]>
13;;; Copyright © 2021 Guillaume Le Vaillant <[email protected]>
14;;; Copyright © 2021 Petr Hodina <[email protected]>
15;;; Copyright © 2023, 2025 Camilo Q.S. (Distopico) <[email protected]>
16;;; Copyright © 2025 Jordan Moore <[email protected]>
17;;;
18;;; This file is part of GNU Guix.
19;;;
20;;; GNU Guix is free software; you can redistribute it and/or modify it
21;;; under the terms of the GNU General Public License as published by
22;;; the Free Software Foundation; either version 3 of the License, or (at
23;;; your option) any later version.
24;;;
25;;; GNU Guix is distributed in the hope that it will be useful, but
26;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28;;; GNU General Public License for more details.
29;;;
30;;; You should have received a copy of the GNU General Public License
31;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33(define-module (gnu packages android)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix gexp)
37 #:use-module (guix git-download)
38 #:use-module (guix build-system android-ndk)
39 #:use-module (guix build-system cmake)
40 #:use-module (guix build-system copy)
41 #:use-module (guix build-system emacs)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system go)
44 #:use-module (guix build-system pyproject)
45 #:use-module (guix build-system qt)
46 #:use-module (guix build-system trivial)
47 #:use-module ((guix licenses) #:prefix license:)
48 #:use-module ((guix search-paths) #:select ($SSL_CERT_FILE))
49 #:use-module (gnu packages)
50 #:use-module (gnu packages check)
51 #:use-module (gnu packages compression)
52 #:use-module (gnu packages docker)
53 #:use-module (gnu packages gcc)
54 #:use-module (gnu packages gnupg)
55 #:use-module (gnu packages golang-xyz)
56 #:use-module (gnu packages graphviz)
57 #:use-module (gnu packages image)
58 #:use-module (gnu packages iso-codes)
59 #:use-module (gnu packages java)
60 #:use-module (gnu packages linux)
61 #:use-module (gnu packages pcre)
62 #:use-module (gnu packages python)
63 #:use-module (gnu packages python-build)
64 #:use-module (gnu packages python-crypto)
65 #:use-module (gnu packages python-web)
66 #:use-module (gnu packages python-xyz)
67 #:use-module (gnu packages qt)
68 #:use-module (gnu packages readline)
69 #:use-module (gnu packages selinux)
70 #:use-module (gnu packages serialization)
71 #:use-module (gnu packages sphinx)
72 #:use-module (gnu packages ssh)
73 #:use-module (gnu packages time)
74 #:use-module (gnu packages tls)
75 #:use-module (gnu packages version-control)
76 #:use-module (gnu packages virtualization)
77 #:use-module (gnu packages xdisorg)
78 #:use-module (gnu packages xml))
79
80(define-public android-make-stub
81 (package
82 (name "android-make-stub")
83 (version "0.6.0")
84 (source
85 (origin
86 (method git-fetch)
87 (uri (git-reference
88 (url "https://github.com/daym/android-make-stub")
89 (commit (string-append "v" version))))
90 (file-name (string-append "android-make-stub-"
91 version "-checkout"))
92 (sha256
93 (base32
94 "0y1b2x96d37n6f1bp6dcx08bn08zac0cylmbfsx6mf2nahc02fhc"))))
95 (build-system gnu-build-system)
96 (arguments
97 `(#:tests? #f ; None exist.
98 #:phases
99 (modify-phases %standard-phases
100 (delete 'configure)
101 (delete 'build)
102 (replace 'install
103 (lambda* (#:key outputs #:allow-other-keys)
104 (let* ((out (assoc-ref outputs "out")))
105 (invoke "make" (string-append "prefix=" out) "install")
106 #t))))))
107 (home-page "https://github.com/daym/android-make-stub")
108 (synopsis "Stubs for the @command{make} system of the Android platform")
109 (description "@code{android-make-stub} provides stubs for the
110@command{make} system of the Android platform. This allows us to
111use their packages mostly unmodified in our Android NDK build system.")
112 (license license:asl2.0)))
113
114(define-public android-googletest
115 (package (inherit googletest)
116 (name "android-googletest")
117 (version "1.8.0")
118 (source
119 (origin
120 (method git-fetch)
121 (uri (git-reference
122 (url "https://github.com/google/googletest")
123 (commit (string-append "release-" version))))
124 (file-name (git-file-name name version))
125 (sha256
126 (base32
127 "0bjlljmbf8glnd9qjabx73w6pd7ibv43yiyngqvmvgxsabzr8399"))))
128 (arguments
129 `(#:tests? #f
130 #:configure-flags '("-DBUILD_SHARED_LIBS=ON")
131 #:phases
132 (modify-phases %standard-phases
133 (add-after 'install 'install-host-libraries
134 (lambda* (#:key outputs #:allow-other-keys)
135 (let* ((out (assoc-ref outputs "out"))
136 (lib (string-append out "/lib")))
137 (symlink "libgtest.so"
138 (string-append lib "/libgtest_host.so"))
139 (symlink "libgmock.so"
140 (string-append lib "/libgmock_host.so"))
141 #t))))))))
142
143;; The Makefiles that we add are largely based on the Debian
144;; packages. They are licensed under GPL-2 and have copyright:
145;; 2012, Stefan Handschuh <[email protected]>
146;; 2015, Kai-Chung Yan <[email protected]>
147;; Big thanks to them for laying the groundwork.
148
149;; The version tag is consistent between all repositories.
150(define-public (android-platform-version) "7.1.2_r36")
151
152(define-public (android-platform-system-core version)
153 (origin
154 (method git-fetch)
155 (uri (git-reference
156 (url "https://android.googlesource.com/platform/system/core")
157 (commit (string-append "android-" version))))
158 (file-name (string-append "android-platform-system-core-"
159 version "-checkout"))
160 (sha256
161 (base32
162 "1krnc2b9zfkzpdgs1dcbji59nszlx2qr723pg89m52622czc06hg"))
163 (patches
164 (search-patches "libbase-use-own-logging.patch"
165 "libbase-fix-includes.patch"
166 "libutils-remove-damaging-includes.patch"
167 "libutils-add-includes.patch"
168 "adb-add-libraries.patch"
169 "adb-libssl_11-compatibility.patch"
170 "libziparchive-add-includes.patch"))))
171
172(define (android-platform-system-extras version)
173 (origin
174 (method git-fetch)
175 (uri (git-reference
176 (url "https://android.googlesource.com/platform/system/extras")
177 (commit (string-append "android-" version))))
178 (file-name (string-append "android-platform-system-extras-"
179 version "-checkout"))
180 (sha256
181 (base32
182 "18130c23ybqcpgjc5v6f8kdbv2xn39hyiaj17dzldjb9rlwzcyy9"))))
183
184(define (android-platform-bionic version)
185 (origin
186 (method git-fetch)
187 (uri (git-reference
188 (url "https://android.googlesource.com/platform/bionic")
189 (commit (string-append "android-" version))))
190 (file-name (string-append "android-platform-bionic-"
191 version "-checkout"))
192 (sha256
193 (base32
194 "15r4s20d7vw022f8vrc3jbghmqwdcqzprl7i2bfvdkz8z76wc1ps"))))
195
196(define (android-platform-external version subdirectory checksum)
197 (origin
198 (method git-fetch)
199 (uri (git-reference
200 (url
201 (string-append "https://android.googlesource.com/platform/external/"
202 subdirectory))
203 (commit (string-append "android-" version))))
204 (file-name (string-append "android-platform-system-external-" subdirectory "-"
205 version "-checkout"))
206 (sha256
207 (base32
208 checksum))))
209
210(define (android-platform-development version)
211 (origin
212 (method git-fetch)
213 (uri (git-reference
214 (url "https://android.googlesource.com/platform/development")
215 (commit (string-append "android-" version))))
216 (file-name (string-append "android-platform-development-"
217 version "-checkout"))
218 (sha256
219 (base32 "0s92961yycg8wsga40i7fvbfmf1a5i6j2gk64j2jiy7s0hfd4rc3"))))
220
221(define (android-platform-frameworks-native version)
222 (origin
223 (method git-fetch)
224 (uri (git-reference
225 (url "https://android.googlesource.com/platform/frameworks/native")
226 (commit (string-append "android-" version))))
227 (file-name (string-append "android-platform-frameworks-native-"
228 version "-checkout"))
229 (sha256
230 (base32 "00dgx27wma7wzivniy8zyw2443fi2xx8gyxii081m0fwamqd3jrm"))))
231
232(define-public android-liblog
233 (package
234 (name "android-liblog")
235 (version (android-platform-version))
236 (source (android-platform-system-core version))
237 (build-system android-ndk-build-system)
238 (arguments
239 `(#:make-flags '("LDLIBS=-lpthread")
240 #:phases
241 (modify-phases %standard-phases
242 (add-after 'unpack 'enter-source
243 (lambda _ (chdir "liblog") #t))
244 (add-after 'install 'ldconfig
245 (lambda* (#:key outputs #:allow-other-keys)
246 (let ((out (assoc-ref outputs "out")))
247 (symlink "liblog.so.0" (string-append out "/lib/liblog.so"))
248 #t)))
249 (add-after 'install 'install-headers
250 (lambda* (#:key outputs #:allow-other-keys)
251 (let ((out (assoc-ref outputs "out")))
252 (copy-recursively
253 "../include/log" (string-append out "/include/log"))
254 ;; For android/log.h, the only header in the android directory.
255 (copy-recursively
256 "../include/android" (string-append out "/include/android")))
257 #t)))))
258 (home-page "https://developer.android.com/")
259 (synopsis "Logging library from the Android platform")
260 (description "@code{liblog} represents an interface to the volatile Android
261Logging system for NDK (Native) applications and libraries and contain
262interfaces for either writing or reading logs. The log buffers are divided up
263in Main, System, Radio and Events sub-logs.")
264 (license license:asl2.0)))
265
266(define android-libbase
267 (package
268 (name "android-libbase")
269 (version (android-platform-version))
270 (source (android-platform-system-core version))
271 (build-system android-ndk-build-system)
272 (arguments
273 `(#:tests? #f ; Test failure: logging.UNIMPLEMENTED
274 #:phases
275 (modify-phases %standard-phases
276 (add-after 'unpack 'enter-source
277 (lambda _ (chdir "base") #t)))))
278 (inputs `(("android-liblog" ,android-liblog)))
279 (home-page "https://developer.android.com/")
280 (synopsis "Android platform base library")
281 (description "@code{libbase} is a library in common use by the
282various Android core host applications.")
283 (license license:asl2.0)))
284
285(define-public android-libcutils
286 (package
287 (name "android-libcutils")
288 (version (android-platform-version))
289 (source (android-platform-system-core version))
290 (build-system gnu-build-system)
291 (arguments
292 `(#:tests? #f ; TODO.
293 #:phases
294 (modify-phases %standard-phases
295 (add-after 'unpack 'enter-source
296 (lambda _ (chdir "libcutils") #t))
297 (add-after 'enter-source 'create-Makefile
298 (lambda _
299 ;; No useful makefile is shipped, so we create one.
300 (with-output-to-file "Makefile"
301 (lambda _
302 (display
303 (string-append
304 "NAME = libcutils\n"
305 "SOURCES = load_file.o socket_local_client_unix.o"
306 " socket_loopback_client_unix.o socket_network_client_unix.o"
307 " socket_loopback_server_unix.o socket_local_server_unix.o"
308 " sockets_unix.o socket_inaddr_any_server_unix.o"
309 " sockets.o\n"
310 "CC = gcc\n"
311
312 "CFLAGS += -fPIC\n"
313 "CXXFLAGS += -fPIC\n"
314 "CPPFLAGS += -Iinclude -I../include\n"
315 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
316
317 "build: $(SOURCES)\n"
318 " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
319 " $(LDFLAGS)\n"))
320 #t))))
321 (delete 'configure)
322 (replace 'install
323 (lambda* (#:key outputs #:allow-other-keys)
324 (let* ((out (assoc-ref outputs "out"))
325 (lib (string-append out "/lib"))
326 (include (string-append out "/include")))
327 (install-file "libcutils.so.0" lib)
328 (with-directory-excursion lib
329 (symlink "libcutils.so.0" "libcutils.so"))
330 (copy-recursively "../include/cutils"
331 (string-append include "/cutils"))
332 #t))))))
333 (home-page "https://developer.android.com/")
334 (synopsis "Android platform c utils library")
335 (description "@code{libcutils} is a library in common use by the
336various Android core host applications.")
337 (license license:asl2.0)))
338
339(define-public android-libsparse
340 (package
341 (name "android-libsparse")
342 (version (android-platform-version))
343 (source (android-platform-system-core version))
344 (build-system android-ndk-build-system)
345 (arguments
346 `(#:make-flags '("CFLAGS=-Wno-error"
347 "CXXFLAGS=-fpermissive -Wno-error")
348 #:phases
349 (modify-phases %standard-phases
350 (add-after 'unpack 'enter-source
351 (lambda _ (chdir "libsparse") #t)))))
352 (inputs
353 (list zlib))
354 (home-page "https://developer.android.com/")
355 (synopsis "Android platform sparse library")
356 (description "@code{android-libsparse} is a library in common use by the
357various Android core host applications.")
358 (license license:asl2.0)))
359
360(define-public android-libziparchive
361 (package
362 (name "android-libziparchive")
363 (version (android-platform-version))
364 (source (android-platform-system-core version))
365 (build-system android-ndk-build-system)
366 (arguments
367 `(#:make-flags '("CFLAGS=-Wno-error"
368 "CXXFLAGS=-fpermissive -Wno-error")
369 #:phases
370 (modify-phases %standard-phases
371 (add-after 'unpack 'enter-source
372 (lambda _ (chdir "libziparchive") #t))
373 (add-before 'check 'setenv
374 (lambda _
375 (setenv "ziparchive_tests_host_PARAMS" "--test_data_dir=testdata")
376 #t))
377 (add-after 'install 'install-headers
378 (lambda* (#:key inputs outputs #:allow-other-keys)
379 (let ((out (assoc-ref outputs "out")))
380 (copy-recursively "../include/ziparchive"
381 (string-append out "/include/ziparchive"))
382 #t))))))
383 (inputs
384 (list zlib))
385 (native-inputs
386 (list android-libbase android-libutils android-liblog))
387 (home-page "https://developer.android.com/")
388 (synopsis "Android platform ZIP library")
389 (description "@code{android-libziparchive} is a library in common use by the
390various Android core host applications.")
391 (license license:asl2.0)))
392
393(define-public adb
394 (package
395 (name "adb")
396 (version (android-platform-version))
397 (source (android-platform-system-core version))
398 (build-system android-ndk-build-system)
399 (arguments
400 `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
401 #:make-flags
402 ,#~(list
403 "CFLAGS=-Wno-error"
404 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
405 (string-append
406 "LDFLAGS=-Wl,-rpath=" #$output "/lib "
407 "-Wl,-rpath=" #$(this-package-input "openssl") "/lib -L ."))
408 #:phases
409 (modify-phases %standard-phases
410 (add-after 'unpack 'enter-source
411 (lambda _ (chdir "adb") #t))
412 (add-after 'enter-source 'glibc-compat
413 (lambda _
414 ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
415 (substitute* "usb_linux.cpp"
416 (("#include <sys/types.h>" all)
417 (string-append all "\n#include <sys/sysmacros.h>\n")))
418 #t))
419 (add-after 'enter-source 'make-libs-available
420 (lambda* (#:key inputs outputs #:allow-other-keys)
421 (substitute* "Android.mk"
422 (("libcrypto_static") "libcrypto"))
423 #t))
424 (add-after 'install 'install-headers
425 (lambda* (#:key inputs outputs #:allow-other-keys)
426 (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
427 #t)))))
428 (native-inputs (list linux-libre-headers-5.15 gcc-11))
429 (inputs
430 (list android-libbase android-libcutils android-liblog openssl))
431 (home-page "https://developer.android.com/studio/command-line/adb.html")
432 (synopsis "Android Debug Bridge")
433 (description
434 "@command{adb} is a versatile command line tool that lets you communicate
435with an emulator instance or connected Android device. It facilitates a variety
436of device actions, such as installing and debugging apps, and it provides access
437to a Unix shell that can run commands on the connected device or emulator.")
438 (license license:asl2.0)))
439
440(define-public betteradbsync
441 (package
442 (name "betteradbsync")
443 (version "1.4.0")
444 (source
445 (origin
446 (method git-fetch)
447 (uri (git-reference
448 (url "https://github.com/jb2170/better-adb-sync/")
449 (commit (string-append "v" version))))
450 (file-name (git-file-name name version))
451 (sha256
452 (base32 "06ri9a8r0a4i9ih0cqdj5j19dbkbqwd5m5g8ch220rh4firaj4w2"))))
453 (build-system pyproject-build-system)
454 (arguments (list #:tests? #f)) ; there are none
455 (home-page "https://github.com/jb2170/better-adb-sync/")
456 (native-inputs (list python-setuptools python-wheel))
457 (synopsis "Rsync-like file transfer over @acronym{ADB,Android Debug Bridge}")
458 (description "An rsync-like command-line utility that facilitates file
459transfer over @acronym{ADB,Android Debug Bridge}. There are several additional
460features over Google's original @code{adbsync} version with support for the
461@code{--exclude}, @code{--exclude-from}, @code{--del}, and
462@code{--delete-excluded} command line flags, which have the same purpose to
463the corresponding @command{rsync} flags.")
464 (license license:asl2.0)))
465
466(define-public mkbootimg
467 (package
468 (name "mkbootimg")
469 (version (android-platform-version))
470 (source (android-platform-system-core version))
471 (build-system copy-build-system)
472 (arguments
473 (list
474 #:install-plan
475 ''(("mkbootimg/mkbootimg" "bin/")
476 ("mkbootimg/bootimg.h" "include/"))))
477 (inputs (list python-wrapper))
478 (home-page "https://developer.android.com/studio/command-line/adb.html")
479 (synopsis "Tool to create Android boot images")
480 (description "This package provides a tool to create Android Boot Images.")
481 (license license:asl2.0)))
482
483(define-public android-safe-iop
484 (package
485 (name "android-safe-iop")
486 (version (android-platform-version))
487 (source (android-platform-external version "safe-iop"
488 "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw"))
489 (build-system android-ndk-build-system)
490 (arguments
491 `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error")
492 #:phases
493 (modify-phases %standard-phases
494 (add-before 'build 'patch-host
495 (lambda _
496 ;; TODO: Cross-compile.
497 (substitute* "Android.mk"
498 (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY"))
499 #t)))))
500 (home-page "https://developer.android.com/")
501 (synopsis "Safe integers in C")
502 (description "@code{android-safe-iop} provides a set of functions for
503performing and checking safe integer operations. Ensure that integer
504operations do not result in silent overflow.")
505 (license license:bsd-2)))
506
507(define-public android-bionic-uapi
508 (package
509 (name "android-bionic-uapi")
510 (version (android-platform-version))
511 (source (android-platform-bionic version))
512 (build-system android-ndk-build-system)
513 (arguments
514 `(#:phases
515 (modify-phases %standard-phases
516 (add-after 'unpack 'enter-source
517 (lambda _ (chdir "libc") #t))
518 (replace 'check
519 (const #t))
520 (replace 'build
521 (const #t))
522 (replace 'install
523 (lambda* (#:key outputs #:allow-other-keys)
524 (let* ((out (assoc-ref outputs "out"))
525 (out-sys (string-append out "/include/sys")))
526 (mkdir-p out-sys)
527 (install-file "include/sys/system_properties.h" out-sys)
528 (install-file "include/sys/_system_properties.h" out-sys)
529 (copy-recursively "kernel/uapi" (string-append out "/include"))
530 #t))))))
531 (home-page "https://developer.android.com/")
532 (synopsis "Android Linux API that is safe for user space")
533 (description "@code{android-bionic-uapi} provides the part of the Linux API
534that is safe to use for user space. It also includes
535@code{system_properties.h} and @code{_system_properties.h}.")
536 (license license:asl2.0)))
537
538(define-public android-libselinux
539 (package
540 (name "android-libselinux")
541 (version (android-platform-version))
542 (source
543 (android-platform-external version "libselinux"
544 "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
545 (build-system android-ndk-build-system)
546 (arguments
547 ;; See logd/Android.mk for the *_LOG_TAG values.
548 `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
549 "-I core/include "
550 "-I core/libpackagelistparser/include "
551 "-DAUDITD_LOG_TAG=1003 "
552 "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
553 "LDFLAGS=-L . -lpcre")
554 #:phases
555 (modify-phases %standard-phases
556 (add-after 'unpack 'patch-HOST
557 (lambda _
558 ;; gettid duplicates otherwise.
559 (substitute* "src/procattr.c"
560 (("#ifdef HOST") "#ifdef XXX"))
561 #t)))))
562 (inputs
563 (list openssl))
564 (native-inputs
565 (list android-bionic-uapi
566 ;; pcre is inlined by our package.
567 pcre))
568 (home-page "https://developer.android.com/")
569 (synopsis "Android version of the SELinux libraries and utilities")
570 (description
571 "The libselinux library provides an API for SELinux applications to get
572and set process and file security contexts, and to obtain security policy
573decisions. It is required for any applications that use the SELinux API, and
574used by all applications that are SELinux-aware. This package also includes
575the core SELinux management utilities.")
576 (license license:public-domain)))
577
578(define-public android-ext4-utils
579 (package
580 (name "android-ext4-utils")
581 (version (android-platform-version))
582 (source (android-platform-system-extras version))
583 (build-system android-ndk-build-system)
584 (arguments
585 `(#:make-flags
586 ,#~(list
587 (string-append
588 "CPPFLAGS="
589 ;"-Wno-error "
590 "-I " #$(this-package-input "android-libselinux") "/include "
591 "-I " #$(this-package-input "android-libsparse") "/include "
592 "-I " #$(this-package-input "android-libcutils") "/include "
593 "-I " #$(this-package-input "android-liblog") "/include "
594 "-I ../core/include")
595 "CFLAGS=-Wno-error"
596 "install-libext4_utils_host.a"
597 (string-append "prefix=" #$output))
598 #:phases
599 (modify-phases %standard-phases
600 (add-after 'unpack 'unpack-core
601 (lambda* (#:key inputs #:allow-other-keys)
602 (mkdir-p "core")
603 (copy-recursively (assoc-ref inputs "android-core")
604 "core")))
605 (add-after 'unpack-core 'enter-source
606 (lambda _ (chdir "ext4_utils") #t))
607 (replace 'install
608 (lambda* (#:key inputs outputs #:allow-other-keys)
609 (let ((out (assoc-ref outputs "out")))
610 (copy-recursively "." (string-append out "/include")))
611 #t)))))
612 (inputs
613 (list android-libcutils android-liblog android-libselinux
614 android-libsparse zlib))
615 (native-inputs
616 `(("android-core" ,(android-platform-system-core version))))
617 (home-page "https://developer.android.com/")
618 (synopsis "Android ext4 file system utilities")
619 (description "@code{android-ext4-utils} is a library in common use by the
620Android core.")
621 (license license:asl2.0)))
622
623(define-public android-f2fs-utils
624 (package
625 (name "android-f2fs-utils")
626 (version (android-platform-version))
627 (source (android-platform-system-extras version))
628 (build-system android-ndk-build-system)
629 (arguments
630 `(#:phases
631 (modify-phases %standard-phases
632 (add-after 'unpack 'enter-source
633 (lambda _ (chdir "f2fs_utils") #t))
634 (add-before 'build 'set-compilation-flags
635 (lambda _
636 (setenv "CFLAGS" "-fcommon")))
637 (add-after 'install 'install-headers
638 (lambda* (#:key inputs outputs #:allow-other-keys)
639 (copy-recursively "." (string-append (assoc-ref outputs "out")
640 "/include"))
641 #t))
642 (add-after 'install 'install-shell-scripts
643 (lambda* (#:key outputs #:allow-other-keys)
644 (let* ((out (assoc-ref outputs "out"))
645 (bin (string-append out "/bin")))
646 (patch-shebang "mkf2fsuserimg.sh")
647 (substitute* "mkf2fsuserimg.sh"
648 (("make_f2fs") (string-append bin "/make_f2fs")))
649 (install-file "mkf2fsuserimg.sh" bin)
650 #t))))))
651 (inputs
652 (list f2fs-tools-1.7 android-libselinux android-libsparse
653 android-libcutils zlib))
654 (home-page "https://developer.android.com/")
655 (synopsis "Android f2fs utils")
656 (description "@code{android-f2fs-utils} is a library in common use by the
657Android core. It allows the user to create images for the @code{f2fs} Flash
658file system.")
659 (license license:asl2.0)))
660
661(define-public android-libutils
662 (package
663 (name "android-libutils")
664 (version (android-platform-version))
665 (source (android-platform-system-core version))
666 (build-system android-ndk-build-system)
667 (arguments
668 `(#:tests? #f ; TODO
669 #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
670 #:phases
671 (modify-phases %standard-phases
672 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
673 (lambda* (#:key inputs #:allow-other-keys)
674 ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent it from
675 ;; shadowing the version of GCC provided in native-inputs.
676 (let ((gcc (assoc-ref inputs "gcc")))
677 (setenv "CPLUS_INCLUDE_PATH"
678 (string-join
679 (delete (string-append gcc "/include/c++")
680 (string-split (getenv "CPLUS_INCLUDE_PATH")
681 #\:))
682 ":"))
683 #t)))
684 (add-after 'unpack 'enter-source
685 (lambda _ (chdir "libutils") #t))
686 (add-after 'install 'install-headers
687 (lambda* (#:key inputs outputs #:allow-other-keys)
688 (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
689 (inputs
690 (list android-safe-iop android-libcutils))
691 (native-inputs
692 `(("android-bionic-uapi" ,android-bionic-uapi)
693 ("android-liblog" ,android-liblog)
694 ("gcc@5" ,gcc-5))) ; XXX: fails to build with GCC 7
695 (home-page "https://developer.android.com/")
696 (synopsis "Android utility library")
697 (description "@code{android-libutils} provides utilities for Android NDK developers.")
698 (license license:asl2.0)))
699
700(define-public fastboot
701 (package
702 (name "fastboot")
703 (version (android-platform-version))
704 (source (android-platform-system-core version))
705 (build-system android-ndk-build-system)
706 (arguments
707 `(#:phases
708 (modify-phases %standard-phases
709 (add-after 'unpack 'enter-source
710 (lambda _
711 (chdir "fastboot")
712 #t))
713 (add-after 'enter-source 'patch-source
714 (lambda _
715 (substitute* "Android.mk"
716 (("libext4_utils_host") "libext4_utils_host libselinux libpcre")
717 (("\\$\\(shell git .*\\)") ,version))
718 #t))
719 (add-after 'patch-source 'relax-gcc-14-strictness
720 (lambda _
721 (setenv
722 "CXXFLAGS"
723 (string-append "-g -O2"
724 " -Wno-error=calloc-transposed-args"
725 " -Wno-error=format-truncation"))))
726 (replace 'install
727 (lambda* (#:key outputs #:allow-other-keys)
728 (let* ((out (assoc-ref outputs "out"))
729 (lib (string-append out "/lib"))
730 (bin (string-append out "/bin")))
731 (install-file "fastboot" bin)
732 #t))))))
733 (inputs
734 (list adb
735 android-safe-iop
736 android-ext4-utils
737 android-f2fs-utils
738 android-libbase
739 android-libcutils
740 android-liblog
741 android-libutils
742 android-libsparse
743 android-libziparchive
744 android-libselinux
745 pcre
746 mkbootimg
747 zlib))
748 (native-inputs
749 (list xz))
750 (home-page "https://developer.android.com/studio/command-line/")
751 (synopsis "Android image flasher")
752 (description
753 "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
754 (license license:asl2.0)))
755
756(define-public sdkmanager
757 (package
758 (name "sdkmanager")
759 (version "0.6.11")
760 (source
761 (origin
762 (method url-fetch)
763 (uri (pypi-uri "sdkmanager" version ".tar.gz"))
764 (sha256
765 (base32 "0r3xwk8xsfxvmxyw3d57sy2i9by24g0l1jl40735jiac9mypcg7n"))))
766 (build-system pyproject-build-system)
767 (propagated-inputs (list python-requests python-argcomplete python-urllib3
768 python-looseversion gnupg))
769 (native-inputs (list python-setuptools python-wheel python-requests-cache
770 python-defusedxml))
771 (native-search-paths
772 (list $SSL_CERT_FILE))
773 (arguments
774 (list
775 #:test-backend #~'unittest
776 #:phases
777 #~(modify-phases %standard-phases
778 (add-after 'unpack 'patch-tests
779 (lambda _
780 (substitute* "test_sdkmanager.py"
781 ;; Tests below require network.
782 (("def test_checksums_json_mirrors")
783 "def __test_checksums_json_mirrors")
784 (("def test_install_and_rerun")
785 "def __test_install_and_rerun")
786 (("def test_main_args")
787 "def __test_main_args")
788 (("def test_licenses")
789 "def __test_licenses"))))
790 (add-before 'build 'patch-gnupg
791 (lambda _
792 (substitute* "sdkmanager.py"
793 (("gpgv")
794 (string-append #$(this-package-input "gnupg") "/bin/gpgv"))))))))
795 (home-page "https://gitlab.com/fdroid/sdkmanager")
796 (synopsis "Replacement for Android sdkmanager written in Python")
797 (description
798 "This package provides a drop-in replacement for sdkmanager from
799the Android SDK. It is written in Python and part of the F-Droid
800project. It implements the exact API of the Android sdkmanager command
801line. The project also attempts to maintain the same terminal output.")
802 (license license:agpl3+)))
803
804(define-public android-udev-rules
805 (package
806 (name "android-udev-rules")
807 (version "20250525")
808 (source
809 (origin
810 (method git-fetch)
811 (uri (git-reference
812 (url "https://github.com/M0Rf30/android-udev-rules")
813 (commit version)))
814 (file-name (git-file-name name version))
815 (sha256
816 (base32 "1m5ngii9alsia81nk0cr8d13kpkrizbk7gpf9ai5yq8m9bsd9q70"))))
817 (build-system trivial-build-system)
818 (native-inputs `(("source" ,source)))
819 (arguments
820 '(#:modules ((guix build utils))
821 #:builder
822 (begin
823 (use-modules (guix build utils))
824 (let ((source (assoc-ref %build-inputs "source")))
825 (install-file (string-append source "/51-android.rules")
826 (string-append %output "/lib/udev/rules.d"))))))
827 (home-page "https://github.com/M0Rf30/android-udev-rules")
828 (synopsis "udev rules for Android devices")
829 (description "Provides a set of udev rules to allow using Android devices
830with tools such as @command{adb} and @command{fastboot} without root
831privileges. This package is intended to be added as a rule to the
832@code{udev-service-type} in your @code{operating-system} configuration.
833Additionally, an @code{adbusers} group must be defined and your user added to
834it.
835
836@emph{Simply installing this package will not have any effect.} It is meant
837to be passed to the @code{udev} service.")
838 (license license:gpl3+)))
839
840(define-public android-platform-frameworks-native-headers
841 (package
842 (name "android-platform-frameworks-native-headers")
843 (version (android-platform-version))
844 (source (android-platform-frameworks-native version))
845 (build-system trivial-build-system)
846 (arguments
847 `(#:modules ((guix build utils))
848 #:builder
849 (begin
850 (use-modules (guix build utils))
851 (let ((source (assoc-ref %build-inputs "source"))
852 (include (string-append %output "/include/android")))
853 (mkdir-p include)
854 (copy-recursively (string-append source "/include/android")
855 (string-append include)) ; "/android"))
856 ))))
857 (home-page "https://android.googlesource.com/platform/frameworks/native/")
858 (synopsis "Headers for Android development from
859android-platform-frameworks-native")
860 (description "This package contains headers used for developing software
861for Android. More precicely the headers from include/android in
862platform/frameworks/native.")
863 (license license:asl2.0)))
864
865(define-public libetc1
866 (package
867 (name "libetc1")
868 (version (android-platform-version))
869 (source (android-platform-frameworks-native version))
870 (build-system gnu-build-system)
871 (arguments
872 `(#:tests? #f ; no tests
873 #:phases
874 (modify-phases %standard-phases
875 (add-after 'unpack 'create-Makefile
876 (lambda _
877 ;; No useful makefile is shipped, so we create one.
878 (with-output-to-file "Makefile"
879 (lambda _
880 (display
881 (string-append
882 "NAME = libETC1\n"
883 "SOURCES = opengl/libs/ETC1/etc1.cpp\n"
884 "CXXFLAGS += -fPIC\n"
885 "CPPFLAGS += -Iopengl/include\n"
886 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
887 "$(NAME).so.0: $(SOURCES)\n"
888 " $(CXX) $^ -o $@ $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)\n"
889 "build: $(NAME).so.0"))
890 #t))))
891 (add-after 'unpack 'remove-unused-stuff-to-reduce-warnings
892 (lambda _
893 (delete-file-recursively "opengl/libs/tools")))
894 (delete 'configure)
895 (replace 'install
896 (lambda* (#:key outputs #:allow-other-keys)
897 (let* ((out (assoc-ref outputs "out"))
898 (lib (string-append out "/lib"))
899 (include (string-append out "/include")))
900 (install-file "libETC1.so.0" lib)
901 (with-directory-excursion lib
902 (symlink "libETC1.so.0" "libETC1.so"))
903 (copy-recursively "opengl/include/ETC1"
904 (string-append include "/ETC1"))))))))
905 (home-page "https://android.googlesource.com/platform/frameworks/native/")
906 (synopsis "ETC1 compression library")
907 (description "Ericsson Texture Compression (ETC) is a lossy texture
908compression technique developed in collaboration with Ericsson Research in
909early 2005. libETC1 provides the encoding and decoding of ETC1 compression
910algorithm.")
911 (license license:asl2.0)))
912
913(define-public etc1tool
914 (package
915 (name "etc1tool")
916 (version (android-platform-version))
917 (source (android-platform-development version))
918 (build-system gnu-build-system)
919 (arguments
920 `(#:tests? #f
921 #:phases
922 (modify-phases %standard-phases
923 (add-after 'unpack 'create-Makefile
924 (lambda _
925 ;; No useful makefile is shipped, so we create one.
926 (with-output-to-file "Makefile"
927 (lambda _
928 (display
929 (string-append
930 "NAME = etc1tool\n"
931 "SOURCES = tools/etc1tool/etc1tool.cpp\n"
932 "CPPFLAGS += -Iinclude\n"
933 "LDFLAGS += -lpng -lETC1\n"
934 "$(NAME): $(SOURCES)\n"
935 " $(CXX) $^ -o $@ $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)\n"
936 "build: $(NAME)"))
937 #t))))
938 (add-before 'build 'fix-typos-in-help
939 (lambda _
940 (substitute* "tools/etc1tool/etc1tool.cpp"
941 ((" apropriate ") " appropriate "))
942 #t))
943 ;; TODO: Add man-page from Debian
944 (delete 'configure)
945 (replace 'install
946 (lambda* (#:key outputs #:allow-other-keys)
947 (let* ((out (assoc-ref outputs "out"))
948 (bin (string-append out "/bin")))
949 (install-file "etc1tool" bin)))))))
950 (inputs
951 `(("libetc1" ,libetc1)
952 ("libpng" ,libpng)))
953 (home-page "https://developer.android.com/studio/command-line/etc1tool.html")
954 (synopsis "Encode and decode PNG images to resp. from the ETC1 compression
955standard")
956 (description
957 "@command{etc1} is a command line utility that lets you encode PNG images
958to the ETC1 compression standard and decode ETC1 compressed images back to
959PNG. This tool is part of the Android SDK for working with media files for
960game apps.
961
962The standard for the ETC1 texture format can be found at
963@uref{http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt}.")
964 (license license:asl2.0)))
965
966(define-public git-repo
967 (package
968 (name "git-repo")
969 (version "2.60.1")
970 (source
971 (origin
972 (method git-fetch)
973 (uri (git-reference
974 (url "https://gerrit.googlesource.com/git-repo")
975 (commit (string-append "v" version))))
976 (file-name (string-append "git-repo-" version "-checkout"))
977 (sha256
978 (base32 "1cx1b0zmvnmglyn6kbdifcy6w3gm89z2icw4pykxm0wyasy7sc1c"))))
979 (build-system pyproject-build-system)
980 (arguments
981 (list
982 #:test-flags
983 #~(list
984 ;; XXX: Requires GnuPG.
985 "--deselect=tests/test_wrapper.py::SetupGnuPG::test_full"
986 ;; This is expected, as the package is patched for this.
987 "-k" "not test_fetches_when_stale")
988 #:phases
989 #~(modify-phases %standard-phases
990 (add-before 'build 'set-executable-paths
991 (lambda* (#:key inputs outputs #:allow-other-keys)
992 (substitute* '("repo" "git_command.py")
993 (("^GIT = 'git'")
994 (format #f "GIT = '~a'"
995 (search-input-file inputs "/bin/git"))))
996 (substitute* "git_config.py"
997 ((" command_base = \\['ssh',")
998 (format #f " command_base = ['~a',"
999 (search-input-file inputs "/bin/ssh"))))))
1000 (add-before 'build 'do-not-self-update
1001 (lambda* (#:key outputs #:allow-other-keys)
1002 ;; Setting the REPO_MAIN variable to an absolute file name is
1003 ;; enough to have _FindRepo return the store main.py file. The
1004 ;; self update mechanism is activated with the call to _Init() in
1005 ;; main(), so we bypass it.
1006
1007 ;; Ticket requesting upstream to provide a mean to disable the
1008 ;; self update mechanism:
1009 ;; https://bugs.chromium.org/p/gerrit/issues/detail?id=12407.
1010 (let ((repo-main (string-append #$output
1011 "/share/git-repo/main.py")))
1012 (substitute* "repo"
1013 (("^REPO_MAIN = .*")
1014 (format #f "REPO_MAIN = ~s~%" repo-main))
1015 ((" _Init\\(args, gitc_init=\\(cmd ==.*" all)
1016 (string-append "True #" all)))
1017 ;; Prevent repo from trying to git describe its version from
1018 ;; the (disabled) self updated copy.
1019 (substitute* "git_command.py"
1020 (("ver = getattr\\(RepoSourceVersion.*")
1021 (format #f "ver = ~s~%" #$version)))
1022 (substitute* "subcmds/version.py"
1023 (("rp_ver = .*")
1024 (format #f "rp_ver = ~s~%" #$version)))
1025 ;; Prevent repo from adding its (disabled) self update copy to
1026 ;; the list of projects to fetch when using 'repo sync'.
1027 (substitute* "subcmds/sync.py"
1028 (("to_fetch\\.extend\\(all_projects\\).*" all)
1029 (string-append "#" all))
1030 (("self\\._Fetch\\(to_fetch")
1031 "self._Fetch(all_projects")
1032 (("_PostRepoFetch\\(rp, opt\\.repo_verify).*" all)
1033 (string-append "pass #" all))))))
1034 (delete 'build) ;nothing to build
1035 (add-before 'check 'configure-git
1036 (lambda _
1037 (setenv "HOME" (getcwd))
1038 ;; XXX: pytest needs this for conftest to import local modules.
1039 (setenv "PYTHONPATH" (getcwd))
1040 (invoke "git" "config" "--global" "user.email" "[email protected]")
1041 (invoke "git" "config" "--global" "user.name" "Your Name")))
1042 (replace 'install
1043 (lambda* (#:key outputs #:allow-other-keys)
1044 (let* ((bin-dir (string-append #$output "/bin"))
1045 (repo-dir (string-append #$output "/share/"
1046 #$name)))
1047 (mkdir-p bin-dir)
1048 (mkdir-p repo-dir)
1049 (copy-recursively "." repo-dir)
1050 (delete-file-recursively (string-append repo-dir "/tests"))
1051 (symlink (string-append repo-dir "/repo")
1052 (string-append bin-dir "/repo"))))))))
1053 (inputs
1054 ;; TODO: Add git-remote-persistent-https once it is available in guix
1055 (list git openssh))
1056 (native-inputs (list python-pytest python-setuptools))
1057 (home-page "https://code.google.com/p/git-repo/")
1058 (synopsis "Helps to manage many Git repositories")
1059 (description
1060 "Repo is a tool built on top of Git. Repo helps manage many Git
1061repositories, does the uploads to revision control systems, and automates
1062parts of the development workflow. Repo is not meant to replace Git, only to
1063make it easier to work with Git. The repo command is an executable Python
1064script that you can put anywhere in your path.")
1065 (license license:asl2.0)))
1066
1067(define-public abootimg
1068 (package
1069 (name "abootimg")
1070 (version "0.6")
1071 (source
1072 (origin
1073 (method url-fetch)
1074 (uri (string-append "http://deb.debian.org/debian/pool/main/a/abootimg/"
1075 "abootimg_" version ".orig.tar.gz"))
1076 (sha256
1077 (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba"))))
1078 (build-system gnu-build-system)
1079 (arguments
1080 `(#:tests? #f
1081 #:phases
1082 (modify-phases %standard-phases
1083 (replace 'configure
1084 (lambda _
1085 (setenv "CC" "gcc")
1086 #t))
1087 (replace 'install
1088 (lambda* (#:key outputs #:allow-other-keys)
1089 (let* ((out (assoc-ref outputs "out"))
1090 (bin (string-append out "/bin")))
1091 (install-file "abootimg" bin)
1092 #t))))))
1093 (inputs
1094 `(("libblkid" ,util-linux "lib")))
1095 (home-page "https://ac100.grandou.net/abootimg")
1096 (synopsis "Tool for manipulating Android Boot Images")
1097 (description "This package provides a tool for manipulating old Android
1098Boot Images. @code{abootimg} can work directly on block devices, or, the
1099safest way, on a file image.")
1100 (license license:gpl2+)))
1101
1102(define-public python-androguard
1103 (package
1104 (name "python-androguard")
1105 (version "3.3.5") ;TODO: It was released in 2019, there is a fresh version
1106 (source
1107 (origin
1108 (method url-fetch)
1109 (uri (pypi-uri "androguard" version))
1110 (sha256
1111 (base32 "18nd08rbvc4d1p9r70qp76rcbldvpv89prsi15alrmxdlnimqrgh"))))
1112 (build-system pyproject-build-system)
1113 ;; XXX: The pypi release doesn't have the tests, but the tests use
1114 ;; packaged binaries, so we skip them.
1115 (arguments
1116 (list #:tests? #f))
1117 (native-inputs
1118 (list python-setuptools))
1119 (propagated-inputs
1120 (list python-asn1crypto
1121 python-click
1122 python-colorama
1123 python-future
1124 python-ipython
1125 python-lxml
1126 python-matplotlib
1127 python-networkx
1128 python-pydot
1129 python-pygments
1130 python-pyperclip))
1131 (home-page "https://github.com/androguard/androguard")
1132 (synopsis "Python tool to play with Android files")
1133 (description
1134 "Androguard is a full Python tool to manipulate Android files. It is
1135useful for reverse engineering, analysis of Android applications and more.")
1136 (license license:asl2.0)))
1137
1138(define-public python-miio
1139 (package
1140 (name "python-miio")
1141 (version "0.5.12")
1142 (source
1143 (origin
1144 (method url-fetch)
1145 (uri (pypi-uri "python-miio" version))
1146 (sha256
1147 (base32
1148 "05kc0icap3a4iw4910zfqi61zphcf6x958v2b5x68fy51ld3b704"))))
1149 (build-system pyproject-build-system)
1150 (native-inputs
1151 (list python-poetry-core
1152 python-pytest
1153 python-pytest-mock
1154 python-sphinx-click
1155 python-sphinx-rtd-theme
1156 python-sphinxcontrib-apidoc))
1157 (propagated-inputs
1158 (list python-appdirs
1159 python-attrs
1160 python-click
1161 python-construct
1162 python-croniter
1163 python-cryptography
1164 python-defusedxml
1165 python-netifaces
1166 python-pytz
1167 python-pyyaml
1168 python-tqdm
1169 python-zeroconf))
1170 (home-page "https://github.com/rytilahti/python-miio")
1171 (synopsis "Control Xiaomi smart appliances")
1172 (description "This package provides library and command line interface
1173for communicating with Xiaomi smart appliances over miIO and MIoT protocols.")
1174 (license license:gpl3+)))
1175
1176(define-public fdroidserver
1177 (package
1178 (name "fdroidserver")
1179 (version "2.4.5")
1180 (source
1181 (origin
1182 (method git-fetch)
1183 (uri (git-reference
1184 (url "https://gitlab.com/fdroid/fdroidserver")
1185 (commit version)))
1186 (file-name (git-file-name name version))
1187 (sha256
1188 (base32 "1ai5qrddmn6rvvnqq9ax5fj9pwc1rsvh6l4fap8p8fasiasy2802"))))
1189 (build-system pyproject-build-system)
1190 (arguments
1191 (list
1192 #:tests? #f ;requires Android SDK
1193 #:phases
1194 #~(modify-phases %standard-phases
1195 (add-before 'check 'set-env
1196 (lambda _
1197 (setenv "HOME" "/tmp"))))))
1198 (propagated-inputs
1199 (list python-platformdirs
1200 python-androguard
1201 python-apache-libcloud
1202 python-asn1crypto
1203 python-clint
1204 python-defusedxml
1205 python-gitpython
1206 python-oscrypto
1207 python-paramiko
1208 python-pillow
1209 python-puremagic
1210 python-pyyaml
1211 python-qrcode
1212 python-requests
1213 python-ruamel.yaml-0.16
1214 python-vagrant
1215 python-yamllint
1216 sdkmanager))
1217 (native-inputs
1218 (list python-babel python-setuptools))
1219 (home-page "https://f-droid.org")
1220 (synopsis "F-Droid server tools")
1221 (description
1222 "The F-Droid server tools provide various scripts and tools that are used
1223to maintain F-Droid, the repository of free Android applications. You can use
1224these same tools to create your own additional or alternative repository for
1225publishing, or to assist in creating, testing and submitting metadata to the
1226main repository.")
1227 (license license:agpl3+)))
1228
1229(define-public fdroidcl
1230 (package
1231 (name "fdroidcl")
1232 (version "0.8.1")
1233 (source
1234 (origin
1235 (method git-fetch)
1236 (uri (git-reference
1237 (url "https://github.com/Hoverth/fdroidcl")
1238 (commit (string-append "v" version))))
1239 (file-name (git-file-name name version))
1240 (sha256
1241 (base32 "1bflahcsjarv4v6r61knl5gc5iydh1lwvqjgffhxr4pis4qfsqsa"))
1242 ;; XXX: Reported upstream.
1243 ;; See: <https://github.com/Hoverth/fdroidcl/pull/92>.
1244 (patches (search-patches "fdroidcl-fix-tests.patch"))))
1245 (build-system go-build-system)
1246 (arguments
1247 (list
1248 #:install-source? #f
1249 #:import-path "mvdan.cc/fdroidcl"))
1250 (inputs
1251 (list go-github-com-kr-pretty
1252 go-github-com-pelletier-go-toml-v2
1253 go-github-com-rogpeppe-go-internal
1254 go-github-com-schollz-progressbar-v3))
1255 (home-page "https://github.com/Hoverth/fdroidcl")
1256 (synopsis "F-Droid desktop client")
1257 (description
1258 "While the Android client integrates with the system with regular update
1259checks and notifications, this is a simple command line client that talks to
1260connected devices via ADB.")
1261 (license license:bsd-3)))
1262
1263(define-public emacs-fdroid
1264 (package
1265 (name "emacs-fdroid")
1266 (version "0.1.1")
1267 (source (origin
1268 (method git-fetch)
1269 (uri (git-reference
1270 (url "https://github.com/migalmoreno/fdroid.el")
1271 (commit version)))
1272 (file-name (git-file-name name version))
1273 (sha256
1274 (base32
1275 "1gv4kfir12bbi17cm5hpx197m8dbw1xwqp0z6qb3vc0fdnyis35j"))))
1276 (build-system emacs-build-system)
1277 (arguments
1278 (list
1279 #:phases #~(modify-phases %standard-phases
1280 (add-after 'unpack 'patch-file-name
1281 (lambda* (#:key inputs #:allow-other-keys)
1282 (emacs-substitute-variables "fdroid.el"
1283 ("fdroid-program"
1284 (search-input-file inputs "/bin/fdroidcl"))))))))
1285 (inputs (list fdroidcl))
1286 (home-page "https://github.com/migalmoreno/fdroid.el")
1287 (synopsis "Manage F-Droid packages from Emacs")
1288 (description "This package is an Emacs interface to F-Droid. Its purpose
1289is to aid in the management of F-Droid packages for an Android device or an
1290emulator inside the comfort of Emacs.")
1291 (license license:gpl3+)))
1292
1293(define-public enjarify
1294 (package
1295 (name "enjarify")
1296 (version "1.0.3")
1297 (source
1298 (origin
1299 (method git-fetch)
1300 (uri (git-reference
1301 (url "https://github.com/Storyyeller/enjarify")
1302 (commit version)))
1303 (file-name (git-file-name name version))
1304 (patches
1305 (search-patches "enjarify-setup-py.patch"))
1306 (sha256
1307 (base32 "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk"))))
1308 (build-system pyproject-build-system)
1309 (arguments
1310 (list
1311 #:phases
1312 #~(modify-phases %standard-phases
1313 (add-before 'check 'fix-tests
1314 (lambda _
1315 (substitute* "enjarify/runtests.py"
1316 (("from \\.main") "from enjarify.main")
1317 (("from \\.jvm") "from enjarify.jvm"))
1318 ;; Upstream adjusted this test in commit:
1319 ;; 3ae884a6485af82d300515813f537685b08dd800
1320 (substitute* "tests/test2/expected.txt"
1321 (("^20") "0"))
1322 ;; Upstream removed this argument in order to support 32-bit
1323 ;; architectures. commit:
1324 ;; 4be0111d879aa95fdc0d9f24fe529f8c664d4093
1325 (substitute* "enjarify/runtests.py"
1326 (("java -Xss515m") "java "))))
1327 (add-after 'install 'install-enjarify-wrapper
1328 (lambda _
1329 (let ((bin (string-append #$output "/bin")))
1330 (install-file "enjarify.sh" bin)
1331 (symlink (string-append bin "/enjarify.sh")
1332 (string-append bin "/enjarify")))))
1333 (replace 'check
1334 (lambda* (#:key tests? test-flags #:allow-other-keys)
1335 (when tests?
1336 (invoke "python" "-m" "enjarify.runtests")))))))
1337 (native-inputs
1338 (list openjdk12
1339 python-setuptools))
1340 (home-page "https://github.com/Storyyeller/enjarify")
1341 (synopsis "Translate Dalvik bytecode to equivalent Java bytecode")
1342 (description
1343 "Android applications are Java programs that run on a customized virtual
1344machine, which is part of the Android operating system, the Dalvik VM. Their
1345bytecode differs from the bytecode of normal Java applications. Enjarify can
1346translate the Dalvik bytecode back to equivalent Java bytecode, which
1347simplifies the analysis of Android applications. It's an alternative fork of
1348not maintained Goole's project https://github.com/google/enjarify.")
1349 (license license:asl2.0)))
1350
1351(define-public android-file-transfer
1352 (package
1353 (name "android-file-transfer")
1354 (version "4.3")
1355 (source (origin
1356 (method git-fetch)
1357 (uri (git-reference
1358 (url
1359 "https://github.com/whoozle/android-file-transfer-linux/")
1360 (commit (string-append "v" version))))
1361 (file-name (git-file-name name version))
1362 (sha256
1363 (base32
1364 "1ianph8ivj0fxg1l7llid7gv4pbfb5j23b33j9gan6x7scr13q2h"))))
1365 (build-system qt-build-system)
1366 (arguments
1367 (list #:tests? #f)) ;there are no tests
1368 (inputs (list qtbase-5 qtwayland-5 fuse libxkbcommon))
1369 (native-inputs (list qttools-5 openssl readline))
1370 (home-page "https://whoozle.github.io/android-file-transfer-linux/")
1371 (synopsis "MTP client for Android devices")
1372 (description
1373 "This package provides a Qt graphical interface for transferring files
1374with Android devices using MTP. It also allows the Android device to be
1375mounted via FUSE.")
1376 (license license:lgpl2.1+)))
1377
1378(define-public simg2img
1379 (package
1380 (name "simg2img")
1381 (version "1.1.5")
1382 (source
1383 (origin
1384 (method git-fetch)
1385 (uri (git-reference
1386 (url "https://github.com/anestisb/android-simg2img")
1387 (commit version)))
1388 (file-name (git-file-name name version))
1389 (sha256
1390 (base32
1391 "0drwvqxbhajka580j93z8ldckhjlpr0i84nh20krdpxcp54xvldh"))))
1392 (build-system gnu-build-system)
1393 (arguments
1394 ;; The Makefile uses PREFIX to set the installation prefix.
1395 (list #:make-flags
1396 #~(list
1397 (string-append "PREFIX=" (assoc-ref %outputs "out")))
1398 #:tests? #f ; no tests provided upstream
1399 #:phases
1400 ;; There is no configure step.
1401 #~(modify-phases %standard-phases
1402 (delete 'configure)
1403 (add-before 'build 'patch-calloc-order
1404 ;; As of the 1.1.5 release, the calloc argument order is
1405 ;; wrong, and GCC 14 recognises this. We correct it here.
1406 ;; When updating this package, remove these patches
1407 ;; (fixed in master).
1408 (lambda _
1409 (substitute* "backed_block.cpp"
1410 (("calloc[(]sizeof[(]struct backed_block_list[)], 1[)]")
1411 "calloc(1, sizeof(struct backed_block_list))"))
1412 (substitute* "simg2simg.cpp"
1413 (("calloc[(]sizeof[(]struct sparse_file[*][)], files[)]")
1414 "calloc(files, sizeof(struct sparse_file*))"))
1415 (substitute* "sparse.cpp"
1416 (("calloc[(]sizeof[(]struct sparse_file[)], 1[)]")
1417 "calloc(1, sizeof(struct sparse_file))")))))))
1418 (inputs (list zlib))
1419 (home-page "https://github.com/anestisb/android-simg2img")
1420 (synopsis "Convert Android sparse images to raw ext4 images")
1421 (description
1422 "This package provides a standalone port of AOSP's libsparse that converts
1423Android sparse filesystem images into raw ext4 images, avoiding the need for
1424the full Android build chain.")
1425 (license license:asl2.0)))