projects/guix·blob mpd-fix-groups · refs

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