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>
14 ;;; This file is part of GNU Guix.
16 ;;; GNU Guix is free software; you can redistribute it and/or modify it
17 ;;; under the terms of the GNU General Public License as published by
18 ;;; the Free Software Foundation; either version 3 of the License, or (at
19 ;;; your option) any later version.
21 ;;; GNU Guix is distributed in the hope that it will be useful, but
22 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;;; GNU General Public License for more details.
26 ;;; You should have received a copy of the GNU General Public License
27 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29 (define-module (gnu packages android)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system android-ndk)
35 #:use-module (guix build-system python)
36 #:use-module (guix build-system trivial)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages docker)
42 #:use-module (gnu packages gcc)
43 #:use-module (gnu packages gnupg)
44 #:use-module (gnu packages java)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages pcre)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages python-crypto)
49 #:use-module (gnu packages python-web)
50 #:use-module (gnu packages python-xyz)
51 #:use-module (gnu packages selinux)
52 #:use-module (gnu packages serialization)
53 #:use-module (gnu packages ssh)
54 #:use-module (gnu packages tls)
55 #:use-module (gnu packages version-control)
56 #:use-module (gnu packages virtualization)
57 #:use-module (gnu packages xdisorg)
58 #:use-module (gnu packages xml))
60 (define-public android-make-stub
62 (name "android-make-stub")
68 (url "https://github.com/daym/android-make-stub")
69 (commit (string-append "v" version))))
70 (file-name (string-append "android-make-stub-"
74 "0y1b2x96d37n6f1bp6dcx08bn08zac0cylmbfsx6mf2nahc02fhc"))))
75 (build-system gnu-build-system)
77 `(#:tests? #f ; None exist.
79 (modify-phases %standard-phases
83 (lambda* (#:key outputs #:allow-other-keys)
84 (let* ((out (assoc-ref outputs "out")))
85 (invoke "make" (string-append "prefix=" out) "install")
87 (home-page "https://github.com/daym/android-make-stub")
88 (synopsis "Stubs for the @command{make} system of the Android platform")
89 (description "@code{android-make-stub} provides stubs for the
90 @command{make} system of the Android platform. This allows us to
91 use their packages mostly unmodified in our Android NDK build system.")
92 (license license:asl2.0)))
94 (define-public android-googletest
95 (package (inherit googletest)
96 (name "android-googletest")
102 (url "https://github.com/google/googletest")
103 (commit (string-append "release-" version))))
104 (file-name (git-file-name name version))
107 "0bjlljmbf8glnd9qjabx73w6pd7ibv43yiyngqvmvgxsabzr8399"))))
109 `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
111 (modify-phases %standard-phases
112 (add-after 'install 'install-host-libraries
113 (lambda* (#:key outputs #:allow-other-keys)
114 (let* ((out (assoc-ref outputs "out"))
115 (lib (string-append out "/lib")))
116 (symlink "libgtest.so"
117 (string-append lib "/libgtest_host.so"))
118 (symlink "libgmock.so"
119 (string-append lib "/libgmock_host.so"))
122 ;; The Makefiles that we add are largely based on the Debian
123 ;; packages. They are licensed under GPL-2 and have copyright:
124 ;; 2012, Stefan Handschuh <handschuh.stefan@googlemail.com>
125 ;; 2015, Kai-Chung Yan <seamlikok@gmail.com>
126 ;; Big thanks to them for laying the groundwork.
128 ;; The version tag is consistent between all repositories.
129 (define-public (android-platform-version) "7.1.2_r36")
131 (define-public (android-platform-system-core version)
135 (url "https://android.googlesource.com/platform/system/core")
136 (commit (string-append "android-" version))))
137 (file-name (string-append "android-platform-system-core-"
138 version "-checkout"))
141 "1krnc2b9zfkzpdgs1dcbji59nszlx2qr723pg89m52622czc06hg"))
143 (search-patches "libbase-use-own-logging.patch"
144 "libbase-fix-includes.patch"
145 "libutils-remove-damaging-includes.patch"
146 "libutils-add-includes.patch"
147 "adb-add-libraries.patch"
148 "libziparchive-add-includes.patch"))))
150 (define (android-platform-system-extras version)
154 (url "https://android.googlesource.com/platform/system/extras")
155 (commit (string-append "android-" version))))
156 (file-name (string-append "android-platform-system-extras-"
157 version "-checkout"))
160 "18130c23ybqcpgjc5v6f8kdbv2xn39hyiaj17dzldjb9rlwzcyy9"))))
162 (define (android-platform-bionic version)
166 (url "https://android.googlesource.com/platform/bionic")
167 (commit (string-append "android-" version))))
168 (file-name (string-append "android-platform-bionic-"
169 version "-checkout"))
172 "15r4s20d7vw022f8vrc3jbghmqwdcqzprl7i2bfvdkz8z76wc1ps"))))
174 (define (android-platform-external version subdirectory checksum)
179 (string-append "https://android.googlesource.com/platform/external/"
181 (commit (string-append "android-" version))))
182 (file-name (string-append "android-platform-system-external-" subdirectory "-"
183 version "-checkout"))
188 (define-public android-liblog
190 (name "android-liblog")
191 (version (android-platform-version))
192 (source (android-platform-system-core version))
193 (build-system android-ndk-build-system)
195 `(#:make-flags '("LDLIBS=-lpthread")
197 (modify-phases %standard-phases
198 (add-after 'unpack 'enter-source
199 (lambda _ (chdir "liblog") #t))
200 (add-after 'install 'ldconfig
201 (lambda* (#:key outputs #:allow-other-keys)
202 (let ((out (assoc-ref outputs "out")))
203 (symlink "liblog.so.0" (string-append out "/lib/liblog.so"))
205 (add-after 'install 'install-headers
206 (lambda* (#:key outputs #:allow-other-keys)
207 (let ((out (assoc-ref outputs "out")))
209 "../include/log" (string-append out "/include/log"))
210 ;; For android/log.h, the only header in the android directory.
212 "../include/android" (string-append out "/include/android")))
214 (home-page "https://developer.android.com/")
215 (synopsis "Logging library from the Android platform.")
216 (description "@code{liblog} represents an interface to the volatile Android
217 Logging system for NDK (Native) applications and libraries and contain
218 interfaces for either writing or reading logs. The log buffers are divided up
219 in Main, System, Radio and Events sub-logs.")
220 (license license:asl2.0)))
222 (define android-libbase
224 (name "android-libbase")
225 (version (android-platform-version))
226 (source (android-platform-system-core version))
227 (build-system android-ndk-build-system)
229 `(#:tests? #f ; Test failure: logging.UNIMPLEMENTED
231 (modify-phases %standard-phases
232 (add-after 'unpack 'enter-source
233 (lambda _ (chdir "base") #t)))))
234 (inputs `(("android-liblog" ,android-liblog)))
235 (home-page "https://developer.android.com/")
236 (synopsis "Android platform base library")
237 (description "@code{libbase} is a library in common use by the
238 various Android core host applications.")
239 (license license:asl2.0)))
241 (define-public android-libcutils
243 (name "android-libcutils")
244 (version (android-platform-version))
245 (source (android-platform-system-core version))
246 (build-system gnu-build-system)
248 `(#:tests? #f ; TODO.
250 (modify-phases %standard-phases
251 (add-after 'unpack 'enter-source
252 (lambda _ (chdir "libcutils") #t))
253 (add-after 'enter-source 'create-Makefile
255 ;; No useful makefile is shipped, so we create one.
256 (with-output-to-file "Makefile"
261 "SOURCES = load_file.o socket_local_client_unix.o"
262 " socket_loopback_client_unix.o socket_network_client_unix.o"
263 " socket_loopback_server_unix.o socket_local_server_unix.o"
264 " sockets_unix.o socket_inaddr_any_server_unix.o"
269 "CXXFLAGS += -fPIC\n"
270 "CPPFLAGS += -Iinclude -I../include\n"
271 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
273 "build: $(SOURCES)\n"
274 " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
279 (lambda* (#:key outputs #:allow-other-keys)
280 (let* ((out (assoc-ref outputs "out"))
281 (lib (string-append out "/lib"))
282 (include (string-append out "/include")))
283 (install-file "libcutils.so.0" lib)
284 (with-directory-excursion lib
285 (symlink "libcutils.so.0" "libcutils.so"))
286 (copy-recursively "../include/cutils"
287 (string-append include "/cutils"))
289 (home-page "https://developer.android.com/")
290 (synopsis "Android platform c utils library")
291 (description "@code{libcutils} is a library in common use by the
292 various Android core host applications.")
293 (license license:asl2.0)))
295 (define-public android-libsparse
297 (name "android-libsparse")
298 (version (android-platform-version))
299 (source (android-platform-system-core version))
300 (build-system android-ndk-build-system)
302 `(#:make-flags '("CFLAGS=-Wno-error"
303 "CXXFLAGS=-fpermissive -Wno-error")
305 (modify-phases %standard-phases
306 (add-after 'unpack 'enter-source
307 (lambda _ (chdir "libsparse") #t)))))
310 (home-page "https://developer.android.com/")
311 (synopsis "Android platform sparse library")
312 (description "@code{android-libsparse} is a library in common use by the
313 various Android core host applications.")
314 (license license:asl2.0)))
316 (define-public android-libziparchive
318 (name "android-libziparchive")
319 (version (android-platform-version))
320 (source (android-platform-system-core version))
321 (build-system android-ndk-build-system)
323 `(#:make-flags '("CFLAGS=-Wno-error"
324 "CXXFLAGS=-fpermissive -Wno-error")
326 (modify-phases %standard-phases
327 (add-after 'unpack 'enter-source
328 (lambda _ (chdir "libziparchive") #t))
329 (add-before 'check 'setenv
331 (setenv "ziparchive_tests_host_PARAMS" "--test_data_dir=testdata")
333 (add-after 'install 'install-headers
334 (lambda* (#:key inputs outputs #:allow-other-keys)
335 (let ((out (assoc-ref outputs "out")))
336 (copy-recursively "../include/ziparchive"
337 (string-append out "/include/ziparchive"))
342 `(("android-libbase" ,android-libbase)
343 ("android-libutils" ,android-libutils)
344 ("android-liblog" ,android-liblog)))
345 (home-page "https://developer.android.com/")
346 (synopsis "Android platform ZIP library")
347 (description "@code{android-libziparchive} is a library in common use by the
348 various Android core host applications.")
349 (license license:asl2.0)))
354 (version (android-platform-version))
355 (source (android-platform-system-core version))
356 (build-system android-ndk-build-system)
358 `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
360 (list "CFLAGS=-Wno-error"
361 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
362 (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
363 "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
365 (modify-phases %standard-phases
366 (add-after 'unpack 'enter-source
367 (lambda _ (chdir "adb") #t))
368 (add-after 'enter-source 'glibc-compat
370 ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
371 (substitute* "usb_linux.cpp"
372 (("#include <sys/types.h>" all)
373 (string-append all "\n#include <sys/sysmacros.h>\n")))
375 (add-after 'enter-source 'make-libs-available
376 (lambda* (#:key inputs outputs #:allow-other-keys)
377 (substitute* "Android.mk"
378 (("libcrypto_static") "libcrypto"))
380 (add-after 'install 'install-headers
381 (lambda* (#:key inputs outputs #:allow-other-keys)
382 (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
385 `(("android-libbase" ,android-libbase)
386 ("android-libcutils" ,android-libcutils)
387 ("android-liblog" ,android-liblog)
388 ("openssl" ,openssl-1.0)))
389 (home-page "https://developer.android.com/studio/command-line/adb.html")
390 (synopsis "Android Debug Bridge")
392 "@command{adb} is a versatile command line tool that lets you communicate
393 with an emulator instance or connected Android device. It facilitates a variety
394 of device actions, such as installing and debugging apps, and it provides access
395 to a Unix shell that can run commands on the connected device or emulator.")
396 (license license:asl2.0)))
398 (define-public mkbootimg
401 (version (android-platform-version))
403 (inherit (android-platform-system-core version))))
404 (build-system python-build-system)
408 (modify-phases %standard-phases
409 (add-after 'unpack 'enter-source
410 (lambda _ (chdir "mkbootimg") #t))
414 (lambda* (#:key outputs #:allow-other-keys)
415 (let* ((out (assoc-ref outputs "out"))
416 (bin (string-append out "/bin"))
417 (include (string-append out "/include")))
418 (install-file "mkbootimg" bin)
419 (install-file "bootimg.h" include)
421 (home-page "https://developer.android.com/studio/command-line/adb.html")
422 (synopsis "Tool to create Android boot images")
423 (description "This package provides a tool to create Android Boot
425 (license license:asl2.0)))
427 (define-public android-safe-iop
429 (name "android-safe-iop")
430 (version (android-platform-version))
431 (source (android-platform-external version "safe-iop"
432 "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw"))
433 (build-system android-ndk-build-system)
435 `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error")
437 (modify-phases %standard-phases
438 (add-before 'build 'patch-host
440 ;; TODO: Cross-compile.
441 (substitute* "Android.mk"
442 (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY"))
444 (home-page "https://developer.android.com/")
445 (synopsis "Safe integers in C")
446 (description "@code{android-safe-iop} provides a set of functions for
447 performing and checking safe integer operations. Ensure that integer
448 operations do not result in silent overflow.")
449 (license license:bsd-2)))
451 (define-public android-bionic-uapi
453 (name "android-bionic-uapi")
454 (version (android-platform-version))
455 (source (android-platform-bionic version))
456 (build-system android-ndk-build-system)
459 (modify-phases %standard-phases
460 (add-after 'unpack 'enter-source
461 (lambda _ (chdir "libc") #t))
467 (lambda* (#:key outputs #:allow-other-keys)
468 (let* ((out (assoc-ref outputs "out"))
469 (out-sys (string-append out "/include/sys")))
471 (install-file "include/sys/system_properties.h" out-sys)
472 (install-file "include/sys/_system_properties.h" out-sys)
473 (copy-recursively "kernel/uapi" (string-append out "/include"))
475 (home-page "https://developer.android.com/")
476 (synopsis "Android Linux API that is safe for user space")
477 (description "@code{android-bionic-uapi} provides the part of the Linux API
478 that is safe to use for user space. It also includes
479 @code{system_properties.h} and @code{_system_properties.h}.")
480 (license license:asl2.0)))
482 (define-public android-libselinux
484 (name "android-libselinux")
485 (version (android-platform-version))
487 (android-platform-external version "libselinux"
488 "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
489 (build-system android-ndk-build-system)
491 ;; See logd/Android.mk for the *_LOG_TAG values.
492 `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
494 "-I core/libpackagelistparser/include "
495 "-DAUDITD_LOG_TAG=1003 "
496 "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
497 "LDFLAGS=-L . -lpcre")
499 (modify-phases %standard-phases
500 (add-after 'unpack-core 'patch-HOST
502 ;; gettid duplicates otherwise.
503 (substitute* "src/procattr.c"
504 (("#ifdef HOST") "#ifdef XXX"))
507 `(("openssl" ,openssl)))
509 `(("android-bionic-uapi" ,android-bionic-uapi)
510 ;; pcre is inlined by our package.
512 (home-page "https://developer.android.com/")
513 (synopsis "Android version of the SELinux libraries and utilities")
515 "The libselinux library provides an API for SELinux applications to get
516 and set process and file security contexts, and to obtain security policy
517 decisions. It is required for any applications that use the SELinux API, and
518 used by all applications that are SELinux-aware. This package also includes
519 the core SELinux management utilities.")
520 (license license:public-domain)))
522 (define-public android-ext4-utils
524 (name "android-ext4-utils")
525 (version (android-platform-version))
526 (source (android-platform-system-extras version))
527 (build-system android-ndk-build-system)
530 (list (string-append "CPPFLAGS="
533 (assoc-ref %build-inputs "android-libselinux")
535 "-I " (assoc-ref %build-inputs "android-libsparse")
537 "-I " (assoc-ref %build-inputs "android-libcutils")
539 "-I " (assoc-ref %build-inputs "android-liblog") "/include "
540 "-I ../core/include")
542 "install-libext4_utils_host.a"
543 (string-append "prefix=" (assoc-ref %outputs "out")))
545 (modify-phases %standard-phases
546 (add-after 'unpack 'unpack-core
547 (lambda* (#:key inputs #:allow-other-keys)
549 (with-directory-excursion "core"
550 (invoke "tar" "axf" (assoc-ref inputs "android-core")
551 "--strip-components=1"))
553 (add-after 'unpack-core 'enter-source
554 (lambda _ (chdir "ext4_utils") #t))
556 (lambda* (#:key inputs outputs #:allow-other-keys)
557 (let ((out (assoc-ref outputs "out")))
558 (copy-recursively "." (string-append out "/include")))
561 `(("android-libcutils" ,android-libcutils)
562 ("android-liblog" ,android-liblog)
563 ("android-libselinux" ,android-libselinux)
564 ("android-libsparse" ,android-libsparse)
567 `(("android-core" ,(android-platform-system-core version))))
568 (home-page "https://developer.android.com/")
569 (synopsis "Android ext4 file system utilities")
570 (description "@code{android-ext4-utils} is a library in common use by the
572 (license license:asl2.0)))
574 (define-public android-f2fs-utils
576 (name "android-f2fs-utils")
577 (version (android-platform-version))
578 (source (android-platform-system-extras version))
579 (build-system android-ndk-build-system)
582 (modify-phases %standard-phases
583 (add-after 'unpack 'enter-source
584 (lambda _ (chdir "f2fs_utils") #t))
585 (add-after 'install 'install-headers
586 (lambda* (#:key inputs outputs #:allow-other-keys)
587 (copy-recursively "." (string-append (assoc-ref outputs "out")
590 (add-after 'install 'install-shell-scripts
591 (lambda* (#:key outputs #:allow-other-keys)
592 (let* ((out (assoc-ref outputs "out"))
593 (bin (string-append out "/bin")))
594 (patch-shebang "mkf2fsuserimg.sh")
595 (substitute* "mkf2fsuserimg.sh"
596 (("make_f2fs") (string-append bin "/make_f2fs")))
597 (install-file "mkf2fsuserimg.sh" bin)
600 `(("f2fs-tools" ,f2fs-tools-1.7)
601 ("android-libselinux" ,android-libselinux)
602 ("android-libsparse" ,android-libsparse)
603 ("android-libcutils" ,android-libcutils)
605 (home-page "https://developer.android.com/")
606 (synopsis "Android f2fs utils")
607 (description "@code{android-f2fs-utils} is a library in common use by the
608 Android core. It allows the user to create images for the @code{f2fs} Flash
610 (license license:asl2.0)))
612 (define-public android-libutils
614 (name "android-libutils")
615 (version (android-platform-version))
616 (source (android-platform-system-core version))
617 (build-system android-ndk-build-system)
620 #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
622 (modify-phases %standard-phases
623 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
624 (lambda* (#:key inputs #:allow-other-keys)
625 ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent it from
626 ;; shadowing the version of GCC provided in native-inputs.
627 (let ((gcc (assoc-ref inputs "gcc")))
628 (setenv "CPLUS_INCLUDE_PATH"
630 (delete (string-append gcc "/include/c++")
631 (string-split (getenv "CPLUS_INCLUDE_PATH")
635 (add-after 'unpack 'enter-source
636 (lambda _ (chdir "libutils") #t))
637 (add-after 'install 'install-headers
638 (lambda* (#:key inputs outputs #:allow-other-keys)
639 (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
641 `(("android-safe-iop" ,android-safe-iop)
642 ("android-libcutils" ,android-libcutils)))
644 `(("android-bionic-uapi" ,android-bionic-uapi)
645 ("android-liblog" ,android-liblog)
646 ("gcc@5" ,gcc-5))) ; XXX: fails to build with GCC 7
647 (home-page "https://developer.android.com/")
648 (synopsis "Android utility library")
649 (description "@code{android-libutils} provides utilities for Android NDK developers.")
650 (license license:asl2.0)))
652 (define-public fastboot
655 (version (android-platform-version))
656 (source (android-platform-system-core version))
657 (build-system android-ndk-build-system)
660 (modify-phases %standard-phases
661 (add-after 'unpack 'enter-source
665 (add-after 'enter-source 'patch-source
667 (substitute* "Android.mk"
668 (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
671 (lambda* (#:key outputs #:allow-other-keys)
672 (let* ((out (assoc-ref outputs "out"))
673 (lib (string-append out "/lib"))
674 (bin (string-append out "/bin")))
675 (install-file "fastboot" bin)
679 ("android-safe-iop" ,android-safe-iop)
680 ("android-ext4-utils" ,android-ext4-utils)
681 ("android-f2fs-utils" ,android-f2fs-utils)
682 ("android-libbase" ,android-libbase)
683 ("android-libcutils" ,android-libcutils)
684 ("android-liblog" ,android-liblog)
685 ("android-libutils" ,android-libutils)
686 ("android-libsparse" ,android-libsparse)
687 ("android-libziparchive" ,android-libziparchive)
688 ("android-libselinux" ,android-libselinux)
690 ("mkbootimg" ,mkbootimg)
694 (home-page "https://developer.android.com/studio/command-line/")
695 (synopsis "Android image flasher")
697 "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
698 (license license:asl2.0)))
700 (define-public android-udev-rules
702 (name "android-udev-rules")
708 (url "https://github.com/M0Rf30/android-udev-rules")
710 (file-name (git-file-name name version))
712 (base32 "0cf5br8x6iwxc1cifv0i1klw7skgs8hghdx6qlqby68kyqg81bb2"))))
713 (build-system trivial-build-system)
714 (native-inputs `(("source" ,source)))
716 '(#:modules ((guix build utils))
719 (use-modules (guix build utils))
720 (let ((source (assoc-ref %build-inputs "source")))
721 (install-file (string-append source "/51-android.rules")
722 (string-append %output "/lib/udev/rules.d"))
724 (home-page "https://github.com/M0Rf30/android-udev-rules")
725 (synopsis "udev rules for Android devices")
726 (description "Provides a set of udev rules to allow using Android devices
727 with tools such as @command{adb} and @command{fastboot} without root
728 privileges. This package is intended to be added as a rule to the
729 @code{udev-service-type} in your @code{operating-system} configuration.
730 Additionally, an @code{adbusers} group must be defined and your user added to
733 @emph{Simply installing this package will not have any effect.} It is meant
734 to be passed to the @code{udev} service.")
735 (license license:gpl3+)))
737 (define-public git-repo
745 (url "https://gerrit.googlesource.com/git-repo")
746 (commit (string-append "v" version))))
747 (file-name (string-append "git-repo-" version "-checkout"))
749 (base32 "0khg1731927gvin73dcbw1657kbfq4k7agla5rpzqcnwkk5agzg3"))))
750 (build-system python-build-system)
753 (modify-phases %standard-phases
754 (add-before 'build 'set-executable-paths
755 (lambda* (#:key inputs outputs #:allow-other-keys)
756 (let* ((out (assoc-ref outputs "out"))
757 (git (assoc-ref inputs "git"))
758 (ssh (assoc-ref inputs "ssh")))
759 (substitute* '("repo" "git_command.py")
761 (string-append "GIT = '" git "/bin/git'")))
762 (substitute* "git_config.py"
763 ((" command_base = \\['ssh',")
764 (string-append " command_base = ['" ssh "/bin/ssh',")))
766 (add-before 'build 'do-not-self-update
767 (lambda* (#:key outputs #:allow-other-keys)
768 ;; Setting the REPO_MAIN variable to an absolute file name is
769 ;; enough to have _FindRepo return the store main.py file. The
770 ;; self update mechanism is activated with the call to _Init() in
771 ;; main(), so we bypass it.
773 ;; Ticket requesting upstream to provide a mean to disable the
774 ;; self update mechanism:
775 ;; https://bugs.chromium.org/p/gerrit/issues/detail?id=12407.
776 (let* ((out (assoc-ref outputs "out"))
777 (repo-main (string-append out "/share/git-repo/main.py")))
780 (format #f "REPO_MAIN = ~s~%" repo-main))
781 ((" _Init\\(args, gitc_init=\\(cmd ==.*" all)
782 (string-append "True #" all)))
783 ;; Prevent repo from trying to git describe its version from
784 ;; the (disabled) self updated copy.
785 (substitute* "git_command.py"
786 (("ver = getattr\\(RepoSourceVersion.*")
787 (format #f "ver = ~s~%" ,version)))
788 (substitute* "subcmds/version.py"
790 (format #f "rp_ver = ~s~%" ,version)))
791 ;; Prevent repo from adding its (disabled) self update copy to
792 ;; the list of projects to fetch when using 'repo sync'.
793 (substitute* "subcmds/sync.py"
794 (("to_fetch\\.extend\\(all_projects\\).*" all)
795 (string-append "#" all))
796 (("self\\._Fetch\\(to_fetch")
797 "self._Fetch(all_projects")
798 (("_PostRepoFetch\\(rp, opt\\.repo_verify).*" all)
799 (string-append "#" all))))))
800 (delete 'build) ; nothing to build
801 (add-before 'check 'configure-git
803 (setenv "HOME" (getcwd))
804 (invoke "git" "config" "--global" "user.email" "you@example.com")
805 (invoke "git" "config" "--global" "user.name" "Your Name")))
808 (invoke "./run_tests")))
810 (lambda* (#:key outputs #:allow-other-keys)
811 (let* ((out (assoc-ref outputs "out"))
812 (bin-dir (string-append out "/bin"))
813 (repo-dir (string-append out "/share/" ,name)))
816 (copy-recursively "." repo-dir)
817 (delete-file-recursively (string-append repo-dir "/tests"))
818 (symlink (string-append repo-dir "/repo")
819 (string-append bin-dir "/repo"))
822 ;; TODO: Add git-remote-persistent-https once it is available in guix
826 `(("pytest" ,python-pytest)))
827 (home-page "https://code.google.com/p/git-repo/")
828 (synopsis "Helps to manage many Git repositories.")
829 (description "Repo is a tool built on top of Git. Repo helps manage many
830 Git repositories, does the uploads to revision control systems, and automates
831 parts of the development workflow. Repo is not meant to replace Git, only to
832 make it easier to work with Git. The repo command is an executable Python
833 script that you can put anywhere in your path.")
834 (license license:asl2.0)))
836 (define-public abootimg
843 (uri (string-append "http://http.debian.net/debian/pool/main/a/abootimg/"
844 "abootimg_" version ".orig.tar.gz"))
846 (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba"))))
847 (build-system gnu-build-system)
851 (modify-phases %standard-phases
857 (lambda* (#:key outputs #:allow-other-keys)
858 (let* ((out (assoc-ref outputs "out"))
859 (bin (string-append out "/bin")))
860 (install-file "abootimg" bin)
863 `(("libblkid" ,util-linux "lib")))
864 (home-page "https://ac100.grandou.net/abootimg")
865 (synopsis "Tool for manipulating Android Boot Images")
866 (description "This package provides a tool for manipulating old Android
867 Boot Images. @code{abootimg} can work directly on block devices, or, the
868 safest way, on a file image.")
869 (license license:gpl2+)))
871 (define-public python-androguard
873 (name "python-androguard")
877 ;; The pypi release doesn't have the tests, but the tests use
878 ;; packaged binaries, so we skip them.
880 (uri (pypi-uri "androguard" version))
883 "0ndsw00pkyda4i2s3wi5ap8gbk6a9d23xhhxpdbk02padv8sxkfv"))))
884 (build-system python-build-system)
887 (modify-phases %standard-phases
889 ;; Adapted from .travis.yml
891 (invoke "nosetests" "--with-coverage" "--with-timer"
892 "--timer-top-n" "50"))))))
894 `(("python-codecov" ,python-codecov)
895 ("python-coverage" ,python-coverage)
896 ("python-mock" ,python-mock)
897 ("python-nose" ,python-nose)
898 ("python-nose-timer" ,python-nose-timer)))
900 `(("python-asn1crypto" ,python-asn1crypto)
901 ("python-colorama" ,python-colorama)
902 ("python-future" ,python-future)
903 ("python-ipython" ,python-ipython)
904 ("python-lxml" ,python-lxml)
905 ("python-matplotlib" ,python-matplotlib)
906 ("python-networkx" ,python-networkx)
907 ("python-pygments" ,python-pygments)
908 ("python-pyperclip" ,python-pyperclip)))
909 (home-page "https://github.com/androguard/androguard")
910 (synopsis "Python tool to play with Android files")
912 "Androguard is a full Python tool to manipulate Android files. It is
913 useful for reverse engineering, analysis of Android applications and more.")
914 (license license:asl2.0)))
916 (define-public fdroidserver
918 (name "fdroidserver")
923 (uri (pypi-uri "fdroidserver" version))
926 "0m07f791z45w7r2dzx4yb6s54b3c3wykm3w9hn25p2jcyax082a2"))))
927 (build-system python-build-system)
930 (modify-phases %standard-phases
931 (add-after 'unpack 'fix-versioning
933 (substitute* "setup.py"
934 (("0.2.1") ,(package-version python-pyasn1-modules))
935 ;; The dependency on docker has been removed upstream by
936 ;; a fairly large patch:
937 ;; https://gitlab.com/fdroid/fdroidserver/-/commit/89614851250c79a05db84070feca6dea033af334
938 ;; that is not in a release yet. It appears we can compile with
940 (("docker-py >= 1.9, < 2.0") "docker >= 1.9"))
943 `(("python-androguard" ,python-androguard)
944 ("python-apache-libcloud" ,python-apache-libcloud)
945 ("python-clint" ,python-clint)
946 ("python-defusedxml" ,python-defusedxml)
947 ("python-docker-py" ,python-docker-py)
948 ("python-gitpython" ,python-gitpython)
949 ("python-mwclient" ,python-mwclient)
950 ("python-paramiko" ,python-paramiko)
951 ("python-pillow" ,python-pillow)
952 ("python-pyasn1" ,python-pyasn1)
953 ("python-pyasn1-modules" ,python-pyasn1-modules)
954 ("python-pyyaml" ,python-pyyaml)
955 ("python-qrcode" ,python-qrcode)
956 ("python-ruamel.yaml" ,python-ruamel.yaml)
957 ("python-requests" ,python-requests)
958 ("python-vagrant" ,python-vagrant)))
960 `(("python-babel" ,python-babel)
961 ("python-bcrypt" ,python-bcrypt)
962 ("python-docker-pycreds" ,python-docker-pycreds)
963 ("python-pynacl" ,python-pynacl)
964 ("python-websocket-client" ,python-websocket-client)))
965 (home-page "https://f-droid.org")
966 (synopsis "F-Droid server tools")
968 "The F-Droid server tools provide various scripts and tools that are used
969 to maintain F-Droid, the repository of free Android applications. You can use
970 these same tools to create your own additional or alternative repository for
971 publishing, or to assist in creating, testing and submitting metadata to the
973 (license license:agpl3+)))
975 (define-public enjarify
979 (home-page "https://github.com/Storyyeller/enjarify")
986 (file-name (git-file-name name version))
988 (search-patches "enjarify-setup-py.patch"))
991 "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk"))))
992 (build-system python-build-system)
995 (modify-phases %standard-phases
996 (add-after 'unpack 'enjarify-wrapper-inherit-pythonpath
997 ;; enjarify sets PYTHONPATH from a shell script, overwriting
998 ;; PYTHONPATH set from guix. Comment out this line.
1000 (substitute* "enjarify.sh"
1001 (("export PYTHONPATH") "# export PYTHONPATH"))
1003 (add-before 'check 'fixup-expected-test-results
1004 ;; Upstream adjusted this test in commit:
1005 ;; 3ae884a6485af82d300515813f537685b08dd800
1007 (substitute* "tests/test2/expected.txt"
1010 (add-before 'check 'drop-java-xss-argument
1011 ;; Upstream removed this argument in order to support 32-bit
1012 ;; architectures. commit: 4be0111d879aa95fdc0d9f24fe529f8c664d4093
1014 (substitute* "enjarify/runtests.py"
1015 (("java -Xss515m") "java "))
1017 (add-after 'install 'install-enjarify-wrapper
1018 (lambda* (#:key outputs #:allow-other-keys)
1019 (let* ((out (assoc-ref outputs "out")))
1020 (mkdir-p (string-append out "/bin/"))
1021 (copy-file "enjarify.sh" (string-append out "/bin/enjarify"))
1023 (native-inputs `(("openjdk" ,openjdk12)))
1024 (synopsis "Translate Dalvik bytecode to equivalent Java bytecode")
1025 (description "Android applications are Java programs that run on a
1026 customized virtual machine, which is part of the Android operating system, the
1027 Dalvik VM. Their bytecode differs from the bytecode of normal Java
1028 applications. Enjarify can translate the Dalvik bytecode back to equivalent
1029 Java bytecode, which simplifies the analysis of Android applications.")
1030 (license license:asl2.0)))