1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Stefan Handschuh <handschuh.stefan@googlemail.com>
3 ;;; Copyright © 2015 Kai-Chung Yan <seamlikok@gmail.com>
4 ;;; Copyright © 2016, 2020 Marius Bakke <mbakke@fastmail.com>
5 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
6 ;;; Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
7 ;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
8 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2019, 2020 Andreas Enge <andreas@enge.fr>
11 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
13 ;;; Copyright © 2020 Sergey Trofimov <sarg@sarg.org.ru>
15 ;;; This file is part of GNU Guix.
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages android)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix build-system android-ndk)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system go)
37 #:use-module (guix build-system python)
38 #:use-module (guix build-system trivial)
39 #:use-module ((guix licenses) #:prefix license:)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages docker)
44 #:use-module (gnu packages gcc)
45 #:use-module (gnu packages gnupg)
46 #:use-module (gnu packages golang)
47 #:use-module (gnu packages java)
48 #:use-module (gnu packages linux)
49 #:use-module (gnu packages pcre)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-crypto)
52 #:use-module (gnu packages python-web)
53 #:use-module (gnu packages python-xyz)
54 #:use-module (gnu packages selinux)
55 #:use-module (gnu packages serialization)
56 #:use-module (gnu packages ssh)
57 #:use-module (gnu packages tls)
58 #:use-module (gnu packages version-control)
59 #:use-module (gnu packages virtualization)
60 #:use-module (gnu packages xdisorg)
61 #:use-module (gnu packages xml))
63 (define-public android-make-stub
65 (name "android-make-stub")
71 (url "https://github.com/daym/android-make-stub")
72 (commit (string-append "v" version))))
73 (file-name (string-append "android-make-stub-"
77 "0y1b2x96d37n6f1bp6dcx08bn08zac0cylmbfsx6mf2nahc02fhc"))))
78 (build-system gnu-build-system)
80 `(#:tests? #f ; None exist.
82 (modify-phases %standard-phases
86 (lambda* (#:key outputs #:allow-other-keys)
87 (let* ((out (assoc-ref outputs "out")))
88 (invoke "make" (string-append "prefix=" out) "install")
90 (home-page "https://github.com/daym/android-make-stub")
91 (synopsis "Stubs for the @command{make} system of the Android platform")
92 (description "@code{android-make-stub} provides stubs for the
93 @command{make} system of the Android platform. This allows us to
94 use their packages mostly unmodified in our Android NDK build system.")
95 (license license:asl2.0)))
97 (define-public android-googletest
98 (package (inherit googletest)
99 (name "android-googletest")
105 (url "https://github.com/google/googletest")
106 (commit (string-append "release-" version))))
107 (file-name (git-file-name name version))
110 "0bjlljmbf8glnd9qjabx73w6pd7ibv43yiyngqvmvgxsabzr8399"))))
112 `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
114 (modify-phases %standard-phases
115 (add-after 'install 'install-host-libraries
116 (lambda* (#:key outputs #:allow-other-keys)
117 (let* ((out (assoc-ref outputs "out"))
118 (lib (string-append out "/lib")))
119 (symlink "libgtest.so"
120 (string-append lib "/libgtest_host.so"))
121 (symlink "libgmock.so"
122 (string-append lib "/libgmock_host.so"))
125 ;; The Makefiles that we add are largely based on the Debian
126 ;; packages. They are licensed under GPL-2 and have copyright:
127 ;; 2012, Stefan Handschuh <handschuh.stefan@googlemail.com>
128 ;; 2015, Kai-Chung Yan <seamlikok@gmail.com>
129 ;; Big thanks to them for laying the groundwork.
131 ;; The version tag is consistent between all repositories.
132 (define-public (android-platform-version) "7.1.2_r36")
134 (define-public (android-platform-system-core version)
138 (url "https://android.googlesource.com/platform/system/core")
139 (commit (string-append "android-" version))))
140 (file-name (string-append "android-platform-system-core-"
141 version "-checkout"))
144 "1krnc2b9zfkzpdgs1dcbji59nszlx2qr723pg89m52622czc06hg"))
146 (search-patches "libbase-use-own-logging.patch"
147 "libbase-fix-includes.patch"
148 "libutils-remove-damaging-includes.patch"
149 "libutils-add-includes.patch"
150 "adb-add-libraries.patch"
151 "libziparchive-add-includes.patch"))))
153 (define (android-platform-system-extras version)
157 (url "https://android.googlesource.com/platform/system/extras")
158 (commit (string-append "android-" version))))
159 (file-name (string-append "android-platform-system-extras-"
160 version "-checkout"))
163 "18130c23ybqcpgjc5v6f8kdbv2xn39hyiaj17dzldjb9rlwzcyy9"))))
165 (define (android-platform-bionic version)
169 (url "https://android.googlesource.com/platform/bionic")
170 (commit (string-append "android-" version))))
171 (file-name (string-append "android-platform-bionic-"
172 version "-checkout"))
175 "15r4s20d7vw022f8vrc3jbghmqwdcqzprl7i2bfvdkz8z76wc1ps"))))
177 (define (android-platform-external version subdirectory checksum)
182 (string-append "https://android.googlesource.com/platform/external/"
184 (commit (string-append "android-" version))))
185 (file-name (string-append "android-platform-system-external-" subdirectory "-"
186 version "-checkout"))
191 (define-public android-liblog
193 (name "android-liblog")
194 (version (android-platform-version))
195 (source (android-platform-system-core version))
196 (build-system android-ndk-build-system)
198 `(#:make-flags '("LDLIBS=-lpthread")
200 (modify-phases %standard-phases
201 (add-after 'unpack 'enter-source
202 (lambda _ (chdir "liblog") #t))
203 (add-after 'install 'ldconfig
204 (lambda* (#:key outputs #:allow-other-keys)
205 (let ((out (assoc-ref outputs "out")))
206 (symlink "liblog.so.0" (string-append out "/lib/liblog.so"))
208 (add-after 'install 'install-headers
209 (lambda* (#:key outputs #:allow-other-keys)
210 (let ((out (assoc-ref outputs "out")))
212 "../include/log" (string-append out "/include/log"))
213 ;; For android/log.h, the only header in the android directory.
215 "../include/android" (string-append out "/include/android")))
217 (home-page "https://developer.android.com/")
218 (synopsis "Logging library from the Android platform.")
219 (description "@code{liblog} represents an interface to the volatile Android
220 Logging system for NDK (Native) applications and libraries and contain
221 interfaces for either writing or reading logs. The log buffers are divided up
222 in Main, System, Radio and Events sub-logs.")
223 (license license:asl2.0)))
225 (define android-libbase
227 (name "android-libbase")
228 (version (android-platform-version))
229 (source (android-platform-system-core version))
230 (build-system android-ndk-build-system)
232 `(#:tests? #f ; Test failure: logging.UNIMPLEMENTED
234 (modify-phases %standard-phases
235 (add-after 'unpack 'enter-source
236 (lambda _ (chdir "base") #t)))))
237 (inputs `(("android-liblog" ,android-liblog)))
238 (home-page "https://developer.android.com/")
239 (synopsis "Android platform base library")
240 (description "@code{libbase} is a library in common use by the
241 various Android core host applications.")
242 (license license:asl2.0)))
244 (define-public android-libcutils
246 (name "android-libcutils")
247 (version (android-platform-version))
248 (source (android-platform-system-core version))
249 (build-system gnu-build-system)
251 `(#:tests? #f ; TODO.
253 (modify-phases %standard-phases
254 (add-after 'unpack 'enter-source
255 (lambda _ (chdir "libcutils") #t))
256 (add-after 'enter-source 'create-Makefile
258 ;; No useful makefile is shipped, so we create one.
259 (with-output-to-file "Makefile"
264 "SOURCES = load_file.o socket_local_client_unix.o"
265 " socket_loopback_client_unix.o socket_network_client_unix.o"
266 " socket_loopback_server_unix.o socket_local_server_unix.o"
267 " sockets_unix.o socket_inaddr_any_server_unix.o"
272 "CXXFLAGS += -fPIC\n"
273 "CPPFLAGS += -Iinclude -I../include\n"
274 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
276 "build: $(SOURCES)\n"
277 " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
282 (lambda* (#:key outputs #:allow-other-keys)
283 (let* ((out (assoc-ref outputs "out"))
284 (lib (string-append out "/lib"))
285 (include (string-append out "/include")))
286 (install-file "libcutils.so.0" lib)
287 (with-directory-excursion lib
288 (symlink "libcutils.so.0" "libcutils.so"))
289 (copy-recursively "../include/cutils"
290 (string-append include "/cutils"))
292 (home-page "https://developer.android.com/")
293 (synopsis "Android platform c utils library")
294 (description "@code{libcutils} is a library in common use by the
295 various Android core host applications.")
296 (license license:asl2.0)))
298 (define-public android-libsparse
300 (name "android-libsparse")
301 (version (android-platform-version))
302 (source (android-platform-system-core version))
303 (build-system android-ndk-build-system)
305 `(#:make-flags '("CFLAGS=-Wno-error"
306 "CXXFLAGS=-fpermissive -Wno-error")
308 (modify-phases %standard-phases
309 (add-after 'unpack 'enter-source
310 (lambda _ (chdir "libsparse") #t)))))
313 (home-page "https://developer.android.com/")
314 (synopsis "Android platform sparse library")
315 (description "@code{android-libsparse} is a library in common use by the
316 various Android core host applications.")
317 (license license:asl2.0)))
319 (define-public android-libziparchive
321 (name "android-libziparchive")
322 (version (android-platform-version))
323 (source (android-platform-system-core version))
324 (build-system android-ndk-build-system)
326 `(#:make-flags '("CFLAGS=-Wno-error"
327 "CXXFLAGS=-fpermissive -Wno-error")
329 (modify-phases %standard-phases
330 (add-after 'unpack 'enter-source
331 (lambda _ (chdir "libziparchive") #t))
332 (add-before 'check 'setenv
334 (setenv "ziparchive_tests_host_PARAMS" "--test_data_dir=testdata")
336 (add-after 'install 'install-headers
337 (lambda* (#:key inputs outputs #:allow-other-keys)
338 (let ((out (assoc-ref outputs "out")))
339 (copy-recursively "../include/ziparchive"
340 (string-append out "/include/ziparchive"))
345 `(("android-libbase" ,android-libbase)
346 ("android-libutils" ,android-libutils)
347 ("android-liblog" ,android-liblog)))
348 (home-page "https://developer.android.com/")
349 (synopsis "Android platform ZIP library")
350 (description "@code{android-libziparchive} is a library in common use by the
351 various Android core host applications.")
352 (license license:asl2.0)))
357 (version (android-platform-version))
358 (source (android-platform-system-core version))
359 (build-system android-ndk-build-system)
361 `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
363 (list "CFLAGS=-Wno-error"
364 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
365 (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
366 "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
368 (modify-phases %standard-phases
369 (add-after 'unpack 'enter-source
370 (lambda _ (chdir "adb") #t))
371 (add-after 'enter-source 'glibc-compat
373 ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
374 (substitute* "usb_linux.cpp"
375 (("#include <sys/types.h>" all)
376 (string-append all "\n#include <sys/sysmacros.h>\n")))
378 (add-after 'enter-source 'make-libs-available
379 (lambda* (#:key inputs outputs #:allow-other-keys)
380 (substitute* "Android.mk"
381 (("libcrypto_static") "libcrypto"))
383 (add-after 'install 'install-headers
384 (lambda* (#:key inputs outputs #:allow-other-keys)
385 (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
388 `(("android-libbase" ,android-libbase)
389 ("android-libcutils" ,android-libcutils)
390 ("android-liblog" ,android-liblog)
391 ("openssl" ,openssl-1.0)))
392 (home-page "https://developer.android.com/studio/command-line/adb.html")
393 (synopsis "Android Debug Bridge")
395 "@command{adb} is a versatile command line tool that lets you communicate
396 with an emulator instance or connected Android device. It facilitates a variety
397 of device actions, such as installing and debugging apps, and it provides access
398 to a Unix shell that can run commands on the connected device or emulator.")
399 (license license:asl2.0)))
401 (define-public mkbootimg
404 (version (android-platform-version))
406 (inherit (android-platform-system-core version))))
407 (build-system python-build-system)
411 (modify-phases %standard-phases
412 (add-after 'unpack 'enter-source
413 (lambda _ (chdir "mkbootimg") #t))
417 (lambda* (#:key outputs #:allow-other-keys)
418 (let* ((out (assoc-ref outputs "out"))
419 (bin (string-append out "/bin"))
420 (include (string-append out "/include")))
421 (install-file "mkbootimg" bin)
422 (install-file "bootimg.h" include)
424 (home-page "https://developer.android.com/studio/command-line/adb.html")
425 (synopsis "Tool to create Android boot images")
426 (description "This package provides a tool to create Android Boot
428 (license license:asl2.0)))
430 (define-public android-safe-iop
432 (name "android-safe-iop")
433 (version (android-platform-version))
434 (source (android-platform-external version "safe-iop"
435 "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw"))
436 (build-system android-ndk-build-system)
438 `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error")
440 (modify-phases %standard-phases
441 (add-before 'build 'patch-host
443 ;; TODO: Cross-compile.
444 (substitute* "Android.mk"
445 (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY"))
447 (home-page "https://developer.android.com/")
448 (synopsis "Safe integers in C")
449 (description "@code{android-safe-iop} provides a set of functions for
450 performing and checking safe integer operations. Ensure that integer
451 operations do not result in silent overflow.")
452 (license license:bsd-2)))
454 (define-public android-bionic-uapi
456 (name "android-bionic-uapi")
457 (version (android-platform-version))
458 (source (android-platform-bionic version))
459 (build-system android-ndk-build-system)
462 (modify-phases %standard-phases
463 (add-after 'unpack 'enter-source
464 (lambda _ (chdir "libc") #t))
470 (lambda* (#:key outputs #:allow-other-keys)
471 (let* ((out (assoc-ref outputs "out"))
472 (out-sys (string-append out "/include/sys")))
474 (install-file "include/sys/system_properties.h" out-sys)
475 (install-file "include/sys/_system_properties.h" out-sys)
476 (copy-recursively "kernel/uapi" (string-append out "/include"))
478 (home-page "https://developer.android.com/")
479 (synopsis "Android Linux API that is safe for user space")
480 (description "@code{android-bionic-uapi} provides the part of the Linux API
481 that is safe to use for user space. It also includes
482 @code{system_properties.h} and @code{_system_properties.h}.")
483 (license license:asl2.0)))
485 (define-public android-libselinux
487 (name "android-libselinux")
488 (version (android-platform-version))
490 (android-platform-external version "libselinux"
491 "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
492 (build-system android-ndk-build-system)
494 ;; See logd/Android.mk for the *_LOG_TAG values.
495 `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
497 "-I core/libpackagelistparser/include "
498 "-DAUDITD_LOG_TAG=1003 "
499 "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
500 "LDFLAGS=-L . -lpcre")
502 (modify-phases %standard-phases
503 (add-after 'unpack-core 'patch-HOST
505 ;; gettid duplicates otherwise.
506 (substitute* "src/procattr.c"
507 (("#ifdef HOST") "#ifdef XXX"))
510 `(("openssl" ,openssl)))
512 `(("android-bionic-uapi" ,android-bionic-uapi)
513 ;; pcre is inlined by our package.
515 (home-page "https://developer.android.com/")
516 (synopsis "Android version of the SELinux libraries and utilities")
518 "The libselinux library provides an API for SELinux applications to get
519 and set process and file security contexts, and to obtain security policy
520 decisions. It is required for any applications that use the SELinux API, and
521 used by all applications that are SELinux-aware. This package also includes
522 the core SELinux management utilities.")
523 (license license:public-domain)))
525 (define-public android-ext4-utils
527 (name "android-ext4-utils")
528 (version (android-platform-version))
529 (source (android-platform-system-extras version))
530 (build-system android-ndk-build-system)
533 (list (string-append "CPPFLAGS="
536 (assoc-ref %build-inputs "android-libselinux")
538 "-I " (assoc-ref %build-inputs "android-libsparse")
540 "-I " (assoc-ref %build-inputs "android-libcutils")
542 "-I " (assoc-ref %build-inputs "android-liblog") "/include "
543 "-I ../core/include")
545 "install-libext4_utils_host.a"
546 (string-append "prefix=" (assoc-ref %outputs "out")))
548 (modify-phases %standard-phases
549 (add-after 'unpack 'unpack-core
550 (lambda* (#:key inputs #:allow-other-keys)
552 (with-directory-excursion "core"
553 (invoke "tar" "axf" (assoc-ref inputs "android-core")
554 "--strip-components=1"))
556 (add-after 'unpack-core 'enter-source
557 (lambda _ (chdir "ext4_utils") #t))
559 (lambda* (#:key inputs outputs #:allow-other-keys)
560 (let ((out (assoc-ref outputs "out")))
561 (copy-recursively "." (string-append out "/include")))
564 `(("android-libcutils" ,android-libcutils)
565 ("android-liblog" ,android-liblog)
566 ("android-libselinux" ,android-libselinux)
567 ("android-libsparse" ,android-libsparse)
570 `(("android-core" ,(android-platform-system-core version))))
571 (home-page "https://developer.android.com/")
572 (synopsis "Android ext4 file system utilities")
573 (description "@code{android-ext4-utils} is a library in common use by the
575 (license license:asl2.0)))
577 (define-public android-f2fs-utils
579 (name "android-f2fs-utils")
580 (version (android-platform-version))
581 (source (android-platform-system-extras version))
582 (build-system android-ndk-build-system)
585 (modify-phases %standard-phases
586 (add-after 'unpack 'enter-source
587 (lambda _ (chdir "f2fs_utils") #t))
588 (add-after 'install 'install-headers
589 (lambda* (#:key inputs outputs #:allow-other-keys)
590 (copy-recursively "." (string-append (assoc-ref outputs "out")
593 (add-after 'install 'install-shell-scripts
594 (lambda* (#:key outputs #:allow-other-keys)
595 (let* ((out (assoc-ref outputs "out"))
596 (bin (string-append out "/bin")))
597 (patch-shebang "mkf2fsuserimg.sh")
598 (substitute* "mkf2fsuserimg.sh"
599 (("make_f2fs") (string-append bin "/make_f2fs")))
600 (install-file "mkf2fsuserimg.sh" bin)
603 `(("f2fs-tools" ,f2fs-tools-1.7)
604 ("android-libselinux" ,android-libselinux)
605 ("android-libsparse" ,android-libsparse)
606 ("android-libcutils" ,android-libcutils)
608 (home-page "https://developer.android.com/")
609 (synopsis "Android f2fs utils")
610 (description "@code{android-f2fs-utils} is a library in common use by the
611 Android core. It allows the user to create images for the @code{f2fs} Flash
613 (license license:asl2.0)))
615 (define-public android-libutils
617 (name "android-libutils")
618 (version (android-platform-version))
619 (source (android-platform-system-core version))
620 (build-system android-ndk-build-system)
623 #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
625 (modify-phases %standard-phases
626 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
627 (lambda* (#:key inputs #:allow-other-keys)
628 ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent it from
629 ;; shadowing the version of GCC provided in native-inputs.
630 (let ((gcc (assoc-ref inputs "gcc")))
631 (setenv "CPLUS_INCLUDE_PATH"
633 (delete (string-append gcc "/include/c++")
634 (string-split (getenv "CPLUS_INCLUDE_PATH")
638 (add-after 'unpack 'enter-source
639 (lambda _ (chdir "libutils") #t))
640 (add-after 'install 'install-headers
641 (lambda* (#:key inputs outputs #:allow-other-keys)
642 (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
644 `(("android-safe-iop" ,android-safe-iop)
645 ("android-libcutils" ,android-libcutils)))
647 `(("android-bionic-uapi" ,android-bionic-uapi)
648 ("android-liblog" ,android-liblog)
649 ("gcc@5" ,gcc-5))) ; XXX: fails to build with GCC 7
650 (home-page "https://developer.android.com/")
651 (synopsis "Android utility library")
652 (description "@code{android-libutils} provides utilities for Android NDK developers.")
653 (license license:asl2.0)))
655 (define-public fastboot
658 (version (android-platform-version))
659 (source (android-platform-system-core version))
660 (build-system android-ndk-build-system)
663 (modify-phases %standard-phases
664 (add-after 'unpack 'enter-source
668 (add-after 'enter-source 'patch-source
670 (substitute* "Android.mk"
671 (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
674 (lambda* (#:key outputs #:allow-other-keys)
675 (let* ((out (assoc-ref outputs "out"))
676 (lib (string-append out "/lib"))
677 (bin (string-append out "/bin")))
678 (install-file "fastboot" bin)
682 ("android-safe-iop" ,android-safe-iop)
683 ("android-ext4-utils" ,android-ext4-utils)
684 ("android-f2fs-utils" ,android-f2fs-utils)
685 ("android-libbase" ,android-libbase)
686 ("android-libcutils" ,android-libcutils)
687 ("android-liblog" ,android-liblog)
688 ("android-libutils" ,android-libutils)
689 ("android-libsparse" ,android-libsparse)
690 ("android-libziparchive" ,android-libziparchive)
691 ("android-libselinux" ,android-libselinux)
693 ("mkbootimg" ,mkbootimg)
697 (home-page "https://developer.android.com/studio/command-line/")
698 (synopsis "Android image flasher")
700 "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
701 (license license:asl2.0)))
703 (define-public android-udev-rules
705 (name "android-udev-rules")
711 (url "https://github.com/M0Rf30/android-udev-rules")
713 (file-name (git-file-name name version))
715 (base32 "0cf5br8x6iwxc1cifv0i1klw7skgs8hghdx6qlqby68kyqg81bb2"))))
716 (build-system trivial-build-system)
717 (native-inputs `(("source" ,source)))
719 '(#:modules ((guix build utils))
722 (use-modules (guix build utils))
723 (let ((source (assoc-ref %build-inputs "source")))
724 (install-file (string-append source "/51-android.rules")
725 (string-append %output "/lib/udev/rules.d"))
727 (home-page "https://github.com/M0Rf30/android-udev-rules")
728 (synopsis "udev rules for Android devices")
729 (description "Provides a set of udev rules to allow using Android devices
730 with tools such as @command{adb} and @command{fastboot} without root
731 privileges. This package is intended to be added as a rule to the
732 @code{udev-service-type} in your @code{operating-system} configuration.
733 Additionally, an @code{adbusers} group must be defined and your user added to
736 @emph{Simply installing this package will not have any effect.} It is meant
737 to be passed to the @code{udev} service.")
738 (license license:gpl3+)))
740 (define-public git-repo
748 (url "https://gerrit.googlesource.com/git-repo")
749 (commit (string-append "v" version))))
750 (file-name (string-append "git-repo-" version "-checkout"))
752 (base32 "0khg1731927gvin73dcbw1657kbfq4k7agla5rpzqcnwkk5agzg3"))))
753 (build-system python-build-system)
756 (modify-phases %standard-phases
757 (add-before 'build 'set-executable-paths
758 (lambda* (#:key inputs outputs #:allow-other-keys)
759 (let* ((out (assoc-ref outputs "out"))
760 (git (assoc-ref inputs "git"))
761 (ssh (assoc-ref inputs "ssh")))
762 (substitute* '("repo" "git_command.py")
764 (string-append "GIT = '" git "/bin/git'")))
765 (substitute* "git_config.py"
766 ((" command_base = \\['ssh',")
767 (string-append " command_base = ['" ssh "/bin/ssh',")))
769 (add-before 'build 'do-not-self-update
770 (lambda* (#:key outputs #:allow-other-keys)
771 ;; Setting the REPO_MAIN variable to an absolute file name is
772 ;; enough to have _FindRepo return the store main.py file. The
773 ;; self update mechanism is activated with the call to _Init() in
774 ;; main(), so we bypass it.
776 ;; Ticket requesting upstream to provide a mean to disable the
777 ;; self update mechanism:
778 ;; https://bugs.chromium.org/p/gerrit/issues/detail?id=12407.
779 (let* ((out (assoc-ref outputs "out"))
780 (repo-main (string-append out "/share/git-repo/main.py")))
783 (format #f "REPO_MAIN = ~s~%" repo-main))
784 ((" _Init\\(args, gitc_init=\\(cmd ==.*" all)
785 (string-append "True #" all)))
786 ;; Prevent repo from trying to git describe its version from
787 ;; the (disabled) self updated copy.
788 (substitute* "git_command.py"
789 (("ver = getattr\\(RepoSourceVersion.*")
790 (format #f "ver = ~s~%" ,version)))
791 (substitute* "subcmds/version.py"
793 (format #f "rp_ver = ~s~%" ,version)))
794 ;; Prevent repo from adding its (disabled) self update copy to
795 ;; the list of projects to fetch when using 'repo sync'.
796 (substitute* "subcmds/sync.py"
797 (("to_fetch\\.extend\\(all_projects\\).*" all)
798 (string-append "#" all))
799 (("self\\._Fetch\\(to_fetch")
800 "self._Fetch(all_projects")
801 (("_PostRepoFetch\\(rp, opt\\.repo_verify).*" all)
802 (string-append "#" all))))))
803 (delete 'build) ; nothing to build
804 (add-before 'check 'configure-git
806 (setenv "HOME" (getcwd))
807 (invoke "git" "config" "--global" "user.email" "you@example.com")
808 (invoke "git" "config" "--global" "user.name" "Your Name")))
811 (invoke "./run_tests")))
813 (lambda* (#:key outputs #:allow-other-keys)
814 (let* ((out (assoc-ref outputs "out"))
815 (bin-dir (string-append out "/bin"))
816 (repo-dir (string-append out "/share/" ,name)))
819 (copy-recursively "." repo-dir)
820 (delete-file-recursively (string-append repo-dir "/tests"))
821 (symlink (string-append repo-dir "/repo")
822 (string-append bin-dir "/repo"))
825 ;; TODO: Add git-remote-persistent-https once it is available in guix
829 `(("pytest" ,python-pytest)))
830 (home-page "https://code.google.com/p/git-repo/")
831 (synopsis "Helps to manage many Git repositories.")
832 (description "Repo is a tool built on top of Git. Repo helps manage many
833 Git repositories, does the uploads to revision control systems, and automates
834 parts of the development workflow. Repo is not meant to replace Git, only to
835 make it easier to work with Git. The repo command is an executable Python
836 script that you can put anywhere in your path.")
837 (license license:asl2.0)))
839 (define-public abootimg
846 (uri (string-append "http://http.debian.net/debian/pool/main/a/abootimg/"
847 "abootimg_" version ".orig.tar.gz"))
849 (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba"))))
850 (build-system gnu-build-system)
854 (modify-phases %standard-phases
860 (lambda* (#:key outputs #:allow-other-keys)
861 (let* ((out (assoc-ref outputs "out"))
862 (bin (string-append out "/bin")))
863 (install-file "abootimg" bin)
866 `(("libblkid" ,util-linux "lib")))
867 (home-page "https://ac100.grandou.net/abootimg")
868 (synopsis "Tool for manipulating Android Boot Images")
869 (description "This package provides a tool for manipulating old Android
870 Boot Images. @code{abootimg} can work directly on block devices, or, the
871 safest way, on a file image.")
872 (license license:gpl2+)))
874 (define-public python-androguard
876 (name "python-androguard")
880 ;; The pypi release doesn't have the tests, but the tests use
881 ;; packaged binaries, so we skip them.
883 (uri (pypi-uri "androguard" version))
886 "0ndsw00pkyda4i2s3wi5ap8gbk6a9d23xhhxpdbk02padv8sxkfv"))))
887 (build-system python-build-system)
890 (modify-phases %standard-phases
892 ;; Adapted from .travis.yml
894 (invoke "nosetests" "--with-coverage" "--with-timer"
895 "--timer-top-n" "50"))))))
897 `(("python-codecov" ,python-codecov)
898 ("python-coverage" ,python-coverage)
899 ("python-mock" ,python-mock)
900 ("python-nose" ,python-nose)
901 ("python-nose-timer" ,python-nose-timer)))
903 `(("python-asn1crypto" ,python-asn1crypto)
904 ("python-colorama" ,python-colorama)
905 ("python-future" ,python-future)
906 ("python-ipython" ,python-ipython)
907 ("python-lxml" ,python-lxml)
908 ("python-matplotlib" ,python-matplotlib)
909 ("python-networkx" ,python-networkx)
910 ("python-pygments" ,python-pygments)
911 ("python-pyperclip" ,python-pyperclip)))
912 (home-page "https://github.com/androguard/androguard")
913 (synopsis "Python tool to play with Android files")
915 "Androguard is a full Python tool to manipulate Android files. It is
916 useful for reverse engineering, analysis of Android applications and more.")
917 (license license:asl2.0)))
919 (define-public fdroidserver
921 (name "fdroidserver")
926 (uri (pypi-uri "fdroidserver" version))
929 "0m07f791z45w7r2dzx4yb6s54b3c3wykm3w9hn25p2jcyax082a2"))))
930 (build-system python-build-system)
933 (modify-phases %standard-phases
934 (add-after 'unpack 'fix-versioning
936 (substitute* "setup.py"
937 (("0.2.1") ,(package-version python-pyasn1-modules))
938 ;; The dependency on docker has been removed upstream by
939 ;; a fairly large patch:
940 ;; https://gitlab.com/fdroid/fdroidserver/-/commit/89614851250c79a05db84070feca6dea033af334
941 ;; that is not in a release yet. It appears we can compile with
943 (("docker-py >= 1.9, < 2.0") "docker >= 1.9"))
946 `(("python-androguard" ,python-androguard)
947 ("python-apache-libcloud" ,python-apache-libcloud)
948 ("python-clint" ,python-clint)
949 ("python-defusedxml" ,python-defusedxml)
950 ("python-docker" ,python-docker)
951 ("python-gitpython" ,python-gitpython)
952 ("python-mwclient" ,python-mwclient)
953 ("python-paramiko" ,python-paramiko)
954 ("python-pillow" ,python-pillow)
955 ("python-pyasn1" ,python-pyasn1)
956 ("python-pyasn1-modules" ,python-pyasn1-modules)
957 ("python-pyyaml" ,python-pyyaml)
958 ("python-qrcode" ,python-qrcode)
959 ("python-ruamel.yaml" ,python-ruamel.yaml)
960 ("python-requests" ,python-requests)
961 ("python-vagrant" ,python-vagrant)))
963 `(("python-babel" ,python-babel)
964 ("python-bcrypt" ,python-bcrypt)
965 ("python-docker-pycreds" ,python-docker-pycreds)
966 ("python-pynacl" ,python-pynacl)
967 ("python-websocket-client" ,python-websocket-client)))
968 (home-page "https://f-droid.org")
969 (synopsis "F-Droid server tools")
971 "The F-Droid server tools provide various scripts and tools that are used
972 to maintain F-Droid, the repository of free Android applications. You can use
973 these same tools to create your own additional or alternative repository for
974 publishing, or to assist in creating, testing and submitting metadata to the
976 (license license:agpl3+)))
978 (define-public fdroidcl
985 (url "https://github.com/mvdan/fdroidcl")
986 (commit (string-append "v" version))))
987 (file-name (git-file-name name version))
989 (base32 "1rxcdyy2j34z0ql9d62w7ivsch9xihjnpb1z9kgy9q46vl8zhhy0"))))
990 (build-system go-build-system)
992 `(#:import-path "mvdan.cc/fdroidcl"
993 #:tests? #f ; TODO: Inputs missing.
994 #:install-source? #f))
996 `(("go-github-com-kr-pretty" ,go-github-com-kr-pretty)))
998 ; `(("go-github-com-rogpeppe-go-internal-testscript"
999 ; ,go-github-com-rogpeppe-go-internal-testscript)))
1000 (synopsis "F-Droid desktop client")
1002 "While the Android client integrates with the system with regular update
1003 checks and notifications, this is a simple command line client that talks to
1004 connected devices via ADB.")
1005 (home-page "https://github.com/mvdan/fdroidcl")
1006 (license license:bsd-3)))
1008 (define-public enjarify
1012 (home-page "https://github.com/Storyyeller/enjarify")
1019 (file-name (git-file-name name version))
1021 (search-patches "enjarify-setup-py.patch"))
1024 "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk"))))
1025 (build-system python-build-system)
1028 (modify-phases %standard-phases
1029 (add-after 'unpack 'enjarify-wrapper-inherit-pythonpath
1030 ;; enjarify sets PYTHONPATH from a shell script, overwriting
1031 ;; PYTHONPATH set from guix. Comment out this line.
1033 (substitute* "enjarify.sh"
1034 (("export PYTHONPATH") "# export PYTHONPATH"))
1036 (add-before 'check 'fixup-expected-test-results
1037 ;; Upstream adjusted this test in commit:
1038 ;; 3ae884a6485af82d300515813f537685b08dd800
1040 (substitute* "tests/test2/expected.txt"
1043 (add-before 'check 'drop-java-xss-argument
1044 ;; Upstream removed this argument in order to support 32-bit
1045 ;; architectures. commit: 4be0111d879aa95fdc0d9f24fe529f8c664d4093
1047 (substitute* "enjarify/runtests.py"
1048 (("java -Xss515m") "java "))
1050 (add-after 'install 'install-enjarify-wrapper
1051 (lambda* (#:key outputs #:allow-other-keys)
1052 (let* ((out (assoc-ref outputs "out")))
1053 (mkdir-p (string-append out "/bin/"))
1054 (copy-file "enjarify.sh" (string-append out "/bin/enjarify"))
1056 (native-inputs `(("openjdk" ,openjdk12)))
1057 (synopsis "Translate Dalvik bytecode to equivalent Java bytecode")
1058 (description "Android applications are Java programs that run on a
1059 customized virtual machine, which is part of the Android operating system, the
1060 Dalvik VM. Their bytecode differs from the bytecode of normal Java
1061 applications. Enjarify can translate the Dalvik bytecode back to equivalent
1062 Java bytecode, which simplifies the analysis of Android applications.")
1063 (license license:asl2.0)))