projects/guix·blob rust-team · refs

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