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 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2019 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.git")
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.git")
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 (android-platform-version) "7.1.2_r36")
131 (define (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 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 (home-page "https://developer.android.com/")
206 (synopsis "Logging library from the Android platform.")
207 (description "@code{liblog} represents an interface to the volatile Android
208 Logging system for NDK (Native) applications and libraries and contain
209 interfaces for either writing or reading logs. The log buffers are divided up
210 in Main, System, Radio and Events sub-logs.")
211 (license license:asl2.0)))
213 (define android-libbase
215 (name "android-libbase")
216 (version (android-platform-version))
217 (source (android-platform-system-core version))
218 (build-system android-ndk-build-system)
220 `(#:tests? #f ; Test failure: logging.UNIMPLEMENTED
222 (modify-phases %standard-phases
223 (add-after 'unpack 'enter-source
224 (lambda _ (chdir "base") #t)))))
225 (inputs `(("android-liblog" ,android-liblog)))
226 (home-page "https://developer.android.com/")
227 (synopsis "Android platform base library")
228 (description "@code{libbase} is a library in common use by the
229 various Android core host applications.")
230 (license license:asl2.0)))
232 (define android-libcutils
234 (name "android-libcutils")
235 (version (android-platform-version))
236 (source (android-platform-system-core version))
237 (build-system gnu-build-system)
239 `(#:tests? #f ; TODO.
241 (modify-phases %standard-phases
242 (add-after 'unpack 'enter-source
243 (lambda _ (chdir "libcutils") #t))
244 (add-after 'enter-source 'create-Makefile
246 ;; No useful makefile is shipped, so we create one.
247 (with-output-to-file "Makefile"
252 "SOURCES = load_file.o socket_local_client_unix.o"
253 " socket_loopback_client_unix.o socket_network_client_unix.o"
254 " socket_loopback_server_unix.o socket_local_server_unix.o"
255 " sockets_unix.o socket_inaddr_any_server_unix.o"
260 "CXXFLAGS += -fPIC\n"
261 "CPPFLAGS += -Iinclude -I../include\n"
262 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
264 "build: $(SOURCES)\n"
265 " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
270 (lambda* (#:key outputs #:allow-other-keys)
271 (let* ((out (assoc-ref outputs "out"))
272 (lib (string-append out "/lib"))
273 (include (string-append out "/include")))
274 (install-file "libcutils.so.0" lib)
275 (with-directory-excursion lib
276 (symlink "libcutils.so.0" "libcutils.so"))
277 (copy-recursively "../include/cutils"
278 (string-append include "/cutils"))
280 (home-page "https://developer.android.com/")
281 (synopsis "Android platform c utils library")
282 (description "@code{libcutils} is a library in common use by the
283 various Android core host applications.")
284 (license license:asl2.0)))
286 (define-public android-libsparse
288 (name "android-libsparse")
289 (version (android-platform-version))
290 (source (android-platform-system-core version))
291 (build-system android-ndk-build-system)
293 `(#:make-flags '("CFLAGS=-Wno-error"
294 "CXXFLAGS=-fpermissive -Wno-error")
296 (modify-phases %standard-phases
297 (add-after 'unpack 'enter-source
298 (lambda _ (chdir "libsparse") #t)))))
301 (home-page "https://developer.android.com/")
302 (synopsis "Android platform sparse library")
303 (description "@code{android-libsparse} is a library in common use by the
304 various Android core host applications.")
305 (license license:asl2.0)))
307 (define-public android-libziparchive
309 (name "android-libziparchive")
310 (version (android-platform-version))
311 (source (android-platform-system-core version))
312 (build-system android-ndk-build-system)
314 `(#:make-flags '("CFLAGS=-Wno-error"
315 "CXXFLAGS=-fpermissive -Wno-error")
317 (modify-phases %standard-phases
318 (add-after 'unpack 'enter-source
319 (lambda _ (chdir "libziparchive") #t))
320 (add-before 'check 'setenv
322 (setenv "ziparchive_tests_host_PARAMS" "--test_data_dir=testdata")
324 (add-after 'install 'install-headers
325 (lambda* (#:key inputs outputs #:allow-other-keys)
326 (let ((out (assoc-ref outputs "out")))
327 (copy-recursively "../include/ziparchive"
328 (string-append out "/include/ziparchive"))
333 `(("android-libbase" ,android-libbase)
334 ("android-libutils" ,android-libutils)
335 ("android-liblog" ,android-liblog)))
336 (home-page "https://developer.android.com/")
337 (synopsis "Android platform ZIP library")
338 (description "@code{android-libziparchive} is a library in common use by the
339 various Android core host applications.")
340 (license license:asl2.0)))
345 (version (android-platform-version))
346 (source (android-platform-system-core version))
347 (build-system android-ndk-build-system)
349 `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
351 (list "CFLAGS=-Wno-error"
352 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
353 (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
354 "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
356 (modify-phases %standard-phases
357 (add-after 'unpack 'enter-source
358 (lambda _ (chdir "adb") #t))
359 (add-after 'enter-source 'glibc-compat
361 ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
362 (substitute* "usb_linux.cpp"
363 (("#include <sys/types.h>" all)
364 (string-append all "\n#include <sys/sysmacros.h>\n")))
366 (add-after 'enter-source 'make-libs-available
367 (lambda* (#:key inputs outputs #:allow-other-keys)
368 (substitute* "Android.mk"
369 (("libcrypto_static") "libcrypto"))
371 (add-after 'install 'install-headers
372 (lambda* (#:key inputs outputs #:allow-other-keys)
373 (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
376 `(("android-libbase" ,android-libbase)
377 ("android-libcutils" ,android-libcutils)
378 ("android-liblog" ,android-liblog)
379 ("openssl" ,openssl-1.0)))
380 (home-page "https://developer.android.com/studio/command-line/adb.html")
381 (synopsis "Android Debug Bridge")
383 "@command{adb} is a versatile command line tool that lets you communicate
384 with an emulator instance or connected Android device. It facilitates a variety
385 of device actions, such as installing and debugging apps, and it provides access
386 to a Unix shell that can run commands on the connected device or emulator.")
387 (license license:asl2.0)))
389 (define-public mkbootimg
392 (version (android-platform-version))
394 (inherit (android-platform-system-core version))))
395 (build-system python-build-system)
399 (modify-phases %standard-phases
400 (add-after 'unpack 'enter-source
401 (lambda _ (chdir "mkbootimg") #t))
405 (lambda* (#:key outputs #:allow-other-keys)
406 (let* ((out (assoc-ref outputs "out"))
407 (bin (string-append out "/bin"))
408 (include (string-append out "/include")))
409 (install-file "mkbootimg" bin)
410 (install-file "bootimg.h" include)
412 (home-page "https://developer.android.com/studio/command-line/adb.html")
413 (synopsis "Tool to create Android boot images")
414 (description "This package provides a tool to create Android Boot
416 (license license:asl2.0)))
418 (define-public android-safe-iop
420 (name "android-safe-iop")
421 (version (android-platform-version))
422 (source (android-platform-external version "safe-iop"
423 "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw"))
424 (build-system android-ndk-build-system)
426 `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error")
428 (modify-phases %standard-phases
429 (add-before 'build 'patch-host
431 ;; TODO: Cross-compile.
432 (substitute* "Android.mk"
433 (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY"))
435 (home-page "https://developer.android.com/")
436 (synopsis "Safe integers in C")
437 (description "@code{android-safe-iop} provides a set of functions for
438 performing and checking safe integer operations. Ensure that integer
439 operations do not result in silent overflow.")
440 (license license:bsd-2)))
442 (define-public android-bionic-uapi
444 (name "android-bionic-uapi")
445 (version (android-platform-version))
446 (source (android-platform-bionic version))
447 (build-system android-ndk-build-system)
450 (modify-phases %standard-phases
451 (add-after 'unpack 'enter-source
452 (lambda _ (chdir "libc") #t))
458 (lambda* (#:key outputs #:allow-other-keys)
459 (let* ((out (assoc-ref outputs "out"))
460 (out-sys (string-append out "/include/sys")))
462 (install-file "include/sys/system_properties.h" out-sys)
463 (install-file "include/sys/_system_properties.h" out-sys)
464 (copy-recursively "kernel/uapi" (string-append out "/include"))
466 (home-page "https://developer.android.com/")
467 (synopsis "Android Linux API that is safe for user space")
468 (description "@code{android-bionic-uapi} provides the part of the Linux API
469 that is safe to use for user space. It also includes
470 @code{system_properties.h} and @code{_system_properties.h}.")
471 (license license:asl2.0)))
473 (define-public android-libselinux
475 (name "android-libselinux")
476 (version (android-platform-version))
478 (android-platform-external version "libselinux"
479 "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
480 (build-system android-ndk-build-system)
482 ;; See logd/Android.mk for the *_LOG_TAG values.
483 `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
485 "-I core/libpackagelistparser/include "
486 "-DAUDITD_LOG_TAG=1003 "
487 "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
488 "LDFLAGS=-L . -lpcre")
490 (modify-phases %standard-phases
491 (add-after 'unpack-core 'patch-HOST
493 ;; gettid duplicates otherwise.
494 (substitute* "src/procattr.c"
495 (("#ifdef HOST") "#ifdef XXX"))
498 `(("openssl" ,openssl)))
500 `(("android-bionic-uapi" ,android-bionic-uapi)
501 ;; pcre is inlined by our package.
503 (home-page "https://developer.android.com/")
504 (synopsis "Android version of the SELinux libraries and utilities")
506 "The libselinux library provides an API for SELinux applications to get
507 and set process and file security contexts, and to obtain security policy
508 decisions. It is required for any applications that use the SELinux API, and
509 used by all applications that are SELinux-aware. This package also includes
510 the core SELinux management utilities.")
511 (license license:public-domain)))
513 (define-public android-ext4-utils
515 (name "android-ext4-utils")
516 (version (android-platform-version))
517 (source (android-platform-system-extras version))
518 (build-system android-ndk-build-system)
521 (list (string-append "CPPFLAGS="
524 (assoc-ref %build-inputs "android-libselinux")
526 "-I " (assoc-ref %build-inputs "android-libsparse")
528 "-I " (assoc-ref %build-inputs "android-libcutils")
530 "-I " (assoc-ref %build-inputs "android-liblog") "/include "
531 "-I ../core/include")
533 "install-libext4_utils_host.a"
534 (string-append "prefix=" (assoc-ref %outputs "out")))
536 (modify-phases %standard-phases
537 (add-after 'unpack 'unpack-core
538 (lambda* (#:key inputs #:allow-other-keys)
540 (with-directory-excursion "core"
541 (invoke "tar" "axf" (assoc-ref inputs "android-core")
542 "--strip-components=1"))
544 (add-after 'unpack-core 'enter-source
545 (lambda _ (chdir "ext4_utils") #t))
547 (lambda* (#:key inputs outputs #:allow-other-keys)
548 (let ((out (assoc-ref outputs "out")))
549 (copy-recursively "." (string-append out "/include")))
552 `(("android-libcutils" ,android-libcutils)
553 ("android-liblog" ,android-liblog)
554 ("android-libselinux" ,android-libselinux)
555 ("android-libsparse" ,android-libsparse)
558 `(("android-core" ,(android-platform-system-core version))))
559 (home-page "https://developer.android.com/")
560 (synopsis "Android ext4 file system utilities")
561 (description "@code{android-ext4-utils} is a library in common use by the
563 (license license:asl2.0)))
565 (define-public android-f2fs-utils
567 (name "android-f2fs-utils")
568 (version (android-platform-version))
569 (source (android-platform-system-extras version))
570 (build-system android-ndk-build-system)
573 (modify-phases %standard-phases
574 (add-after 'unpack 'enter-source
575 (lambda _ (chdir "f2fs_utils") #t))
576 (add-after 'install 'install-headers
577 (lambda* (#:key inputs outputs #:allow-other-keys)
578 (copy-recursively "." (string-append (assoc-ref outputs "out")
581 (add-after 'install 'install-shell-scripts
582 (lambda* (#:key outputs #:allow-other-keys)
583 (let* ((out (assoc-ref outputs "out"))
584 (bin (string-append out "/bin")))
585 (patch-shebang "mkf2fsuserimg.sh")
586 (substitute* "mkf2fsuserimg.sh"
587 (("make_f2fs") (string-append bin "/make_f2fs")))
588 (install-file "mkf2fsuserimg.sh" bin)
591 `(("f2fs-tools" ,f2fs-tools-1.7)
592 ("android-libselinux" ,android-libselinux)
593 ("android-libsparse" ,android-libsparse)
594 ("android-libcutils" ,android-libcutils)
596 (home-page "https://developer.android.com/")
597 (synopsis "Android f2fs utils")
598 (description "@code{android-f2fs-utils} is a library in common use by the
599 Android core. It allows the user to create images for the @code{f2fs} Flash
601 (license license:asl2.0)))
603 (define-public android-libutils
605 (name "android-libutils")
606 (version (android-platform-version))
607 (source (android-platform-system-core version))
608 (build-system android-ndk-build-system)
611 #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
613 (modify-phases %standard-phases
614 (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH
615 (lambda* (#:key inputs #:allow-other-keys)
616 ;; Hide the default GCC from CPLUS_INCLUDE_PATH to prevent it from
617 ;; shadowing the version of GCC provided in native-inputs.
618 (let ((gcc (assoc-ref inputs "gcc")))
619 (setenv "CPLUS_INCLUDE_PATH"
621 (delete (string-append gcc "/include/c++")
622 (string-split (getenv "CPLUS_INCLUDE_PATH")
626 (add-after 'unpack 'enter-source
627 (lambda _ (chdir "libutils") #t))
628 (add-after 'install 'install-headers
629 (lambda* (#:key inputs outputs #:allow-other-keys)
630 (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
632 `(("android-safe-iop" ,android-safe-iop)
633 ("android-libcutils" ,android-libcutils)))
635 `(("android-bionic-uapi" ,android-bionic-uapi)
636 ("android-liblog" ,android-liblog)
637 ("gcc@5" ,gcc-5))) ; XXX: fails to build with GCC 7
638 (home-page "https://developer.android.com/")
639 (synopsis "Android utility library")
640 (description "@code{android-libutils} provides utilities for Android NDK developers.")
641 (license license:asl2.0)))
643 (define-public fastboot
646 (version (android-platform-version))
647 (source (android-platform-system-core version))
648 (build-system android-ndk-build-system)
651 (modify-phases %standard-phases
652 (add-after 'unpack 'enter-source
656 (add-after 'enter-source 'patch-source
658 (substitute* "Android.mk"
659 (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
662 (lambda* (#:key outputs #:allow-other-keys)
663 (let* ((out (assoc-ref outputs "out"))
664 (lib (string-append out "/lib"))
665 (bin (string-append out "/bin")))
666 (install-file "fastboot" bin)
670 ("android-safe-iop" ,android-safe-iop)
671 ("android-ext4-utils" ,android-ext4-utils)
672 ("android-f2fs-utils" ,android-f2fs-utils)
673 ("android-libbase" ,android-libbase)
674 ("android-libcutils" ,android-libcutils)
675 ("android-liblog" ,android-liblog)
676 ("android-libutils" ,android-libutils)
677 ("android-libsparse" ,android-libsparse)
678 ("android-libziparchive" ,android-libziparchive)
679 ("android-libselinux" ,android-libselinux)
681 ("mkbootimg" ,mkbootimg)
685 (home-page "https://developer.android.com/studio/command-line/")
686 (synopsis "Android image flasher")
688 "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
689 (license license:asl2.0)))
691 (define-public android-udev-rules
693 (name "android-udev-rules")
699 (url "https://github.com/M0Rf30/android-udev-rules")
701 (file-name (git-file-name name version))
703 (base32 "0x2f2sv0x0ry7kccp47s0hlxps3hbpg37dj3xjjgpdm5hmn2cjq3"))))
704 (build-system trivial-build-system)
705 (native-inputs `(("source" ,source)))
707 '(#:modules ((guix build utils))
710 (use-modules (guix build utils))
711 (let ((source (assoc-ref %build-inputs "source")))
712 (install-file (string-append source "/51-android.rules")
713 (string-append %output "/lib/udev/rules.d"))
715 (home-page "https://github.com/M0Rf30/android-udev-rules")
716 (synopsis "udev rules for Android devices")
717 (description "Provides a set of udev rules to allow using Android devices
718 with tools such as @command{adb} and @command{fastboot} without root
719 privileges. This package is intended to be added as a rule to the
720 @code{udev-service-type} in your @code{operating-system} configuration.
721 Additionally, an @code{adbusers} group must be defined and your user added to
724 @emph{Simply installing this package will not have any effect.} It is meant
725 to be passed to the @code{udev} service.")
726 (license license:gpl3+)))
728 (define-public git-repo
736 (url "https://gerrit.googlesource.com/git-repo")
737 (commit (string-append "v" version))))
738 (file-name (string-append "git-repo-" version "-checkout"))
740 (base32 "0khg1731927gvin73dcbw1657kbfq4k7agla5rpzqcnwkk5agzg3"))))
741 (build-system python-build-system)
744 (modify-phases %standard-phases
745 (add-before 'build 'set-executable-paths
746 (lambda* (#:key inputs outputs #:allow-other-keys)
747 (let* ((out (assoc-ref outputs "out"))
748 (git (assoc-ref inputs "git"))
749 (ssh (assoc-ref inputs "ssh")))
750 (substitute* '("repo" "git_command.py")
752 (string-append "GIT = '" git "/bin/git'")))
753 (substitute* "git_config.py"
754 ((" command_base = \\['ssh',")
755 (string-append " command_base = ['" ssh "/bin/ssh',")))
757 (add-before 'build 'do-not-self-update
758 (lambda* (#:key outputs #:allow-other-keys)
759 ;; Setting the REPO_MAIN variable to an absolute file name is
760 ;; enough to have _FindRepo return the store main.py file. The
761 ;; self update mechanism is activated with the call to _Init() in
762 ;; main(), so we bypass it.
764 ;; Ticket requesting upstream to provide a mean to disable the
765 ;; self update mechanism:
766 ;; https://bugs.chromium.org/p/gerrit/issues/detail?id=12407.
767 (let* ((out (assoc-ref outputs "out"))
768 (repo-main (string-append out "/share/git-repo/main.py")))
771 (format #f "REPO_MAIN = ~s~%" repo-main))
772 ((" _Init\\(args, gitc_init=\\(cmd ==.*" all)
773 (string-append "True #" all)))
774 ;; Prevent repo from trying to git describe its version from
775 ;; the (disabled) self updated copy.
776 (substitute* "git_command.py"
777 (("ver = getattr\\(RepoSourceVersion.*")
778 (format #f "ver = ~s~%" ,version)))
779 (substitute* "subcmds/version.py"
781 (format #f "rp_ver = ~s~%" ,version)))
782 ;; Prevent repo from adding its (disabled) self update copy to
783 ;; the list of projects to fetch when using 'repo sync'.
784 (substitute* "subcmds/sync.py"
785 (("to_fetch\\.extend\\(all_projects\\).*" all)
786 (string-append "#" all))
787 (("self\\._Fetch\\(to_fetch")
788 "self._Fetch(all_projects")
789 (("_PostRepoFetch\\(rp, opt\\.repo_verify).*" all)
790 (string-append "#" all))))))
791 (delete 'build) ; nothing to build
792 (add-before 'check 'configure-git
794 (setenv "HOME" (getcwd))
795 (invoke "git" "config" "--global" "user.email" "you@example.com")
796 (invoke "git" "config" "--global" "user.name" "Your Name")))
799 (invoke "./run_tests")))
801 (lambda* (#:key outputs #:allow-other-keys)
802 (let* ((out (assoc-ref outputs "out"))
803 (bin-dir (string-append out "/bin"))
804 (repo-dir (string-append out "/share/" ,name)))
807 (copy-recursively "." repo-dir)
808 (delete-file-recursively (string-append repo-dir "/tests"))
809 (symlink (string-append repo-dir "/repo")
810 (string-append bin-dir "/repo"))
813 ;; TODO: Add git-remote-persistent-https once it is available in guix
817 `(("pytest" ,python-pytest)))
818 (home-page "https://code.google.com/p/git-repo/")
819 (synopsis "Helps to manage many Git repositories.")
820 (description "Repo is a tool built on top of Git. Repo helps manage many
821 Git repositories, does the uploads to revision control systems, and automates
822 parts of the development workflow. Repo is not meant to replace Git, only to
823 make it easier to work with Git. The repo command is an executable Python
824 script that you can put anywhere in your path.")
825 (license license:asl2.0)))
827 (define-public abootimg
834 (uri (string-append "http://http.debian.net/debian/pool/main/a/abootimg/"
835 "abootimg_" version ".orig.tar.gz"))
837 (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba"))))
838 (build-system gnu-build-system)
842 (modify-phases %standard-phases
848 (lambda* (#:key outputs #:allow-other-keys)
849 (let* ((out (assoc-ref outputs "out"))
850 (bin (string-append out "/bin")))
851 (install-file "abootimg" bin)
854 `(("libblkid" ,util-linux "lib")))
855 (home-page "https://ac100.grandou.net/abootimg")
856 (synopsis "Tool for manipulating Android Boot Images")
857 (description "This package provides a tool for manipulating old Android
858 Boot Images. @code{abootimg} can work directly on block devices, or, the
859 safest way, on a file image.")
860 (license license:gpl2+)))
862 (define-public python-androguard
864 (name "python-androguard")
868 ;; The pypi release doesn't have the tests, but the tests use
869 ;; packaged binaries, so we skip them.
871 (uri (pypi-uri "androguard" version))
874 "0ndsw00pkyda4i2s3wi5ap8gbk6a9d23xhhxpdbk02padv8sxkfv"))))
875 (build-system python-build-system)
878 (modify-phases %standard-phases
880 ;; Adapted from .travis.yml
882 (invoke "nosetests" "--with-coverage" "--with-timer"
883 "--timer-top-n" "50"))))))
885 `(("python-codecov" ,python-codecov)
886 ("python-coverage" ,python-coverage)
887 ("python-mock" ,python-mock)
888 ("python-nose" ,python-nose)
889 ("python-nose-timer" ,python-nose-timer)))
891 `(("python-asn1crypto" ,python-asn1crypto)
892 ("python-colorama" ,python-colorama)
893 ("python-future" ,python-future)
894 ("python-ipython" ,python-ipython)
895 ("python-lxml" ,python-lxml)
896 ("python-matplotlib" ,python-matplotlib)
897 ("python-networkx" ,python-networkx)
898 ("python-pygments" ,python-pygments)
899 ("python-pyperclip" ,python-pyperclip)))
900 (home-page "https://github.com/androguard/androguard")
901 (synopsis "Python tool to play with Android files")
903 "Androguard is a full Python tool to manipulate Android files. It is
904 useful for reverse engineering, analysis of Android applications and more.")
905 (license license:asl2.0)))
907 (define-public fdroidserver
909 (name "fdroidserver")
914 (uri (pypi-uri "fdroidserver" version))
917 "0fp7q8faicx6i6wxm717qqaham3jpilb23mvynpz6v73z7hm6wcg"))))
918 (build-system python-build-system)
921 (modify-phases %standard-phases
922 (add-after 'unpack 'fix-versioning
924 (substitute* "setup.py"
925 (("0.2.1") ,(package-version python-pyasn1-modules)))
928 `(("python-androguard" ,python-androguard)
929 ("python-apache-libcloud" ,python-apache-libcloud)
930 ("python-clint" ,python-clint)
931 ("python-defusedxml" ,python-defusedxml)
932 ("python-docker-py" ,python-docker-py)
933 ("python-gitpython" ,python-gitpython)
934 ("python-mwclient" ,python-mwclient)
935 ("python-paramiko" ,python-paramiko)
936 ("python-pillow" ,python-pillow)
937 ("python-pyasn1" ,python-pyasn1)
938 ("python-pyasn1-modules" ,python-pyasn1-modules)
939 ("python-pyyaml" ,python-pyyaml)
940 ("python-qrcode" ,python-qrcode)
941 ("python-ruamel.yaml" ,python-ruamel.yaml)
942 ("python-requests" ,python-requests)
943 ("python-vagrant" ,python-vagrant)))
945 `(("python-babel" ,python-babel)
946 ("python-bcrypt" ,python-bcrypt)
947 ("python-docker-pycreds" ,python-docker-pycreds)
948 ("python-pynacl" ,python-pynacl)
949 ("python-websocket-client" ,python-websocket-client)))
950 (home-page "https://f-droid.org")
951 (synopsis "F-Droid server tools")
953 "The F-Droid server tools provide various scripts and tools that are used
954 to maintain F-Droid, the repository of free Android applications. You can use
955 these same tools to create your own additional or alternative repository for
956 publishing, or to assist in creating, testing and submitting metadata to the
958 (license license:agpl3+)))
960 (define-public enjarify
964 (home-page "https://github.com/Storyyeller/enjarify")
971 (file-name (git-file-name name version))
973 (search-patches "enjarify-setup-py.patch"))
976 "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk"))))
977 (build-system python-build-system)
980 (modify-phases %standard-phases
981 (add-after 'unpack 'enjarify-wrapper-inherit-pythonpath
982 ;; enjarify sets PYTHONPATH from a shell script, overwriting
983 ;; PYTHONPATH set from guix. Comment out this line.
985 (substitute* "enjarify.sh"
986 (("export PYTHONPATH") "# export PYTHONPATH"))
988 (add-before 'check 'fixup-expected-test-results
989 ;; Upstream adjusted this test in commit:
990 ;; 3ae884a6485af82d300515813f537685b08dd800
992 (substitute* "tests/test2/expected.txt"
995 (add-before 'check 'drop-java-xss-argument
996 ;; Upstream removed this argument in order to support 32-bit
997 ;; architectures. commit: 4be0111d879aa95fdc0d9f24fe529f8c664d4093
999 (substitute* "enjarify/runtests.py"
1000 (("java -Xss515m") "java "))
1002 (add-after 'install 'install-enjarify-wrapper
1003 (lambda* (#:key outputs #:allow-other-keys)
1004 (let* ((out (assoc-ref outputs "out")))
1005 (mkdir-p (string-append out "/bin/"))
1006 (copy-file "enjarify.sh" (string-append out "/bin/enjarify"))
1008 (native-inputs `(("openjdk" ,openjdk12)))
1009 (synopsis "Translate Dalvik bytecode to equivalent Java bytecode")
1010 (description "Android applications are Java programs that run on a
1011 customized virtual machine, which is part of the Android operating system, the
1012 Dalvik VM. Their bytecode differs from the bytecode of normal Java
1013 applications. Enjarify can translate the Dalvik bytecode back to equivalent
1014 Java bytecode, which simplifies the analysis of Android applications.")
1015 (license license:asl2.0)))