projects/guix·blob bootstrap-team · refs

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