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 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>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages android)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system android-ndk)
34 #:use-module (guix build-system python)
35 #:use-module (guix build-system trivial)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages docker)
41 #:use-module (gnu packages gcc)
42 #:use-module (gnu packages gnupg)
43 #:use-module (gnu packages java)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages pcre)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-crypto)
48 #:use-module (gnu packages python-web)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages selinux)
51 #:use-module (gnu packages serialization)
52 #:use-module (gnu packages ssh)
53 #:use-module (gnu packages tls)
54 #:use-module (gnu packages version-control)
55 #:use-module (gnu packages virtualization)
56 #:use-module (gnu packages xdisorg)
57 #:use-module (gnu packages xml))
59 (define-public android-make-stub
61 (name "android-make-stub")
67 (url "https://github.com/daym/android-make-stub.git")
68 (commit (string-append "v" version))))
69 (file-name (string-append "android-make-stub-"
73 "0y1b2x96d37n6f1bp6dcx08bn08zac0cylmbfsx6mf2nahc02fhc"))))
74 (build-system gnu-build-system)
76 `(#:tests? #f ; None exist.
78 (modify-phases %standard-phases
82 (lambda* (#:key outputs #:allow-other-keys)
83 (let* ((out (assoc-ref outputs "out")))
84 (invoke "make" (string-append "prefix=" out) "install")
86 (home-page "https://github.com/daym/android-make-stub")
87 (synopsis "Stubs for the @command{make} system of the Android platform")
88 (description "@code{android-make-stub} provides stubs for the
89 @command{make} system of the Android platform. This allows us to
90 use their packages mostly unmodified in our Android NDK build system.")
91 (license license:asl2.0)))
93 (define-public android-googletest
94 (package (inherit googletest)
95 (name "android-googletest")
101 (url "https://github.com/google/googletest.git")
102 (commit (string-append "release-" version))))
103 (file-name (git-file-name name version))
106 "0bjlljmbf8glnd9qjabx73w6pd7ibv43yiyngqvmvgxsabzr8399"))))
108 `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
110 (modify-phases %standard-phases
111 (add-after 'install 'install-host-libraries
112 (lambda* (#:key outputs #:allow-other-keys)
113 (let* ((out (assoc-ref outputs "out"))
114 (lib (string-append out "/lib")))
115 (symlink "libgtest.so"
116 (string-append lib "/libgtest_host.so"))
117 (symlink "libgmock.so"
118 (string-append lib "/libgmock_host.so"))
121 ;; The Makefiles that we add are largely based on the Debian
122 ;; packages. They are licensed under GPL-2 and have copyright:
123 ;; 2012, Stefan Handschuh <handschuh.stefan@googlemail.com>
124 ;; 2015, Kai-Chung Yan <seamlikok@gmail.com>
125 ;; Big thanks to them for laying the groundwork.
127 ;; The version tag is consistent between all repositories.
128 (define (android-platform-version) "7.1.2_r36")
130 (define (android-platform-system-core version)
134 (url "https://android.googlesource.com/platform/system/core")
135 (commit (string-append "android-" version))))
136 (file-name (string-append "android-platform-system-core-"
137 version "-checkout"))
140 "1krnc2b9zfkzpdgs1dcbji59nszlx2qr723pg89m52622czc06hg"))
142 (search-patches "libbase-use-own-logging.patch"
143 "libbase-fix-includes.patch"
144 "libutils-remove-damaging-includes.patch"
145 "libutils-add-includes.patch"
146 "adb-add-libraries.patch"
147 "libziparchive-add-includes.patch"))))
149 (define (android-platform-system-extras version)
153 (url "https://android.googlesource.com/platform/system/extras")
154 (commit (string-append "android-" version))))
155 (file-name (string-append "android-platform-system-extras-"
156 version "-checkout"))
159 "18130c23ybqcpgjc5v6f8kdbv2xn39hyiaj17dzldjb9rlwzcyy9"))))
161 (define (android-platform-bionic version)
165 (url "https://android.googlesource.com/platform/bionic")
166 (commit (string-append "android-" version))))
167 (file-name (string-append "android-platform-bionic-"
168 version "-checkout"))
171 "15r4s20d7vw022f8vrc3jbghmqwdcqzprl7i2bfvdkz8z76wc1ps"))))
173 (define (android-platform-external version subdirectory checksum)
178 (string-append "https://android.googlesource.com/platform/external/"
180 (commit (string-append "android-" version))))
181 (file-name (string-append "android-platform-system-external-" subdirectory "-"
182 version "-checkout"))
187 (define android-liblog
189 (name "android-liblog")
190 (version (android-platform-version))
191 (source (android-platform-system-core version))
192 (build-system android-ndk-build-system)
194 `(#:make-flags '("LDLIBS=-lpthread")
196 (modify-phases %standard-phases
197 (add-after 'unpack 'enter-source
198 (lambda _ (chdir "liblog") #t))
199 (add-after 'install 'ldconfig
200 (lambda* (#:key outputs #:allow-other-keys)
201 (let ((out (assoc-ref outputs "out")))
202 (symlink "liblog.so.0" (string-append out "/lib/liblog.so"))
204 (home-page "https://developer.android.com/")
205 (synopsis "Logging library from the Android platform.")
206 (description "@code{liblog} represents an interface to the volatile Android
207 Logging system for NDK (Native) applications and libraries and contain
208 interfaces for either writing or reading logs. The log buffers are divided up
209 in Main, System, Radio and Events sub-logs.")
210 (license license:asl2.0)))
212 (define android-libbase
214 (name "android-libbase")
215 (version (android-platform-version))
216 (source (android-platform-system-core version))
217 (build-system android-ndk-build-system)
219 `(#:tests? #f ; Test failure: logging.UNIMPLEMENTED
221 (modify-phases %standard-phases
222 (add-after 'unpack 'enter-source
223 (lambda _ (chdir "base") #t)))))
224 (inputs `(("android-liblog" ,android-liblog)))
225 (home-page "https://developer.android.com/")
226 (synopsis "Android platform base library")
227 (description "@code{libbase} is a library in common use by the
228 various Android core host applications.")
229 (license license:asl2.0)))
231 (define android-libcutils
233 (name "android-libcutils")
234 (version (android-platform-version))
235 (source (android-platform-system-core version))
236 (build-system gnu-build-system)
238 `(#:tests? #f ; TODO.
240 (modify-phases %standard-phases
241 (add-after 'unpack 'enter-source
242 (lambda _ (chdir "libcutils") #t))
243 (add-after 'enter-source 'create-Makefile
245 ;; No useful makefile is shipped, so we create one.
246 (with-output-to-file "Makefile"
251 "SOURCES = load_file.o socket_local_client_unix.o"
252 " socket_loopback_client_unix.o socket_network_client_unix.o"
253 " socket_loopback_server_unix.o socket_local_server_unix.o"
254 " sockets_unix.o socket_inaddr_any_server_unix.o"
259 "CXXFLAGS += -fPIC\n"
260 "CPPFLAGS += -Iinclude -I../include\n"
261 "LDFLAGS += -shared -Wl,-soname,$(NAME).so.0\n"
263 "build: $(SOURCES)\n"
264 " $(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS)"
269 (lambda* (#:key outputs #:allow-other-keys)
270 (let* ((out (assoc-ref outputs "out"))
271 (lib (string-append out "/lib"))
272 (include (string-append out "/include")))
273 (install-file "libcutils.so.0" lib)
274 (with-directory-excursion lib
275 (symlink "libcutils.so.0" "libcutils.so"))
276 (copy-recursively "../include/cutils"
277 (string-append include "/cutils"))
279 (home-page "https://developer.android.com/")
280 (synopsis "Android platform c utils library")
281 (description "@code{libcutils} is a library in common use by the
282 various Android core host applications.")
283 (license license:asl2.0)))
285 (define-public android-libsparse
287 (name "android-libsparse")
288 (version (android-platform-version))
289 (source (android-platform-system-core version))
290 (build-system android-ndk-build-system)
292 `(#:make-flags '("CFLAGS=-Wno-error"
293 "CXXFLAGS=-fpermissive -Wno-error")
295 (modify-phases %standard-phases
296 (add-after 'unpack 'enter-source
297 (lambda _ (chdir "libsparse") #t)))))
300 (home-page "https://developer.android.com/")
301 (synopsis "Android platform sparse library")
302 (description "@code{android-libsparse} is a library in common use by the
303 various Android core host applications.")
304 (license license:asl2.0)))
306 (define-public android-libziparchive
308 (name "android-libziparchive")
309 (version (android-platform-version))
310 (source (android-platform-system-core version))
311 (build-system android-ndk-build-system)
313 `(#:make-flags '("CFLAGS=-Wno-error"
314 "CXXFLAGS=-fpermissive -Wno-error")
316 (modify-phases %standard-phases
317 (add-after 'unpack 'enter-source
318 (lambda _ (chdir "libziparchive") #t))
319 (add-before 'check 'setenv
321 (setenv "ziparchive_tests_host_PARAMS" "--test_data_dir=testdata")
323 (add-after 'install 'install-headers
324 (lambda* (#:key inputs outputs #:allow-other-keys)
325 (let ((out (assoc-ref outputs "out")))
326 (copy-recursively "../include/ziparchive"
327 (string-append out "/include/ziparchive"))
332 `(("android-libbase" ,android-libbase)
333 ("android-libutils" ,android-libutils)
334 ("android-liblog" ,android-liblog)))
335 (home-page "https://developer.android.com/")
336 (synopsis "Android platform ZIP library")
337 (description "@code{android-libziparchive} is a library in common use by the
338 various Android core host applications.")
339 (license license:asl2.0)))
344 (version (android-platform-version))
345 (source (android-platform-system-core version))
346 (build-system android-ndk-build-system)
348 `(#:tests? #f ; Test failure: sysdeps_poll.fd_count
350 (list "CFLAGS=-Wno-error"
351 "CXXFLAGS=-fpermissive -Wno-error -std=gnu++14 -D_Nonnull= -D_Nullable= -I ."
352 (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib "
353 "-Wl,-rpath=" (assoc-ref %build-inputs "openssl") "/lib -L ."))
355 (modify-phases %standard-phases
356 (add-after 'unpack 'enter-source
357 (lambda _ (chdir "adb") #t))
358 (add-after 'enter-source 'glibc-compat
360 ;; Include sysmacros.h for "major" and "minor" in Glibc 2.28.
361 (substitute* "usb_linux.cpp"
362 (("#include <sys/types.h>" all)
363 (string-append all "\n#include <sys/sysmacros.h>\n")))
365 (add-after 'enter-source 'make-libs-available
366 (lambda* (#:key inputs outputs #:allow-other-keys)
367 (substitute* "Android.mk"
368 (("libcrypto_static") "libcrypto"))
370 (add-after 'install 'install-headers
371 (lambda* (#:key inputs outputs #:allow-other-keys)
372 (install-file "diagnose_usb.h" (string-append (assoc-ref outputs "out") "/include"))
375 `(("android-libbase" ,android-libbase)
376 ("android-libcutils" ,android-libcutils)
377 ("android-liblog" ,android-liblog)
378 ("openssl" ,openssl-1.0)))
379 (home-page "https://developer.android.com/studio/command-line/adb.html")
380 (synopsis "Android Debug Bridge")
382 "@command{adb} is a versatile command line tool that lets you communicate
383 with an emulator instance or connected Android device. It facilitates a variety
384 of device actions, such as installing and debugging apps, and it provides access
385 to a Unix shell that can run commands on the connected device or emulator.")
386 (license license:asl2.0)))
388 (define-public mkbootimg
391 (version (android-platform-version))
393 (inherit (android-platform-system-core version))))
394 (build-system python-build-system)
398 (modify-phases %standard-phases
399 (add-after 'unpack 'enter-source
400 (lambda _ (chdir "mkbootimg") #t))
404 (lambda* (#:key outputs #:allow-other-keys)
405 (let* ((out (assoc-ref outputs "out"))
406 (bin (string-append out "/bin"))
407 (include (string-append out "/include")))
408 (install-file "mkbootimg" bin)
409 (install-file "bootimg.h" include)
411 (home-page "https://developer.android.com/studio/command-line/adb.html")
412 (synopsis "Tool to create Android boot images")
413 (description "This package provides a tool to create Android Boot
415 (license license:asl2.0)))
417 (define-public android-safe-iop
419 (name "android-safe-iop")
420 (version (android-platform-version))
421 (source (android-platform-external version "safe-iop"
422 "1nyyrs463advjhlq8xx1lm37m4g5afv7gy0csxrj7biwwl0v13qw"))
423 (build-system android-ndk-build-system)
425 `(#:make-flags '("CXXFLAGS=-fpermissive -Wno-error")
427 (modify-phases %standard-phases
428 (add-before 'build 'patch-host
430 ;; TODO: Cross-compile.
431 (substitute* "Android.mk"
432 (("BUILD_STATIC_LIBRARY") "BUILD_HOST_STATIC_LIBRARY"))
434 (home-page "https://developer.android.com/")
435 (synopsis "Safe integers in C")
436 (description "@code{android-safe-iop} provides a set of functions for
437 performing and checking safe integer operations. Ensure that integer
438 operations do not result in silent overflow.")
439 (license license:bsd-2)))
441 (define-public android-bionic-uapi
443 (name "android-bionic-uapi")
444 (version (android-platform-version))
445 (source (android-platform-bionic version))
446 (build-system android-ndk-build-system)
449 (modify-phases %standard-phases
450 (add-after 'unpack 'enter-source
451 (lambda _ (chdir "libc") #t))
457 (lambda* (#:key outputs #:allow-other-keys)
458 (let* ((out (assoc-ref outputs "out"))
459 (out-sys (string-append out "/include/sys")))
461 (install-file "include/sys/system_properties.h" out-sys)
462 (install-file "include/sys/_system_properties.h" out-sys)
463 (copy-recursively "kernel/uapi" (string-append out "/include"))
465 (home-page "https://developer.android.com/")
466 (synopsis "Android Linux API that is safe for user space")
467 (description "@code{android-bionic-uapi} provides the part of the Linux API
468 that is safe to use for user space. It also includes
469 @code{system_properties.h} and @code{_system_properties.h}.")
470 (license license:asl2.0)))
472 (define-public android-libselinux
474 (name "android-libselinux")
475 (version (android-platform-version))
477 (android-platform-external version "libselinux"
478 "13m2q32gzdcs5d0zj1nwasjy1j8vsxsgbjg7m5sa9lfcjaj7nkm7"))
479 (build-system android-ndk-build-system)
481 ;; See logd/Android.mk for the *_LOG_TAG values.
482 `(#:make-flags (list (string-append "CFLAGS=-Wno-error "
484 "-I core/libpackagelistparser/include "
485 "-DAUDITD_LOG_TAG=1003 "
486 "-DLOGD_LOG_TAG=1004 -D_GNU_SOURCE")
487 "LDFLAGS=-L . -lpcre")
489 (modify-phases %standard-phases
490 (add-after 'unpack-core 'patch-HOST
492 ;; gettid duplicates otherwise.
493 (substitute* "src/procattr.c"
494 (("#ifdef HOST") "#ifdef XXX"))
497 `(("openssl" ,openssl)))
499 `(("android-bionic-uapi" ,android-bionic-uapi)
500 ;; pcre is inlined by our package.
502 (home-page "https://developer.android.com/")
503 (synopsis "Android version of the SELinux libraries and utilities")
505 "The libselinux library provides an API for SELinux applications to get
506 and set process and file security contexts, and to obtain security policy
507 decisions. It is required for any applications that use the SELinux API, and
508 used by all applications that are SELinux-aware. This package also includes
509 the core SELinux management utilities.")
510 (license license:public-domain)))
512 (define-public android-ext4-utils
514 (name "android-ext4-utils")
515 (version (android-platform-version))
516 (source (android-platform-system-extras version))
517 (build-system android-ndk-build-system)
520 (list (string-append "CPPFLAGS="
523 (assoc-ref %build-inputs "android-libselinux")
525 "-I " (assoc-ref %build-inputs "android-libsparse")
527 "-I " (assoc-ref %build-inputs "android-libcutils")
529 "-I " (assoc-ref %build-inputs "android-liblog") "/include "
530 "-I ../core/include")
532 "install-libext4_utils_host.a"
533 (string-append "prefix=" (assoc-ref %outputs "out")))
535 (modify-phases %standard-phases
536 (add-after 'unpack 'unpack-core
537 (lambda* (#:key inputs #:allow-other-keys)
539 (with-directory-excursion "core"
540 (invoke "tar" "axf" (assoc-ref inputs "android-core")
541 "--strip-components=1"))
543 (add-after 'unpack-core 'enter-source
544 (lambda _ (chdir "ext4_utils") #t))
546 (lambda* (#:key inputs outputs #:allow-other-keys)
547 (let ((out (assoc-ref outputs "out")))
548 (copy-recursively "." (string-append out "/include")))
551 `(("android-libcutils" ,android-libcutils)
552 ("android-liblog" ,android-liblog)
553 ("android-libselinux" ,android-libselinux)
554 ("android-libsparse" ,android-libsparse)
557 `(("android-core" ,(android-platform-system-core version))))
558 (home-page "https://developer.android.com/")
559 (synopsis "Android ext4 file system utilities")
560 (description "@code{android-ext4-utils} is a library in common use by the
562 (license license:asl2.0)))
564 (define-public android-f2fs-utils
566 (name "android-f2fs-utils")
567 (version (android-platform-version))
568 (source (android-platform-system-extras version))
569 (build-system android-ndk-build-system)
572 (modify-phases %standard-phases
573 (add-after 'unpack 'enter-source
574 (lambda _ (chdir "f2fs_utils") #t))
575 (add-after 'install 'install-headers
576 (lambda* (#:key inputs outputs #:allow-other-keys)
577 (copy-recursively "." (string-append (assoc-ref outputs "out")
580 (add-after 'install 'install-shell-scripts
581 (lambda* (#:key outputs #:allow-other-keys)
582 (let* ((out (assoc-ref outputs "out"))
583 (bin (string-append out "/bin")))
584 (patch-shebang "mkf2fsuserimg.sh")
585 (substitute* "mkf2fsuserimg.sh"
586 (("make_f2fs") (string-append bin "/make_f2fs")))
587 (install-file "mkf2fsuserimg.sh" bin)
590 `(("f2fs-tools" ,f2fs-tools-1.7)
591 ("android-libselinux" ,android-libselinux)
592 ("android-libsparse" ,android-libsparse)
593 ("android-libcutils" ,android-libcutils)
595 (home-page "https://developer.android.com/")
596 (synopsis "Android f2fs utils")
597 (description "@code{android-f2fs-utils} is a library in common use by the
598 Android core. It allows the user to create images for the @code{f2fs} Flash
600 (license license:asl2.0)))
602 (define-public android-libutils
604 (name "android-libutils")
605 (version (android-platform-version))
606 (source (android-platform-system-core version))
607 (build-system android-ndk-build-system)
610 #:make-flags '("CXXFLAGS=-std=gnu++11 -Wno-error")
612 (modify-phases %standard-phases
613 (add-after 'unpack 'enter-source
614 (lambda _ (chdir "libutils") #t))
616 (add-after 'install 'install-headers
617 (lambda* (#:key inputs outputs #:allow-other-keys)
618 (copy-recursively "../include/utils" (string-append (assoc-ref outputs "out") "/include/utils")))))))
620 `(("android-safe-iop" ,android-safe-iop)
621 ("android-libcutils" ,android-libcutils)))
623 `(("android-bionic-uapi" ,android-bionic-uapi)
624 ("android-liblog" ,android-liblog)
625 ("gcc" ,gcc-5))) ; XXX: fails to build with GCC 7
626 (home-page "https://developer.android.com/")
627 (synopsis "Android utility library")
628 (description "@code{android-libutils} provides utilities for Android NDK developers.")
629 (license license:asl2.0)))
631 (define-public fastboot
634 (version (android-platform-version))
635 (source (android-platform-system-core version))
636 (build-system android-ndk-build-system)
639 (modify-phases %standard-phases
640 (add-after 'unpack 'enter-source
644 (add-after 'enter-source 'patch-source
646 (substitute* "Android.mk"
647 (("libext4_utils_host") "libext4_utils_host libselinux libpcre"))
650 (lambda* (#:key outputs #:allow-other-keys)
651 (let* ((out (assoc-ref outputs "out"))
652 (lib (string-append out "/lib"))
653 (bin (string-append out "/bin")))
654 (install-file "fastboot" bin)
658 ("android-safe-iop" ,android-safe-iop)
659 ("android-ext4-utils" ,android-ext4-utils)
660 ("android-f2fs-utils" ,android-f2fs-utils)
661 ("android-libbase" ,android-libbase)
662 ("android-libcutils" ,android-libcutils)
663 ("android-liblog" ,android-liblog)
664 ("android-libutils" ,android-libutils)
665 ("android-libsparse" ,android-libsparse)
666 ("android-libziparchive" ,android-libziparchive)
667 ("android-libselinux" ,android-libselinux)
669 ("mkbootimg" ,mkbootimg)
673 (home-page "https://developer.android.com/studio/command-line/")
674 (synopsis "Android image flasher")
676 "This package provides @command{fastboot}, a tool to upload file system images to Android devices.")
677 (license license:asl2.0)))
679 (define-public android-udev-rules
681 (name "android-udev-rules")
687 (url "https://github.com/M0Rf30/android-udev-rules")
689 (file-name (git-file-name name version))
691 (base32 "0x2f2sv0x0ry7kccp47s0hlxps3hbpg37dj3xjjgpdm5hmn2cjq3"))))
692 (build-system trivial-build-system)
693 (native-inputs `(("source" ,source)))
695 '(#:modules ((guix build utils))
698 (use-modules (guix build utils))
699 (let ((source (assoc-ref %build-inputs "source")))
700 (install-file (string-append source "/51-android.rules")
701 (string-append %output "/lib/udev/rules.d"))
703 (home-page "https://github.com/M0Rf30/android-udev-rules")
704 (synopsis "udev rules for Android devices")
705 (description "Provides a set of udev rules to allow using Android devices
706 with tools such as @command{adb} and @command{fastboot} without root
707 privileges. This package is intended to be added as a rule to the
708 @code{udev-service-type} in your @code{operating-system} configuration.
709 Additionally, an @code{adbusers} group must be defined and your user added to
712 @emph{Simply installing this package will not have any effect.} It is meant
713 to be passed to the @code{udev} service.")
714 (license license:gpl3+)))
716 (define-public git-repo
724 (url "https://gerrit.googlesource.com/git-repo")
725 (commit (string-append "v" version))))
726 (file-name (string-append "git-repo-" version "-checkout"))
728 (base32 "0qp7jqhblv7xblfgpcq4n18dyjdv8shz7r60c3vnjxx2fngkj2jd"))))
729 (build-system python-build-system)
731 `(#:python ,python-2 ; code says: "Python 3 support is … experimental."
733 (modify-phases %standard-phases
734 (add-before 'build 'set-executable-paths
735 (lambda* (#:key inputs outputs #:allow-other-keys)
736 (let* ((out (assoc-ref outputs "out"))
737 (git (assoc-ref inputs "git"))
738 (gpg (assoc-ref inputs "gnupg"))
739 (ssh (assoc-ref inputs "ssh")))
740 (substitute* '("repo" "git_command.py")
742 (string-append "GIT = '" git "/bin/git' ")))
744 ((" cmd = \\['gpg',")
745 (string-append " cmd = ['" gpg "/bin/gpg',")))
746 (substitute* "git_config.py"
747 ((" command_base = \\['ssh',")
748 (string-append " command_base = ['" ssh "/bin/ssh',")))
750 (add-before 'build 'do-not-clone-this-source
751 (lambda* (#:key outputs #:allow-other-keys)
752 (let* ((out (assoc-ref outputs "out"))
753 (repo-dir (string-append out "/share/" ,name)))
755 (("^def _FindRepo\\(\\):.*")
758 '''Look for a repo installation, starting at the current directory.'''
759 # Use the installed version of git-repo.
760 repo_main = '~a/main.py'
763 while curdir != '/' and curdir != olddir:
764 dot_repo = os.path.join(curdir, repodir)
765 if os.path.isdir(dot_repo):
766 return (repo_main, dot_repo)
769 curdir = os.path.dirname(curdir)
772 # The remaining of this function is dead code. It was used to
773 # find a git-checked-out version in the local project.\n" repo-dir))
774 ;; Neither clone, check out, nor verify the git repository
775 (("(^\\s+)_Clone\\(.*\\)") "")
776 (("(^\\s+)_Checkout\\(.*\\)") "")
777 ((" rev = _Verify\\(.*\\)") " rev = None"))
779 (delete 'build) ; nothing to build
782 (invoke "python" "-m" "nose")))
784 (lambda* (#:key outputs #:allow-other-keys)
785 (let* ((out (assoc-ref outputs "out"))
786 (bin-dir (string-append out "/bin"))
787 (repo-dir (string-append out "/share/" ,name)))
790 (copy-recursively "." repo-dir)
791 (delete-file-recursively (string-append repo-dir "/tests"))
792 (symlink (string-append repo-dir "/repo")
793 (string-append bin-dir "/repo"))
796 ;; TODO: Add git-remote-persistent-https once it is available in guix
801 `(("nose" ,python2-nose)))
802 (home-page "https://code.google.com/p/git-repo/")
803 (synopsis "Helps to manage many Git repositories.")
804 (description "Repo is a tool built on top of Git. Repo helps manage many
805 Git repositories, does the uploads to revision control systems, and automates
806 parts of the development workflow. Repo is not meant to replace Git, only to
807 make it easier to work with Git. The repo command is an executable Python
808 script that you can put anywhere in your path.")
809 (license license:asl2.0)))
811 (define-public abootimg
818 (uri (string-append "http://http.debian.net/debian/pool/main/a/abootimg/"
819 "abootimg_" version ".orig.tar.gz"))
821 (base32 "0sfc2k011l1ymv97821w89391gnqdh8pp0haz4sdcm5hx0axv2ba"))))
822 (build-system gnu-build-system)
826 (modify-phases %standard-phases
832 (lambda* (#:key outputs #:allow-other-keys)
833 (let* ((out (assoc-ref outputs "out"))
834 (bin (string-append out "/bin")))
835 (install-file "abootimg" bin)
838 `(("libblkid" ,util-linux)))
839 (home-page "https://ac100.grandou.net/abootimg")
840 (synopsis "Tool for manipulating Android Boot Images")
841 (description "This package provides a tool for manipulating old Android
842 Boot Images. @code{abootimg} can work directly on block devices, or, the
843 safest way, on a file image.")
844 (license license:gpl2+)))
846 (define-public python-androguard
848 (name "python-androguard")
852 ;; The pypi release doesn't have the tests, but the tests use
853 ;; packaged binaries, so we skip them.
855 (uri (pypi-uri "androguard" version))
858 "0ndsw00pkyda4i2s3wi5ap8gbk6a9d23xhhxpdbk02padv8sxkfv"))))
859 (build-system python-build-system)
862 (modify-phases %standard-phases
864 ;; Adapted from .travis.yml
866 (invoke "nosetests" "--with-coverage" "--with-timer"
867 "--timer-top-n" "50"))))))
869 `(("python-codecov" ,python-codecov)
870 ("python-coverage" ,python-coverage)
871 ("python-mock" ,python-mock)
872 ("python-nose" ,python-nose)
873 ("python-nose-timer" ,python-nose-timer)))
875 `(("python-asn1crypto" ,python-asn1crypto)
876 ("python-colorama" ,python-colorama)
877 ("python-future" ,python-future)
878 ("python-ipython" ,python-ipython)
879 ("python-lxml" ,python-lxml)
880 ("python-matplotlib" ,python-matplotlib)
881 ("python-networkx" ,python-networkx)
882 ("python-pygments" ,python-pygments)
883 ("python-pyperclip" ,python-pyperclip)))
884 (home-page "https://github.com/androguard/androguard")
885 (synopsis "Python tool to play with Android files")
887 "Androguard is a full Python tool to manipulate Android files. It is
888 useful for reverse engineering, analysis of Android applications and more.")
889 (license license:asl2.0)))
891 (define-public fdroidserver
893 (name "fdroidserver")
898 (uri (pypi-uri "fdroidserver" version))
901 "0fp7q8faicx6i6wxm717qqaham3jpilb23mvynpz6v73z7hm6wcg"))))
902 (build-system python-build-system)
905 (modify-phases %standard-phases
906 (add-after 'unpack 'fix-versioning
908 (substitute* "setup.py"
909 (("0.2.1") ,(package-version python-pyasn1-modules)))
912 `(("python-androguard" ,python-androguard)
913 ("python-apache-libcloud" ,python-apache-libcloud)
914 ("python-clint" ,python-clint)
915 ("python-defusedxml" ,python-defusedxml)
916 ("python-docker-py" ,python-docker-py)
917 ("python-gitpython" ,python-gitpython)
918 ("python-mwclient" ,python-mwclient)
919 ("python-paramiko" ,python-paramiko)
920 ("python-pillow" ,python-pillow)
921 ("python-pyasn1" ,python-pyasn1)
922 ("python-pyasn1-modules" ,python-pyasn1-modules)
923 ("python-pyyaml" ,python-pyyaml)
924 ("python-qrcode" ,python-qrcode)
925 ("python-ruamel.yaml" ,python-ruamel.yaml)
926 ("python-requests" ,python-requests)
927 ("python-vagrant" ,python-vagrant)))
929 `(("python-babel" ,python-babel)
930 ("python-bcrypt" ,python-bcrypt)
931 ("python-docker-pycreds" ,python-docker-pycreds)
932 ("python-pynacl" ,python-pynacl)
933 ("python-websocket-client" ,python-websocket-client)))
934 (home-page "https://f-droid.org")
935 (synopsis "F-Droid server tools")
937 "The F-Droid server tools provide various scripts and tools that are used
938 to maintain F-Droid, the repository of free Android applications. You can use
939 these same tools to create your own additional or alternative repository for
940 publishing, or to assist in creating, testing and submitting metadata to the
942 (license license:agpl3+)))
944 (define-public enjarify
948 (home-page "https://github.com/Storyyeller/enjarify")
955 (file-name (git-file-name name version))
957 (search-patches "enjarify-setup-py.patch"))
960 "1nam7h1g4f1h6jla4qcjjagnyvd24dv6d5445w04q8hx07nxdapk"))))
961 (build-system python-build-system)
964 (modify-phases %standard-phases
965 (add-after 'unpack 'enjarify-wrapper-inherit-pythonpath
966 ;; enjarify sets PYTHONPATH from a shell script, overwriting
967 ;; PYTHONPATH set from guix. Comment out this line.
969 (substitute* "enjarify.sh"
970 (("export PYTHONPATH") "# export PYTHONPATH"))
972 (add-before 'check 'fixup-expected-test-results
973 ;; Upstream adjusted this test in commit:
974 ;; 3ae884a6485af82d300515813f537685b08dd800
976 (substitute* "tests/test2/expected.txt"
979 (add-before 'check 'drop-java-xss-argument
980 ;; Upstream removed this argument in order to support 32-bit
981 ;; architectures. commit: 4be0111d879aa95fdc0d9f24fe529f8c664d4093
983 (substitute* "enjarify/runtests.py"
984 (("java -Xss515m") "java "))
986 (add-after 'install 'install-enjarify-wrapper
987 (lambda* (#:key outputs #:allow-other-keys)
988 (let* ((out (assoc-ref outputs "out")))
989 (mkdir-p (string-append out "/bin/"))
990 (copy-file "enjarify.sh" (string-append out "/bin/enjarify"))
992 (native-inputs `(("openjdk" ,openjdk12)))
993 (synopsis "Translate Dalvik bytecode to equivalent Java bytecode")
994 (description "Android applications are Java programs that run on a
995 customized virtual machine, which is part of the Android operating system, the
996 Dalvik VM. Their bytecode differs from the bytecode of normal Java
997 applications. Enjarify can translate the Dalvik bytecode back to equivalent
998 Java bytecode, which simplifies the analysis of Android applications.")
999 (license license:asl2.0)))